diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkEndermanTeleport.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkEndermanTeleport.java index c8a116dee..625791668 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkEndermanTeleport.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/perks/enderman/PerkEndermanTeleport.java @@ -27,10 +27,10 @@ import nautilus.game.arcade.game.games.smash.perks.SmashPerk; public class PerkEndermanTeleport extends SmashPerk { - + private int _cooldown = 5000; private float _chargeTick = 0.015F; - + private Map _target = new HashMap<>(); private Map _charge = new HashMap<>(); @@ -53,16 +53,16 @@ public class PerkEndermanTeleport extends SmashPerk { return; } - + for (Player player : UtilServer.getPlayers()) { if (!hasPerk(player) || UtilPlayer.isSpectator(player)) { continue; } - + UUID key = player.getUniqueId(); - + if (!player.isSneaking() || !Recharge.Instance.usable(player, GetName())) { _target.remove(key); @@ -78,7 +78,7 @@ public class PerkEndermanTeleport extends SmashPerk { continue; } - + _target.put(key, block); _charge.put(key, 0f); } @@ -89,7 +89,7 @@ public class PerkEndermanTeleport extends SmashPerk _target.remove(key); _charge.remove(key); } - + // Same Block - Increase Charge else if (block.equals(_target.get(key))) { @@ -128,11 +128,18 @@ public class PerkEndermanTeleport extends SmashPerk } } + @Override + public void unregisteredEvents() + { + _target.clear(); + _charge.clear(); + } + @EventHandler public void clean(PlayerQuitEvent event) { UUID key = event.getPlayer().getUniqueId(); - + _target.remove(key); _charge.remove(key); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDoubleJump.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDoubleJump.java index 40118fc73..6db946c88 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDoubleJump.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkDoubleJump.java @@ -18,6 +18,7 @@ import mineplex.core.common.util.UtilTime.TimeUnit; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; + import nautilus.game.arcade.kit.Perk; public class PerkDoubleJump extends Perk @@ -27,7 +28,7 @@ public class PerkDoubleJump extends Perk private boolean _control; private long _recharge; private boolean _displayForce; - + private HashSet _disabled = new HashSet(); public PerkDoubleJump(String name) @@ -35,39 +36,39 @@ public class PerkDoubleJump extends Perk this(name, 0, 0, false); } - public PerkDoubleJump(String name, double power, double heightLimit, boolean control) + public PerkDoubleJump(String name, double power, double heightLimit, boolean control) { - super(name, new String[] + super(name, new String[] { C.cYellow + "Tap Jump Twice" + C.cGray + " to " + C.cGreen + name, }); - + _power = power; _heightMax = heightLimit; _control = control; _recharge = 0; _displayForce = false; } - - public PerkDoubleJump(String name, double power, double heightLimit, boolean control, long recharge, boolean displayForce) + + public PerkDoubleJump(String name, double power, double heightLimit, boolean control, long recharge, boolean displayForce) { - super(name, new String[] + super(name, new String[] { C.cYellow + "Tap Jump Twice" + C.cGray + " to " + C.cGreen + name, "Cooldown " + C.cGreen + UtilTime.convertString(recharge, 0, TimeUnit.SECONDS) + C.cGray + "." }); - + _power = power; _heightMax = heightLimit; _control = control; _recharge = recharge; _displayForce = displayForce; } - - public PerkDoubleJump(String name, String[] description, double power, double heightLimit, boolean control, long recharge, boolean displayForce) + + public PerkDoubleJump(String name, String[] description, double power, double heightLimit, boolean control, long recharge, boolean displayForce) { super(name, description); - + _power = power; _heightMax = heightLimit; _control = control; @@ -87,22 +88,22 @@ public class PerkDoubleJump extends Perk public void FlightHop(PlayerToggleFlightEvent event) { Player player = event.getPlayer(); - + if (!hasPerk(player)) return; - + if (Manager.isSpectator(player)) return; - + if (player.getGameMode() == GameMode.CREATIVE) return; - + event.setCancelled(true); player.setFlying(false); - + //Disable Flight player.setAllowFlight(false); - + //Velocity if (_control) { @@ -112,24 +113,30 @@ public class PerkDoubleJump extends Perk { UtilAction.velocity(player, player.getLocation().getDirection(), _power, true, _power, 0, _heightMax, true); } - + //Sound player.playEffect(player.getLocation(), Effect.BLAZE_SHOOT, 0); - + //Recharge if (_recharge > 0) { Recharge.Instance.useForce(player, GetName(), _recharge); - + if (_displayForce) { Recharge.Instance.setDisplayForce(player, GetName(), true); } } - + //Recharge.Instance.useForce(player, "Double Jump", 500); - } - + } + + @Override + public void unregisteredEvents() + { + _disabled.clear(); + } + @EventHandler public void FlightUpdate(UpdateEvent event) { @@ -140,16 +147,16 @@ public class PerkDoubleJump extends Perk { if (Manager.isSpectator(player)) continue; - + if (!hasPerk(player)) continue; - + if (_recharge > 0 && !Recharge.Instance.usable(player, GetName())) continue; // if (!Recharge.Instance.usable(player, "Double Jump")) // continue; - + if (player.isOnGround() || (UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN)) && UtilBlock.solid(player.getLocation().getBlock()))) player.setAllowFlight(true); }