diff --git a/Plugins/Mineplex.Core/src/mineplex/core/game/kit/GameKit.java b/Plugins/Mineplex.Core/src/mineplex/core/game/kit/GameKit.java index 309803839..5d1239882 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/game/kit/GameKit.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/game/kit/GameKit.java @@ -185,7 +185,7 @@ public enum GameKit "Guess he burnt the bacon", C.blankLine, click(false, "Axe to launch " + C.cGreen + "Crispy Bacon"), - "Players on fire take " + C.cGreen + "+30%" + C.cGray + "knockback." + "Players on fire take " + C.cGreen + "+30%" + C.cGray + " knockback." }, new KitEntityData<> ( diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/player/HubPlayerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/player/HubPlayerManager.java index 4025f150c..334372d60 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/player/HubPlayerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/player/HubPlayerManager.java @@ -24,7 +24,7 @@ public class HubPlayerManager extends MiniPlugin private static final ItemStack GAME_MENU = new ItemBuilder(Material.COMPASS) .setTitle(C.cGreen + "Quick Compass") - .addLore("Click to open the Quick Compas.") + .addLore("Click to open the Quick Compass.") .build(); private static final ItemStack LOBBY_MENU = new ItemBuilder(Material.WATCH) .setTitle(C.cGreen + "Lobby Selector") diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/DeathTag.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/DeathTag.java index 72038611c..9c14ad344 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/DeathTag.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/DeathTag.java @@ -104,7 +104,7 @@ public class DeathTag extends SoloGame { if (Math.random() < 0.5) { - MapUtil.QuickChangeBlockAt(location, Material.WOOL, (byte) 15); + MapUtil.QuickChangeBlockAt(location, Material.GOLD_BLOCK); } }); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java index dd8876e3b..3534d2033 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/BombLobbers.java @@ -153,20 +153,12 @@ public class BombLobbers extends TeamGame implements IThrown public void addKill(Player player) { - _kills.put(player, _kills.containsKey(player) ? _kills.get(player) + 1 : 1); + _kills.put(player, _kills.getOrDefault(player, 0D) + 1); } public double getKills(Player player) { - if (_kills.containsKey(player)) - { - return _kills.get(player); - } - else - { - _kills.put(player, 0.0); - return 0; - } + return _kills.getOrDefault(player, 0D); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitArmorer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitArmorer.java index 34e1098d7..c4d5b777f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitArmorer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitArmorer.java @@ -1,17 +1,17 @@ package nautilus.game.arcade.game.games.lobbers.kits; -import java.util.Collections; - import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilServer; import mineplex.core.game.kit.GameKit; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.events.PlayerKitApplyEvent; import nautilus.game.arcade.game.games.lobbers.kits.perks.PerkCraftman; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Perk; @@ -24,16 +24,19 @@ public class KitArmorer extends Kit private static final Perk[] PERKS = { new PerkDoubleJump("Double Jump", 0.9, 0.9, false), - new PerkDummy("Armorer", Collections.singletonList(C.cGray + "Receive " + C.cYellow + "Full Gold Armor").toArray(new String[1])), + new PerkDummy("Armorer", new String[] + { + C.cGray + "Receive " + C.cYellow + "Full Iron Armor" + }), new PerkCraftman(), }; private static final ItemStack[] PLAYER_ARMOR = { - ItemStackFactory.Instance.CreateStack(Material.GOLD_BOOTS), - ItemStackFactory.Instance.CreateStack(Material.GOLD_LEGGINGS), - ItemStackFactory.Instance.CreateStack(Material.GOLD_CHESTPLATE), - ItemStackFactory.Instance.CreateStack(Material.GOLD_HELMET), + ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS), + ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS), + ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE), + ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET), }; public KitArmorer(ArcadeManager manager) @@ -44,6 +47,14 @@ public class KitArmorer extends Kit @Override public void ApplyKit(Player player) { + PlayerKitApplyEvent applyEvent = new PlayerKitApplyEvent(Manager.GetGame(), this, player); + UtilServer.CallEvent(applyEvent); + + if (applyEvent.isCancelled()) + { + return; + } + UtilInv.Clear(player); for (Perk perk : GetPerks()) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitPitcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitPitcher.java index 823047dd1..f4b297e0e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitPitcher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/lobbers/kits/KitPitcher.java @@ -11,11 +11,13 @@ import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilServer; import mineplex.core.game.kit.GameKit; import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.events.PlayerKitApplyEvent; import nautilus.game.arcade.game.games.lobbers.events.TNTThrowEvent; import nautilus.game.arcade.game.games.lobbers.kits.perks.PerkCraftman; import nautilus.game.arcade.kit.Kit; @@ -52,6 +54,14 @@ public class KitPitcher extends Kit @Override public void ApplyKit(Player player) { + PlayerKitApplyEvent applyEvent = new PlayerKitApplyEvent(Manager.GetGame(), this, player); + UtilServer.CallEvent(applyEvent); + + if (applyEvent.isCancelled()) + { + return; + } + UtilInv.Clear(player); for (Perk perk : GetPerks()) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java index f4c376995..879234f98 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java @@ -840,9 +840,9 @@ public class TurfForts extends TeamGame Location nearest = UtilAlg.findClosest(location, averages.keySet()); - if (!averages.get(nearest).equals(team)) + if (!averages.get(nearest).equals(team) && Recharge.Instance.use(player, "Spawn Damage", 2000, false, false)) { - knockback(player, team); + Manager.GetDamage().NewDamageEvent(player, null, null, DamageCause.CUSTOM, _fight ? 2 : 500, false, true, true, GetName(), "Spawn"); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanArcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanArcher.java index dec7ca3a8..9271cad01 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanArcher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanArcher.java @@ -21,7 +21,7 @@ public class KitHumanArcher extends Kit private static final Perk[] PERKS = { - new PerkDoubleJump("Double Jump", 1.2, 1, true, 4000, true), + new PerkDoubleJump("Double Jump", 1.2, 1, true, 6000, true), new PerkWitherArrowBlind(6), new PerkFletcher(4, 4, true), }; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLeap.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLeap.java index 30343b972..d164a5474 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLeap.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkLeap.java @@ -1,37 +1,41 @@ package nautilus.game.arcade.kit.perks; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilItem; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.core.recharge.Recharge; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.event.PerkLeapEvent; +import java.util.HashMap; +import java.util.Map; + import org.bukkit.Effect; import org.bukkit.entity.Entity; import org.bukkit.entity.Horse; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.inventory.ItemStack; -import java.util.HashMap; -import java.util.Map; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilItem; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.recharge.Recharge; + +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.event.PerkLeapEvent; public class PerkLeap extends Perk { - private String _name; - private double _power; - private double _heightMax; - private long _recharge; - private int _maxUses; + + private final String _name; + private final double _power, _heightMax; + private final long _recharge; + private final int _maxUses; - private Map _uses = new HashMap<>(); + private final Map _uses = new HashMap<>(); public PerkLeap(String name, double power, double heightLimit, long recharge) { @@ -61,36 +65,28 @@ public class PerkLeap extends Perk _maxUses = uses; } - @EventHandler + @EventHandler(ignoreCancelled = true) public void Leap(PlayerInteractEvent event) { - if (event.isCancelled()) + if (!UtilEvent.isAction(event, ActionType.R) || UtilBlock.usable(event.getClickedBlock())) + { return; - - if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK) - return; - - if (UtilBlock.usable(event.getClickedBlock())) - return; - - if (event.getPlayer().getItemInHand() == null) - return; - - if (!UtilItem.isAxe(event.getPlayer().getItemInHand())) - return; - + } + Player player = event.getPlayer(); - - if (!hasPerk(player)) + ItemStack itemStack = player.getItemInHand(); + + if (itemStack == null || !UtilItem.isAxe(itemStack) || !hasPerk(player)) + { return; + } //Check Uses if (_maxUses > 0) { - if (!_uses.containsKey(player.getName())) - _uses.put(player.getName(), _maxUses); + int count = _uses.computeIfAbsent(player.getName(), k -> _maxUses); - if (_uses.get(player.getName()) <= 0) + if (count <= 0) { UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(_name) + " anymore.")); return; @@ -99,8 +95,10 @@ public class PerkLeap extends Perk //Energy if (!Recharge.Instance.use(player, _name, _recharge, false, true)) + { return; - + } + //Use Use if (_maxUses > 0) { @@ -108,7 +106,8 @@ public class PerkLeap extends Perk count--; player.setExp(Math.min(0.99f, (float)count/(float)_maxUses)); - + player.getItemInHand().setAmount(count); + _uses.put(player.getName(), count); } @@ -142,6 +141,27 @@ public class PerkLeap extends Perk _uses.remove(event.getEntity().getName()); } + @Override + public void registeredEvents() + { + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (!hasPerk(player)) + { + continue; + } + + for (ItemStack itemStack : player.getInventory().getContents()) + { + if (UtilItem.isAxe(itemStack)) + { + itemStack.setAmount(_maxUses); + break; + } + } + } + } + @Override public void unregisteredEvents() {