mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-09-11 04:39:32 +00:00
Merge remote-tracking branch 'refs/remotes/ProjectKorra/master'
This commit is contained in:
commit
dd461e54d1
|
@ -1,16 +1,16 @@
|
||||||
package com.projectkorra.projectkorra.airbending;
|
package com.projectkorra.projectkorra.airbending;
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.BendingPlayer;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import com.projectkorra.projectkorra.Element;
|
|
||||||
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
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 {
|
public class AirPassive {
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ public class AirPassive {
|
||||||
if (level < oldlevel) {
|
if (level < oldlevel) {
|
||||||
level = 0;
|
level = 0;
|
||||||
} else {
|
} else {
|
||||||
double factor = getFactor();
|
double factor = getFactor();
|
||||||
level = (float) ((level - oldlevel) * factor + oldlevel);
|
level = (float) ((level - oldlevel) * factor + oldlevel);
|
||||||
}
|
}
|
||||||
FOOD.replace(player, level);
|
FOOD.replace(player, level);
|
||||||
|
@ -34,31 +34,52 @@ public class AirPassive {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void handlePassive() {
|
public static void handlePassive() {
|
||||||
for (World world : Bukkit.getServer().getWorlds()) {
|
int speedPower = 0;
|
||||||
for (Player player : world.getPlayers()) {
|
int jumpPower = 0;
|
||||||
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
|
||||||
if (!player.isOnline() || bPlayer == null) {
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
return;
|
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
||||||
|
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 (bPlayer.canBendPassive(Element.AIR)) {
|
if (player.isSprinting()) {
|
||||||
player.setExhaustion(getExhaustion(player, player.getExhaustion()));
|
if (!player.hasPotionEffect(PotionEffectType.SPEED)) {
|
||||||
if (player.isSprinting()) {
|
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 60, speedPower));
|
||||||
if (!player.hasPotionEffect(PotionEffectType.SPEED)) {
|
}
|
||||||
int speedPower = ConfigManager.getConfig().getInt("Abilities.Air.Passive.Speed");
|
if (!player.hasPotionEffect(PotionEffectType.JUMP)) {
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 60, speedPower - 1));
|
player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 60, jumpPower));
|
||||||
}
|
|
||||||
if (!player.hasPotionEffect(PotionEffectType.JUMP)) {
|
|
||||||
int jumpPower = ConfigManager.getConfig().getInt("Abilities.Air.Passive.Jump");
|
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 60, jumpPower - 1));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double getFactor() {
|
public static double getFactor() {
|
||||||
return ConfigManager.getConfig().getDouble("Abilities.Air.Passive.Factor");
|
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.ProjectKorra;
|
||||||
import com.projectkorra.projectkorra.ability.ChiAbility;
|
import com.projectkorra.projectkorra.ability.ChiAbility;
|
||||||
import com.projectkorra.projectkorra.ability.CoreAbility;
|
import com.projectkorra.projectkorra.ability.CoreAbility;
|
||||||
|
import com.projectkorra.projectkorra.airbending.AirPassive;
|
||||||
import com.projectkorra.projectkorra.airbending.Suffocate;
|
import com.projectkorra.projectkorra.airbending.Suffocate;
|
||||||
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
||||||
|
|
||||||
|
@ -64,20 +65,37 @@ public class ChiPassive {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void handlePassive() {
|
public static void handlePassive() {
|
||||||
|
int speedPower = 0;
|
||||||
|
int jumpPower = 0;
|
||||||
|
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
||||||
if (bPlayer == null) {
|
if (bPlayer == null) {
|
||||||
continue;
|
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.
|
if (bPlayer.canBendPassive(Element.CHI)) {
|
||||||
ChiAbility stance = bPlayer.getStance();
|
if (bPlayer.canBendPassive(Element.AIR)) {
|
||||||
if (player.isSprinting() && !(stance instanceof AcrobatStance)) {
|
if (AirPassive.getJumpPower() > getJumpPower()) {
|
||||||
if (!player.hasPotionEffect(PotionEffectType.JUMP)) {
|
jumpPower = AirPassive.getJumpPower();
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 60, 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)) {
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,6 +98,13 @@ public class AddCommand extends PKCommand {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bPlayer.addElement(e);
|
bPlayer.addElement(e);
|
||||||
|
|
||||||
|
for (SubElement sub : Element.getAllSubElements()) {
|
||||||
|
if (sub.getParentElement() == e && bPlayer.hasSubElementPermission(sub)) {
|
||||||
|
bPlayer.addSubElement(sub);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ChatColor color = e.getColor();
|
ChatColor color = e.getColor();
|
||||||
|
|
||||||
if (!(sender instanceof Player) || !((Player) sender).equals(target)) {
|
if (!(sender instanceof Player) || !((Player) sender).equals(target)) {
|
||||||
|
@ -106,6 +113,7 @@ public class AddCommand extends PKCommand {
|
||||||
target.sendMessage(color + added.replace("{element}", e.getName() + e.getType().getBender()));
|
target.sendMessage(color + added.replace("{element}", e.getName() + e.getType().getBender()));
|
||||||
}
|
}
|
||||||
GeneralMethods.saveElements(bPlayer);
|
GeneralMethods.saveElements(bPlayer);
|
||||||
|
GeneralMethods.saveSubElements(bPlayer);
|
||||||
Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeElementEvent(sender, target, e, Result.ADD));
|
Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeElementEvent(sender, target, e, Result.ADD));
|
||||||
return;
|
return;
|
||||||
} else if (Arrays.asList(Element.getAllSubElements()).contains(e)) {
|
} else if (Arrays.asList(Element.getAllSubElements()).contains(e)) {
|
||||||
|
|
|
@ -138,6 +138,7 @@ public class ChooseCommand extends PKCommand {
|
||||||
target.sendMessage(color + chosen.replace("{element}", element.getName() + element.getType().getBender()));
|
target.sendMessage(color + chosen.replace("{element}", element.getName() + element.getType().getBender()));
|
||||||
}
|
}
|
||||||
GeneralMethods.saveElements(bPlayer);
|
GeneralMethods.saveElements(bPlayer);
|
||||||
|
GeneralMethods.saveSubElements(bPlayer);
|
||||||
Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeElementEvent(sender, target, element, Result.CHOOSE));
|
Bukkit.getServer().getPluginManager().callEvent(new PlayerChangeElementEvent(sender, target, element, Result.CHOOSE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ public class EarthbendingManager implements Runnable {
|
||||||
EarthPassive.handleMetalPassives();
|
EarthPassive.handleMetalPassives();
|
||||||
EarthPassive.sandSpeed();
|
EarthPassive.sandSpeed();
|
||||||
RevertChecker.revertEarthBlocks();
|
RevertChecker.revertEarthBlocks();
|
||||||
|
Shockwave.progressAll();
|
||||||
Tremorsense.manage(Bukkit.getServer());
|
Tremorsense.manage(Bukkit.getServer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue