Various bug fixes + new event

- Added PlayerJumpEvent
- Added JUMPS map to PKListener
- Fixed fly glitch with airspout/sandspout + firejet
- Added snowBlocks config list
- Fixed AirCombo cooldowns
- Fixed FireSpin enabled config option not appearing
- Fixed speed and jump passives, no longer requires sprinting
- Fixed HealingWaters ShiftRequired config option
- Fixed Surge select range
- Fixed WaterManipulation creating water in place of ice sources
- Added snow methods to ElementalAbility and BlockSource
- Added SNOW enum value to BlockSourceType
- Added check for snow in WaterAbility.isWaterbendable()
This commit is contained in:
Benford 2016-04-13 21:00:21 -04:00
parent 1077ccbb9a
commit a1c9c54d48
15 changed files with 230 additions and 125 deletions

View file

@ -59,6 +59,7 @@ import com.projectkorra.projectkorra.event.EntityBendingDeathEvent;
import com.projectkorra.projectkorra.event.HorizontalVelocityChangeEvent;
import com.projectkorra.projectkorra.event.PlayerChangeElementEvent;
import com.projectkorra.projectkorra.event.PlayerChangeElementEvent.Result;
import com.projectkorra.projectkorra.event.PlayerJumpEvent;
import com.projectkorra.projectkorra.firebending.Blaze;
import com.projectkorra.projectkorra.firebending.BlazeArc;
import com.projectkorra.projectkorra.firebending.BlazeRing;
@ -81,6 +82,7 @@ import com.projectkorra.projectkorra.util.BlockSource;
import com.projectkorra.projectkorra.util.ClickType;
import com.projectkorra.projectkorra.util.DamageHandler;
import com.projectkorra.projectkorra.util.Flight;
import com.projectkorra.projectkorra.util.PassiveHandler;
import com.projectkorra.projectkorra.util.TempBlock;
import com.projectkorra.projectkorra.waterbending.Bloodbending;
import com.projectkorra.projectkorra.waterbending.IceBlast;
@ -99,10 +101,12 @@ import com.projectkorra.projectkorra.waterbending.WaterSpout;
import com.projectkorra.projectkorra.waterbending.WaterSpoutWave;
import com.projectkorra.rpg.RPGMethods;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Statistic;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
@ -151,6 +155,7 @@ import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerToggleFlightEvent;
import org.bukkit.event.player.PlayerToggleSneakEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector;
@ -158,6 +163,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
@ -168,6 +174,7 @@ public class PKListener implements Listener {
private static final HashMap<Player, String> BENDING_PLAYER_DEATH = new HashMap<>(); // Player killed by Bending
private static final List<UUID> RIGHT_CLICK_INTERACT = new ArrayList<UUID>(); // Player right click block
private static final ArrayList<UUID> TOGGLED_OUT = new ArrayList<>(); // Stands for toggled = false while logging out
private static final Map<Player, Integer> JUMPS = new HashMap<>();
public PKListener(ProjectKorra plugin) {
this.plugin = plugin;
@ -1034,6 +1041,7 @@ public class PKListener implements Listener {
@EventHandler
public void onPlayerJoin(PlayerJoinEvent e) {
Player player = e.getPlayer();
JUMPS.put(player, player.getStatistic(Statistic.JUMP));
GeneralMethods.createBendingPlayer(e.getPlayer().getUniqueId(), player.getName());
}
@ -1043,6 +1051,7 @@ public class PKListener implements Listener {
return;
}
AirFlight.remove(event.getPlayer());
JUMPS.remove(event.getPlayer());
}
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
@ -1101,6 +1110,45 @@ public class PKListener implements Listener {
return;
}
}
}
else {
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
double xDif = event.getTo().getX() - event.getFrom().getX();
double yDif = event.getTo().getY() - event.getFrom().getY();
double zDif = event.getTo().getZ() - event.getFrom().getZ();
if ((xDif > 0.12 || xDif < -0.12) || (yDif > 0.12 || yDif < -0.12) || (zDif > 0.12 || zDif < -0.12)) {
if (bPlayer.hasElement(Element.AIR) || bPlayer.hasElement(Element.CHI) || bPlayer.hasElement(Element.EARTH)) {
if (player.hasPotionEffect(PotionEffectType.SPEED)) {
player.removePotionEffect(PotionEffectType.SPEED);
}
PassiveHandler.checkSpeedPassives(player);
}
if (bPlayer.hasElement(Element.AIR) || bPlayer.hasElement(Element.CHI)) {
if (player.hasPotionEffect(PotionEffectType.JUMP)) {
player.removePotionEffect(PotionEffectType.JUMP);
}
PassiveHandler.checkJumpPassives(player);
PassiveHandler.checkExhaustionPassives(player);
}
}
}
if (event.getTo().getY() > event.getFrom().getY()) {
if (!(player.getLocation().getBlock().getType() == Material.VINE) && !(player.getLocation().getBlock().getType() == Material.LADDER)) {
int current = player.getStatistic(Statistic.JUMP);
int last = JUMPS.get(player);
if (last != current) {
JUMPS.put(player, current);
double yDif = event.getTo().getY() - event.getFrom().getY();
if ((yDif < 0.035 || yDif > 0.037) && (yDif < 0.116 || yDif > 0.118)) {
Bukkit.getServer().getPluginManager().callEvent(new PlayerJumpEvent(player, yDif));
}
}
}
}
}
@ -1152,7 +1200,8 @@ public class PKListener implements Listener {
}
MultiAbilityManager.remove(player);
AirFlight.remove(event.getPlayer());
AirFlight.remove(player);
JUMPS.remove(player);
}
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
@ -1651,5 +1700,9 @@ public class PKListener implements Listener {
public static ArrayList<UUID> getToggledOut() {
return TOGGLED_OUT;
}
public static Map<Player, Integer> getJumpStatistics() {
return JUMPS;
}
}

View file

@ -13,13 +13,13 @@ import com.projectkorra.projectkorra.firebending.FirebendingManager;
import com.projectkorra.projectkorra.object.Preset;
import com.projectkorra.projectkorra.storage.DBConnection;
import com.projectkorra.projectkorra.util.MetricsLite;
import com.projectkorra.projectkorra.util.PassiveHandler;
import com.projectkorra.projectkorra.util.RevertChecker;
import com.projectkorra.projectkorra.util.Updater;
import com.projectkorra.projectkorra.util.logging.PKLogHandler;
import com.projectkorra.projectkorra.waterbending.WaterbendingManager;
import org.bukkit.Bukkit;
import org.bukkit.Statistic;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
@ -79,10 +79,10 @@ public class ProjectKorra extends JavaPlugin {
getServer().getScheduler().scheduleSyncRepeatingTask(this, new EarthbendingManager(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 PassiveHandler(), 0, 1);
getServer().getScheduler().runTaskTimerAsynchronously(this, new RevertChecker(this), 0, 200);
for (Player player : Bukkit.getOnlinePlayers()) {
PKListener.getJumpStatistics().put(player, player.getStatistic(Statistic.JUMP));
GeneralMethods.createBendingPlayer(player.getUniqueId(), player.getName());
}

View file

@ -99,6 +99,10 @@ public abstract class ElementalAbility extends CoreAbility {
return material == Material.LAVA || material == Material.STATIONARY_LAVA;
}
public static boolean isSnow(Material material) {
return getConfig().getStringList("Properties.Water.SnowBlocks").contains(material.toString());
}
public static boolean isLunarEclipse(World world) {
if (world == null || !GeneralMethods.hasRPG()) {
return false;

View file

@ -107,7 +107,7 @@ public abstract class WaterAbility extends ElementalAbility {
}
public static boolean isWaterbendable(Material material) {
return isWater(material) || isIce(material) || isPlant(material);
return isWater(material) || isIce(material) || isPlant(material) || isSnow(material);
}
public static Block getIceSourceBlock(Player player, double range) {

View file

@ -69,6 +69,10 @@ public class AirCombo extends AirAbility implements ComboAbility {
if (!bPlayer.canBendIgnoreBindsCooldowns(this)) {
return;
}
if (bPlayer.isOnCooldown(ability)) {
return;
}
if (ability.equalsIgnoreCase("Twister")) {
this.range = getConfig().getDouble("Abilities.Air.AirCombo.Twister.Range");

View file

@ -384,6 +384,9 @@ public class ConfigManager {
plantBlocks.add("SUGAR_CANE_BLOCK");
plantBlocks.add("PUMPKIN_STEM");
plantBlocks.add("MELON_STEM");
ArrayList<String> snowBlocks = new ArrayList<>();
snowBlocks.add("SNOW");
config.addDefault("Properties.ImportEnabled", true);
config.addDefault("Properties.BendingAffectFallingSand.Normal", true);
@ -416,6 +419,7 @@ public class ConfigManager {
config.addDefault("Properties.Water.CanBendWithWeapons", true);
config.addDefault("Properties.Water.IceBlocks", iceBlocks);
config.addDefault("Properties.Water.PlantBlocks", plantBlocks);
config.addDefault("Properties.Water.SnowBlocks", snowBlocks);
config.addDefault("Properties.Water.NightFactor", 1.5);
config.addDefault("Properties.Water.FullMoonFactor", 2.0);
config.addDefault("Properties.Water.PlaySound", true);
@ -660,6 +664,7 @@ public class ConfigManager {
config.addDefault("Abilities.Water.Surge.Enabled", true);
config.addDefault("Abilities.Water.Surge.Wave.Radius", 3);
config.addDefault("Abilities.Water.Surge.Wave.Range", 20);
config.addDefault("Abilities.Water.Surge.Wave.SelectRange", 7);
config.addDefault("Abilities.Water.Surge.Wave.HorizontalPush", 1);
config.addDefault("Abilities.Water.Surge.Wave.VerticalPush", 0.2);
config.addDefault("Abilities.Water.Surge.Wave.MaxFreezeRadius", 7);
@ -1035,6 +1040,7 @@ public class ConfigManager {
config.addDefault("Abilities.Fire.FireCombo.FireKick.Range", 7.0);
config.addDefault("Abilities.Fire.FireCombo.FireKick.Damage", 3.0);
config.addDefault("Abilities.Fire.FireCombo.FireKick.Cooldown", 5500);
config.addDefault("Abilities.Fire.FireCombo.FireSpin.Enabled", true);
config.addDefault("Abilities.Fire.FireCombo.FireSpin.Range", 7);
config.addDefault("Abilities.Fire.FireCombo.FireSpin.Damage", 3.0);
config.addDefault("Abilities.Fire.FireCombo.FireSpin.Knockback", 3.0);

View file

@ -2,6 +2,7 @@ package com.projectkorra.projectkorra.earthbending;
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.EarthAbility;
import com.projectkorra.projectkorra.util.PassiveHandler;
import com.projectkorra.projectkorra.util.TempBlock;
import com.projectkorra.projectkorra.waterbending.PlantArmor;
@ -169,6 +170,7 @@ public class EarthArmor extends EarthAbility {
}
if (formed) {
PassiveHandler.checkArmorPassives(player);
if (System.currentTimeMillis() > startTime + duration && !complete) {
complete = true;
bPlayer.addCooldown(this);

View file

@ -0,0 +1,37 @@
package com.projectkorra.projectkorra.event;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class PlayerJumpEvent extends Event{
private static final HandlerList HANDLERS = new HandlerList();
private Player player;
private double height;
public PlayerJumpEvent(Player player, double height) {
this.player = player;
this.height = height;
}
public Player getPlayer() {
return player;
}
public double getHeight() {
return height;
}
@Override
public HandlerList getHandlers() {
// TODO Auto-generated method stub
return HANDLERS;
}
public static HandlerList getHandlerList() {
return HANDLERS;
}
}

View file

@ -1,6 +1,8 @@
package com.projectkorra.projectkorra.firebending;
import com.projectkorra.projectkorra.ability.FireAbility;
import com.projectkorra.projectkorra.airbending.AirSpout;
import com.projectkorra.projectkorra.earthbending.SandSpout;
import com.projectkorra.projectkorra.util.Flight;
import com.projectkorra.projectkorra.util.ParticleEffect;
@ -32,6 +34,14 @@ public class FireJet extends FireAbility {
return;
}
if (hasAbility(player, AirSpout.class)) {
AirSpout abil = getAbility(player, AirSpout.class);
abil.remove();
} else if (hasAbility(player, SandSpout.class)) {
SandSpout abil = getAbility(player, SandSpout.class);
abil.remove();
}
this.avatarStateToggled = getConfig().getBoolean("Abilities.Fire.FireJet.IsAvatarStateToggle");
this.duration = getConfig().getLong("Abilities.Fire.FireJet.Duration");
this.speed = getConfig().getDouble("Abilities.Fire.FireJet.Speed");

View file

@ -29,7 +29,7 @@ public class BlockSource {
* @author kingbirdy
*/
public static enum BlockSourceType {
WATER, ICE, PLANT, EARTH, METAL, LAVA
WATER, ICE, PLANT, EARTH, METAL, LAVA, SNOW
}
private static HashMap<Player, HashMap<BlockSourceType, HashMap<ClickType, BlockSourceInformation>>> playerSources = new HashMap<Player, HashMap<BlockSourceType, HashMap<ClickType, BlockSourceInformation>>>();
@ -65,6 +65,9 @@ public class BlockSource {
if (WaterAbility.isIce(waterBlock)) {
putSource(player, waterBlock, BlockSourceType.ICE, clickType);
}
if (WaterAbility.isSnow(waterBlock)) {
putSource(player, waterBlock, BlockSourceType.SNOW, clickType);
}
}
} else if (coreAbil instanceof EarthAbility) {
Block earthBlock = EarthAbility.getEarthSourceBlock(player, null, MAX_RANGE);
@ -210,7 +213,7 @@ public class BlockSource {
* @return a valid Water bendable block, or null if none was found.
*/
public static Block getWaterSourceBlock(Player player, double range, ClickType clickType, boolean allowWater, boolean allowIce, boolean allowPlant) {
return getWaterSourceBlock(player, range, clickType, allowWater, allowIce, allowPlant, true);
return getWaterSourceBlock(player, range, clickType, allowWater, allowIce, allowPlant, true, true);
}
/**
@ -228,7 +231,7 @@ public class BlockSource {
* that may have been created by a WaterBottle.
* @return a valid Water bendable block, or null if none was found.
*/
public static Block getWaterSourceBlock(Player player, double range, ClickType clickType, boolean allowWater, boolean allowIce, boolean allowPlant, boolean allowWaterBottles) {
public static Block getWaterSourceBlock(Player player, double range, ClickType clickType, boolean allowWater, boolean allowIce, boolean allowPlant, boolean allowSnow, boolean allowWaterBottles) {
Block sourceBlock = null;
if (allowWaterBottles) {
// Check the block in front of the player's eyes, it may have been created by a
@ -247,6 +250,9 @@ public class BlockSource {
if (allowPlant && sourceBlock == null) {
sourceBlock = getSourceBlock(player, range, BlockSourceType.PLANT, clickType);
}
if (allowSnow && sourceBlock == null) {
sourceBlock = getSourceBlock(player, range, BlockSourceType.SNOW, clickType);
}
if(sourceBlock != null && TempBlock.isTempBlock(sourceBlock) && !tempblock) {
return null;
}

View file

@ -12,7 +12,6 @@ import com.projectkorra.projectkorra.earthbending.EarthArmor;
import com.projectkorra.projectkorra.earthbending.EarthPassive;
import com.projectkorra.projectkorra.waterbending.PlantArmor;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
@ -21,7 +20,7 @@ import org.bukkit.potion.PotionEffectType;
import java.util.concurrent.ConcurrentHashMap;
public class PassiveHandler implements Runnable{
public class PassiveHandler {
private static final ConcurrentHashMap<Player, Float> FOOD = new ConcurrentHashMap<>();
@ -41,139 +40,120 @@ public class PassiveHandler implements Runnable{
}
}
public static void handleArmorPassives() {
for (Player player : Bukkit.getOnlinePlayers()) {
if (ConfigManager.defaultConfig.get().getStringList("Properties.DisabledWorlds").contains(player.getWorld().getName())) {
continue;
}
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
if (bPlayer == null) continue;
if (CoreAbility.hasAbility(player, EarthArmor.class)) {
EarthArmor abil = CoreAbility.getAbility(player, EarthArmor.class);
public static void checkArmorPassives(Player player) {
if (ConfigManager.defaultConfig.get().getStringList("Properties.DisabledWorlds").contains(player.getWorld().getName())) {
return;
}
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
if (bPlayer == null) return;
if (CoreAbility.hasAbility(player, EarthArmor.class)) {
EarthArmor abil = CoreAbility.getAbility(player, EarthArmor.class);
if (abil.isFormed()) {
int strength = abil.getStrength();
player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 3, strength - 1), false);
}
if (CoreAbility.hasAbility(player, PlantArmor.class)) {
PlantArmor abil = CoreAbility.getAbility(player, PlantArmor.class);
}
if (CoreAbility.hasAbility(player, PlantArmor.class)) {
PlantArmor abil = CoreAbility.getAbility(player, PlantArmor.class);
if (abil.isFormed()) {
int strength = abil.getResistance();
player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, 3, strength - 1), false);
}
}
}
public static void handleExhaustionPassives() {
public static void checkExhaustionPassives(Player player) {
double air = AirPassive.getExhaustionFactor();
double chi = ChiPassive.getExhaustionFactor();
for (Player player : Bukkit.getOnlinePlayers()) {
if (ConfigManager.defaultConfig.get().getStringList("Properties.DisabledWorlds").contains(player.getWorld().getName())) {
continue;
}
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));
}
if (ConfigManager.defaultConfig.get().getStringList("Properties.DisabledWorlds").contains(player.getWorld().getName())) {
return;
}
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
if (bPlayer == null) return;
if (!bPlayer.hasElement(Element.AIR)) air = 0;
if (!bPlayer.hasElement(Element.CHI)) chi = 0;
double max = Math.max(air, chi);
if (max == 0) return;
else {
player.setExhaustion(getExhaustion(player, player.getExhaustion(), max));
}
}
public static void handleSpeedPassives() {
public static void checkSpeedPassives(Player player) {
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())) {
continue;
}
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));
}
if (ConfigManager.defaultConfig.get().getStringList("Properties.DisabledWorlds").contains(player.getWorld().getName())) {
return;
}
}
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())) {
continue;
boolean sandbender = true;
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
if (bPlayer == null) return;
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);
}
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;
} 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.JUMP, 3, max-1), false);
}
}
if (max == 0) return;
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 3, max-1));
}
@Override
public void run() {
handleArmorPassives();
handleExhaustionPassives();
handleSpeedPassives();
handleJumpPassives();
public static void checkJumpPassives(Player player) {
int air = AirPassive.getJumpPower();
int chi = ChiPassive.getJumpPower();
if (ConfigManager.defaultConfig.get().getStringList("Properties.DisabledWorlds").contains(player.getWorld().getName())) {
return;
}
BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player);
if (bPlayer == null) return;
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) return;
player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 3, max-1), false);
}
}

View file

@ -39,23 +39,19 @@ public class HealingWaters extends HealingAbility {
private static void heal(Player player) {
if (inWater(player)) {
if (player.isSneaking()) {
Entity entity = GeneralMethods.getTargetedEntity(player, getRadius());
if (entity == null) {
giveHP(player);
} else {
giveHPToEntity((LivingEntity) entity);
}
} else {
if (getShiftRequired()) {
return;
} else {
if ((getShiftRequired() == true && player.isSneaking()) || getShiftRequired() == false) {
Entity target = GeneralMethods.getTargetedEntity(player, getRadius());
if (target == null || !(target instanceof LivingEntity)) {
giveHP(player);
} else {
giveHPToEntity((LivingEntity) target);
}
} else if (getShiftRequired() == true && !player.isSneaking()) {
return;
}
}
}
private static void giveHPToEntity(LivingEntity le) {
if (!le.isDead() && le.getHealth() < le.getMaxHealth()) {
applyHealingToEntity(le);

View file

@ -3,6 +3,7 @@ package com.projectkorra.projectkorra.waterbending;
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.PlantAbility;
import com.projectkorra.projectkorra.earthbending.EarthArmor;
import com.projectkorra.projectkorra.util.PassiveHandler;
import org.bukkit.Color;
import org.bukkit.Location;
@ -127,6 +128,7 @@ public class PlantArmor extends PlantAbility {
}
if (formed) {
PassiveHandler.checkArmorPassives(player);
if (System.currentTimeMillis() > startTime + duration) {
remove();
bPlayer.addCooldown(this);

View file

@ -34,6 +34,7 @@ public class SurgeWave extends WaterAbility {
private double currentRadius;
private double maxRadius;
private double range;
private double selectRange;
private double pushFactor;
private double verticalFactor;
private double maxFreezeRadius;
@ -65,6 +66,7 @@ public class SurgeWave extends WaterAbility {
this.verticalFactor = getConfig().getDouble("Abilities.Water.Surge.Wave.VerticalPush");
this.maxFreezeRadius = getConfig().getDouble("Abilities.Water.Surge.Wave.MaxFreezeRadius");
this.range = getConfig().getDouble("Abilities.Water.Surge.Wave.Range");
this.selectRange = getConfig().getDouble("Abilities.Water.Surge.Wave.SelectRange");
this.waveBlocks = new ConcurrentHashMap<>();
this.frozenBlocks = new ConcurrentHashMap<>();
@ -215,7 +217,7 @@ public class SurgeWave extends WaterAbility {
public boolean prepare() {
cancelPrevious();
Block block = BlockSource.getWaterSourceBlock(player, range, ClickType.SHIFT_DOWN, true, true, bPlayer.canPlantbend());
Block block = BlockSource.getWaterSourceBlock(player, selectRange, ClickType.SHIFT_DOWN, true, true, bPlayer.canPlantbend());
if (block != null && !GeneralMethods.isRegionProtectedFromBuild(this, block.getLocation())) {
sourceBlock = block;
focusBlock();

View file

@ -148,8 +148,11 @@ public class WaterManipulation extends WaterAbility {
if (isPlant(sourceBlock)) {
new PlantRegrowth(player, sourceBlock);
} else if (!isIce(sourceBlock)) {
addWater(sourceBlock);
} else {
sourceBlock.setType(Material.AIR);
}
addWater(sourceBlock);
}
}
bPlayer.addCooldown(this);