mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-12-23 00:15:05 +00:00
Merge pull request #462 from Simplicitee/master
Fix and Upgrade passive system
This commit is contained in:
commit
1b60f5f7d7
9 changed files with 179 additions and 140 deletions
|
@ -1,13 +1,5 @@
|
||||||
package com.projectkorra.projectkorra;
|
package com.projectkorra.projectkorra;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
|
|
||||||
import com.bekvon.bukkit.residence.protection.FlagPermissions;
|
import com.bekvon.bukkit.residence.protection.FlagPermissions;
|
||||||
import com.projectkorra.projectkorra.ability.CoreAbility;
|
import com.projectkorra.projectkorra.ability.CoreAbility;
|
||||||
import com.projectkorra.projectkorra.ability.util.ComboManager;
|
import com.projectkorra.projectkorra.ability.util.ComboManager;
|
||||||
|
@ -21,11 +13,20 @@ import com.projectkorra.projectkorra.firebending.FirebendingManager;
|
||||||
import com.projectkorra.projectkorra.object.Preset;
|
import com.projectkorra.projectkorra.object.Preset;
|
||||||
import com.projectkorra.projectkorra.storage.DBConnection;
|
import com.projectkorra.projectkorra.storage.DBConnection;
|
||||||
import com.projectkorra.projectkorra.util.MetricsLite;
|
import com.projectkorra.projectkorra.util.MetricsLite;
|
||||||
|
import com.projectkorra.projectkorra.util.PassiveHandler;
|
||||||
import com.projectkorra.projectkorra.util.RevertChecker;
|
import com.projectkorra.projectkorra.util.RevertChecker;
|
||||||
import com.projectkorra.projectkorra.util.Updater;
|
import com.projectkorra.projectkorra.util.Updater;
|
||||||
import com.projectkorra.projectkorra.util.logging.PKLogHandler;
|
import com.projectkorra.projectkorra.util.logging.PKLogHandler;
|
||||||
import com.projectkorra.projectkorra.waterbending.WaterbendingManager;
|
import com.projectkorra.projectkorra.waterbending.WaterbendingManager;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
public class ProjectKorra extends JavaPlugin {
|
public class ProjectKorra extends JavaPlugin {
|
||||||
|
|
||||||
public static ProjectKorra plugin;
|
public static ProjectKorra plugin;
|
||||||
|
@ -78,6 +79,7 @@ public class ProjectKorra extends JavaPlugin {
|
||||||
getServer().getScheduler().scheduleSyncRepeatingTask(this, new EarthbendingManager(this), 0, 1);
|
getServer().getScheduler().scheduleSyncRepeatingTask(this, new EarthbendingManager(this), 0, 1);
|
||||||
getServer().getScheduler().scheduleSyncRepeatingTask(this, new FirebendingManager(this), 0, 1);
|
getServer().getScheduler().scheduleSyncRepeatingTask(this, new FirebendingManager(this), 0, 1);
|
||||||
getServer().getScheduler().scheduleSyncRepeatingTask(this, new ChiblockingManager(this), 0, 1);
|
getServer().getScheduler().scheduleSyncRepeatingTask(this, new ChiblockingManager(this), 0, 1);
|
||||||
|
getServer().getScheduler().scheduleSyncRepeatingTask(this, new PassiveHandler(), 0, 1);
|
||||||
getServer().getScheduler().runTaskTimerAsynchronously(this, new RevertChecker(this), 0, 200);
|
getServer().getScheduler().runTaskTimerAsynchronously(this, new RevertChecker(this), 0, 200);
|
||||||
|
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
|
|
|
@ -1,74 +1,11 @@
|
||||||
package com.projectkorra.projectkorra.airbending;
|
package com.projectkorra.projectkorra.airbending;
|
||||||
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.potion.PotionEffect;
|
|
||||||
import org.bukkit.potion.PotionEffectType;
|
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.BendingPlayer;
|
|
||||||
import com.projectkorra.projectkorra.Element;
|
|
||||||
import com.projectkorra.projectkorra.chiblocking.ChiPassive;
|
|
||||||
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
||||||
|
|
||||||
public class AirPassive {
|
public class AirPassive {
|
||||||
|
|
||||||
private static final ConcurrentHashMap<Player, Float> FOOD = new ConcurrentHashMap<>();
|
public static double getExhaustionFactor() {
|
||||||
|
return getFactor();
|
||||||
public static float getExhaustion(Player player, float level) {
|
|
||||||
if (!FOOD.keySet().contains(player)) {
|
|
||||||
FOOD.put(player, level);
|
|
||||||
return level;
|
|
||||||
} else {
|
|
||||||
float oldlevel = FOOD.get(player);
|
|
||||||
if (level < oldlevel) {
|
|
||||||
level = 0;
|
|
||||||
} else {
|
|
||||||
double factor = getFactor();
|
|
||||||
level = (float) ((level - oldlevel) * factor + oldlevel);
|
|
||||||
}
|
|
||||||
FOOD.replace(player, level);
|
|
||||||
return level;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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.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)) {
|
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 60, speedPower));
|
|
||||||
}
|
|
||||||
if (!player.hasPotionEffect(PotionEffectType.JUMP)) {
|
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 60, jumpPower));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double getFactor() {
|
public static double getFactor() {
|
||||||
|
|
|
@ -13,7 +13,6 @@ public class AirbendingManager implements Runnable {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
AirBlast.progressOrigins();
|
AirBlast.progressOrigins();
|
||||||
AirPassive.handlePassive();
|
|
||||||
AirBubble.handleBubbles();
|
AirBubble.handleBubbles();
|
||||||
AirSuction.progressOrigins();
|
AirSuction.progressOrigins();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,14 @@
|
||||||
package com.projectkorra.projectkorra.chiblocking;
|
package com.projectkorra.projectkorra.chiblocking;
|
||||||
|
|
||||||
import com.projectkorra.projectkorra.BendingPlayer;
|
import com.projectkorra.projectkorra.BendingPlayer;
|
||||||
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;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.potion.PotionEffect;
|
|
||||||
import org.bukkit.potion.PotionEffectType;
|
|
||||||
|
|
||||||
public class ChiPassive {
|
public class ChiPassive {
|
||||||
|
|
||||||
|
@ -64,44 +60,10 @@ public class ChiPassive {
|
||||||
}, getTicks());
|
}, getTicks());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void handlePassive() {
|
public static double getExhaustionFactor() {
|
||||||
int speedPower = 0;
|
return ConfigManager.getConfig().getDouble("Abilities.Chi.Passive.ExhaustionFactor");
|
||||||
int jumpPower = 0;
|
|
||||||
|
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
|
||||||
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
|
||||||
if (bPlayer == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
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, speedPower));
|
|
||||||
}
|
|
||||||
if (!player.hasPotionEffect(PotionEffectType.JUMP)) {
|
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 60, jumpPower));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static double getFallReductionFactor() {
|
public static double getFallReductionFactor() {
|
||||||
return ConfigManager.getConfig().getDouble("Abilities.Chi.Passive.FallReductionFactor");
|
return ConfigManager.getConfig().getDouble("Abilities.Chi.Passive.FallReductionFactor");
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,9 @@ package com.projectkorra.projectkorra.chiblocking;
|
||||||
import com.projectkorra.projectkorra.ProjectKorra;
|
import com.projectkorra.projectkorra.ProjectKorra;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
public class ChiblockingManager implements Runnable {
|
public class ChiblockingManager implements Runnable {
|
||||||
public ProjectKorra plugin;
|
public ProjectKorra plugin;
|
||||||
|
@ -11,13 +13,15 @@ public class ChiblockingManager implements Runnable {
|
||||||
public ChiblockingManager(ProjectKorra plugin) {
|
public ChiblockingManager(ProjectKorra plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
ChiPassive.handlePassive();
|
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
Smokescreen.removeFromHashMap(player);
|
Smokescreen.removeFromHashMap(player);
|
||||||
if (Paralyze.isParalyzed(player)) {
|
if (Paralyze.isParalyzed(player)) {
|
||||||
|
if (player.getLocation().subtract(0, 0.1, 0).getBlock().getType().equals(Material.AIR)) {
|
||||||
|
player.setVelocity(new Vector(0, -0.4, 0));
|
||||||
|
}
|
||||||
player.setFallDistance(0F);
|
player.setFallDistance(0F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -785,7 +785,7 @@ public class ConfigManager {
|
||||||
config.addDefault("Abilities.Water.WaterCombo.IceBullet.Cooldown", 10000);
|
config.addDefault("Abilities.Water.WaterCombo.IceBullet.Cooldown", 10000);
|
||||||
|
|
||||||
config.addDefault("Abilities.Earth.Passive.Duration", 2500);
|
config.addDefault("Abilities.Earth.Passive.Duration", 2500);
|
||||||
config.addDefault("Properties.Earth.Passive.SandRunSpeed", 0);
|
config.addDefault("Abilities.Earth.Passive.SandRunSpeed", 2);
|
||||||
|
|
||||||
config.addDefault("Abilities.Earth.Catapult.Enabled", true);
|
config.addDefault("Abilities.Earth.Catapult.Enabled", true);
|
||||||
config.addDefault("Abilities.Earth.Catapult.Length", 6);
|
config.addDefault("Abilities.Earth.Catapult.Length", 6);
|
||||||
|
@ -1052,6 +1052,7 @@ public class ConfigManager {
|
||||||
config.addDefault("Abilities.Fire.FireCombo.JetBlaze.Cooldown", 6000);
|
config.addDefault("Abilities.Fire.FireCombo.JetBlaze.Cooldown", 6000);
|
||||||
config.addDefault("Abilities.Fire.FireCombo.JetBlaze.FireTicks", 2.5);
|
config.addDefault("Abilities.Fire.FireCombo.JetBlaze.FireTicks", 2.5);
|
||||||
|
|
||||||
|
config.addDefault("Abilities.Chi.Passive.ExhaustionFactor", 0.3);
|
||||||
config.addDefault("Abilities.Chi.Passive.FallReductionFactor", 0.5);
|
config.addDefault("Abilities.Chi.Passive.FallReductionFactor", 0.5);
|
||||||
config.addDefault("Abilities.Chi.Passive.Speed", 1);
|
config.addDefault("Abilities.Chi.Passive.Speed", 1);
|
||||||
config.addDefault("Abilities.Chi.Passive.Jump", 1);
|
config.addDefault("Abilities.Chi.Passive.Jump", 1);
|
||||||
|
|
|
@ -15,8 +15,6 @@ import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.material.MaterialData;
|
import org.bukkit.material.MaterialData;
|
||||||
import org.bukkit.potion.PotionEffect;
|
|
||||||
import org.bukkit.potion.PotionEffectType;
|
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
@ -95,23 +93,6 @@ public class EarthPassive {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sandSpeed() {
|
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
|
||||||
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
|
||||||
|
|
||||||
if (bPlayer != null) {
|
|
||||||
if (bPlayer.canSandbend() && bPlayer.hasElement(Element.EARTH)
|
|
||||||
&& !bPlayer.canBendPassive(Element.AIR) && !bPlayer.canBendPassive(Element.CHI)) {
|
|
||||||
if (player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() == Material.SAND
|
|
||||||
|| player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() == Material.SANDSTONE
|
|
||||||
|| player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() == Material.RED_SANDSTONE) {
|
|
||||||
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 60, getSandRunSpeed()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public static void handleMetalPassives() {
|
public static void handleMetalPassives() {
|
||||||
for (Player player : Bukkit.getOnlinePlayers()) {
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
|
@ -203,6 +184,6 @@ public class EarthPassive {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getSandRunSpeed() {
|
public static int getSandRunSpeed() {
|
||||||
return ConfigManager.getConfig().getInt("Properties.Earth.Passive.SandRunSpeed");
|
return ConfigManager.getConfig().getInt("Abilities.Earth.Passive.SandRunSpeed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@ public class EarthbendingManager implements Runnable {
|
||||||
public void run() {
|
public void run() {
|
||||||
EarthPassive.revertSands();
|
EarthPassive.revertSands();
|
||||||
EarthPassive.handleMetalPassives();
|
EarthPassive.handleMetalPassives();
|
||||||
EarthPassive.sandSpeed();
|
|
||||||
RevertChecker.revertEarthBlocks();
|
RevertChecker.revertEarthBlocks();
|
||||||
Shockwave.progressAll();
|
Shockwave.progressAll();
|
||||||
Tremorsense.manage(Bukkit.getServer());
|
Tremorsense.manage(Bukkit.getServer());
|
||||||
|
|
154
src/com/projectkorra/projectkorra/util/PassiveHandler.java
Normal file
154
src/com/projectkorra/projectkorra/util/PassiveHandler.java
Normal file
|
@ -0,0 +1,154 @@
|
||||||
|
package com.projectkorra.projectkorra.util;
|
||||||
|
|
||||||
|
import com.projectkorra.projectkorra.BendingPlayer;
|
||||||
|
import com.projectkorra.projectkorra.Element;
|
||||||
|
import com.projectkorra.projectkorra.Element.SubElement;
|
||||||
|
import com.projectkorra.projectkorra.ability.CoreAbility;
|
||||||
|
import com.projectkorra.projectkorra.airbending.AirPassive;
|
||||||
|
import com.projectkorra.projectkorra.chiblocking.AcrobatStance;
|
||||||
|
import com.projectkorra.projectkorra.chiblocking.ChiPassive;
|
||||||
|
import com.projectkorra.projectkorra.configuration.ConfigManager;
|
||||||
|
import com.projectkorra.projectkorra.earthbending.EarthPassive;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
public class PassiveHandler implements Runnable{
|
||||||
|
|
||||||
|
private static final ConcurrentHashMap<Player, Float> FOOD = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
|
public static float getExhaustion(Player player, float level, double factor) {
|
||||||
|
if (!FOOD.keySet().contains(player)) {
|
||||||
|
FOOD.put(player, level);
|
||||||
|
return level;
|
||||||
|
} else {
|
||||||
|
float oldlevel = FOOD.get(player);
|
||||||
|
if (level < oldlevel) {
|
||||||
|
level = 0;
|
||||||
|
} else {
|
||||||
|
level = (float) ((level - oldlevel) * factor + oldlevel);
|
||||||
|
}
|
||||||
|
FOOD.replace(player, level);
|
||||||
|
return level;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void handleSpeedPassives() {
|
||||||
|
int air = AirPassive.getSpeedPower();
|
||||||
|
int chi = ChiPassive.getSpeedPower();
|
||||||
|
int earth = EarthPassive.getSandRunSpeed();
|
||||||
|
|
||||||
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
|
if (ConfigManager.defaultConfig.get().getStringList("Properties.DisabledWorlds").contains(player.getWorld().getName())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean sandbender = true;
|
||||||
|
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
||||||
|
|
||||||
|
if (bPlayer == null) continue;
|
||||||
|
if (!bPlayer.hasElement(Element.EARTH)) sandbender = false;
|
||||||
|
if (!bPlayer.hasSubElement(SubElement.SAND)) sandbender = false;
|
||||||
|
if (!bPlayer.hasElement(Element.AIR)) air = 0;
|
||||||
|
if (!bPlayer.hasElement(Element.CHI)) chi = 0;
|
||||||
|
|
||||||
|
int max = 0;
|
||||||
|
|
||||||
|
if (sandbender && (player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() == Material.SAND
|
||||||
|
|| player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() == Material.SANDSTONE
|
||||||
|
|| player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() == Material.RED_SANDSTONE)) {
|
||||||
|
if (CoreAbility.hasAbility(player, AcrobatStance.class)) {
|
||||||
|
AcrobatStance abil = CoreAbility.getAbility(player, AcrobatStance.class);
|
||||||
|
max = Math.max(air, chi);
|
||||||
|
max = Math.max(max, abil.getSpeed());
|
||||||
|
max = Math.max(max, earth);
|
||||||
|
} else {
|
||||||
|
max = Math.max(air, chi);
|
||||||
|
max = Math.max(max, earth);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (CoreAbility.hasAbility(player, AcrobatStance.class)) {
|
||||||
|
AcrobatStance abil = CoreAbility.getAbility(player, AcrobatStance.class);
|
||||||
|
max = Math.max(air, chi);
|
||||||
|
max = Math.max(max, abil.getSpeed());
|
||||||
|
} else {
|
||||||
|
max = Math.max(air, chi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (max == 0) continue;
|
||||||
|
if (player.isSprinting()) {
|
||||||
|
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 3, max-1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void handleJumpPassives() {
|
||||||
|
int air = AirPassive.getJumpPower();
|
||||||
|
int chi = ChiPassive.getJumpPower();
|
||||||
|
|
||||||
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
|
if (ConfigManager.defaultConfig.get().getStringList("Properties.DisabledWorlds").contains(player.getWorld().getName())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
||||||
|
|
||||||
|
if (bPlayer == null) continue;
|
||||||
|
if (!bPlayer.hasElement(Element.AIR)) air = 0;
|
||||||
|
if (!bPlayer.hasElement(Element.CHI)) chi = 0;
|
||||||
|
int max = 0;
|
||||||
|
if (CoreAbility.hasAbility(player, AcrobatStance.class)) {
|
||||||
|
AcrobatStance abil = CoreAbility.getAbility(player, AcrobatStance.class);
|
||||||
|
max = Math.max(air, chi);
|
||||||
|
max = Math.max(max, abil.getSpeed());
|
||||||
|
} else {
|
||||||
|
max = Math.max(air, chi);
|
||||||
|
if (max == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (player.isSprinting()) {
|
||||||
|
player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 3, max-1), false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void handleExhaustionPassives() {
|
||||||
|
double air = AirPassive.getExhaustionFactor();
|
||||||
|
double chi = ChiPassive.getExhaustionFactor();
|
||||||
|
|
||||||
|
for (Player player : Bukkit.getOnlinePlayers()) {
|
||||||
|
if (ConfigManager.defaultConfig.get().getStringList("Properties.DisabledWorlds").contains(player.getWorld().getName())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
|
||||||
|
|
||||||
|
if (bPlayer == null) continue;
|
||||||
|
|
||||||
|
if (!bPlayer.hasElement(Element.AIR)) air = 0;
|
||||||
|
if (!bPlayer.hasElement(Element.CHI)) chi = 0;
|
||||||
|
|
||||||
|
double max = Math.max(air, chi);
|
||||||
|
if (max == 0) continue;
|
||||||
|
else {
|
||||||
|
player.setExhaustion(getExhaustion(player, player.getExhaustion(), max));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
handleSpeedPassives();
|
||||||
|
handleJumpPassives();
|
||||||
|
handleExhaustionPassives();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue