mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-09-11 04:39:32 +00:00
commit
33c291236c
|
@ -1,16 +1,16 @@
|
|||
package com.projectkorra.projectkorra.airbending;
|
||||
|
||||
import com.projectkorra.projectkorra.BendingPlayer;
|
||||
import com.projectkorra.projectkorra.Element;
|
||||
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import com.projectkorra.projectkorra.BendingPlayer;
|
||||
import com.projectkorra.projectkorra.Element;
|
||||
import com.projectkorra.projectkorra.chiblocking.ChiPassive;
|
||||
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
||||
|
||||
public class AirPassive {
|
||||
|
||||
|
@ -34,24 +34,37 @@ public class AirPassive {
|
|||
}
|
||||
|
||||
public static void handlePassive() {
|
||||
for (World world : Bukkit.getServer().getWorlds()) {
|
||||
for (Player player : world.getPlayers()) {
|
||||
int speedPower = 0;
|
||||
int jumpPower = 0;
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
||||
if (!player.isOnline() || bPlayer == null) {
|
||||
return;
|
||||
if (bPlayer == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (bPlayer.canBendPassive(Element.AIR)) {
|
||||
if (bPlayer.canBendPassive(Element.CHI)) {
|
||||
if (ChiPassive.getJumpPower() > getJumpPower()) {
|
||||
jumpPower = ChiPassive.getJumpPower();
|
||||
} else {
|
||||
jumpPower = getJumpPower();
|
||||
}
|
||||
|
||||
if (ChiPassive.getSpeedPower() > getSpeedPower()) {
|
||||
speedPower = ChiPassive.getSpeedPower();
|
||||
} else {
|
||||
speedPower = getSpeedPower();
|
||||
}
|
||||
}
|
||||
player.setExhaustion(getExhaustion(player, player.getExhaustion()));
|
||||
|
||||
if (player.isSprinting()) {
|
||||
if (!player.hasPotionEffect(PotionEffectType.SPEED)) {
|
||||
int speedPower = ConfigManager.getConfig().getInt("Abilities.Air.Passive.Speed");
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 60, speedPower - 1));
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 60, speedPower));
|
||||
}
|
||||
if (!player.hasPotionEffect(PotionEffectType.JUMP)) {
|
||||
int jumpPower = ConfigManager.getConfig().getInt("Abilities.Air.Passive.Jump");
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 60, jumpPower - 1));
|
||||
}
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 60, jumpPower));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -61,4 +74,12 @@ public class AirPassive {
|
|||
public static double getFactor() {
|
||||
return ConfigManager.getConfig().getDouble("Abilities.Air.Passive.Factor");
|
||||
}
|
||||
|
||||
public static int getJumpPower() {
|
||||
return ConfigManager.getConfig().getInt("Abilities.Air.Passive.Jump");
|
||||
}
|
||||
|
||||
public static int getSpeedPower() {
|
||||
return ConfigManager.getConfig().getInt("Abilities.Air.Passive.Speed");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import com.projectkorra.projectkorra.Element;
|
|||
import com.projectkorra.projectkorra.ProjectKorra;
|
||||
import com.projectkorra.projectkorra.ability.ChiAbility;
|
||||
import com.projectkorra.projectkorra.ability.CoreAbility;
|
||||
import com.projectkorra.projectkorra.airbending.AirPassive;
|
||||
import com.projectkorra.projectkorra.airbending.Suffocate;
|
||||
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
||||
|
||||
|
@ -64,20 +65,37 @@ public class ChiPassive {
|
|||
}
|
||||
|
||||
public static void handlePassive() {
|
||||
int speedPower = 0;
|
||||
int jumpPower = 0;
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
||||
if (bPlayer == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (bPlayer.canBendPassive(Element.CHI) && !bPlayer.canBendPassive(Element.AIR)) { // If they're an airbender and gets the boosts we want to give them that instead of the Chi.
|
||||
ChiAbility stance = bPlayer.getStance();
|
||||
if (player.isSprinting() && !(stance instanceof AcrobatStance)) {
|
||||
if (!player.hasPotionEffect(PotionEffectType.JUMP)) {
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 60, getJumpPower()));
|
||||
if (bPlayer.canBendPassive(Element.CHI)) {
|
||||
if (bPlayer.canBendPassive(Element.AIR)) {
|
||||
if (AirPassive.getJumpPower() > getJumpPower()) {
|
||||
jumpPower = AirPassive.getJumpPower();
|
||||
} else {
|
||||
jumpPower = getJumpPower();
|
||||
}
|
||||
|
||||
if (AirPassive.getSpeedPower() > getSpeedPower()) {
|
||||
speedPower = AirPassive.getSpeedPower();
|
||||
} else {
|
||||
speedPower = getSpeedPower();
|
||||
}
|
||||
}
|
||||
ChiAbility stance = bPlayer.getStance();
|
||||
|
||||
if (player.isSprinting() && !(stance instanceof AcrobatStance)) {
|
||||
if (!player.hasPotionEffect(PotionEffectType.SPEED)) {
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 60, getSpeedPower()));
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 60, speedPower));
|
||||
}
|
||||
if (!player.hasPotionEffect(PotionEffectType.JUMP)) {
|
||||
player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 60, jumpPower));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue