From 89953396b276e53ba0400261622548dae6eae10d Mon Sep 17 00:00:00 2001 From: Thanos paravantis Date: Tue, 20 Oct 2015 17:59:56 +0300 Subject: [PATCH] Evolution of Combat minor changes to the "first weapon crafted" title functionality. --- .../ChallengeEvolutionOfCombat.java | 20 ++++++------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeEvolutionOfCombat.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeEvolutionOfCombat.java index 2bc6fe8d4..7bd85a7c6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeEvolutionOfCombat.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/challenges/ChallengeEvolutionOfCombat.java @@ -1,7 +1,6 @@ package nautilus.game.arcade.game.games.mineware.challenges; import java.util.ArrayList; -import java.util.HashSet; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilMath; @@ -21,13 +20,12 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.inventory.CraftItemEvent; -import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.ItemStack; public class ChallengeEvolutionOfCombat extends Challenge { - private HashSet _craftedWeapon = new HashSet(); - + private boolean _firstWeaponCrafted = false; + public ChallengeEvolutionOfCombat(MineWare host) { super(host, ChallengeType.LastStanding, "Evolution of Combat", "Find supplies and craft a weapon quicky.", "Then rush on your enemies!", @@ -186,27 +184,23 @@ public class ChallengeEvolutionOfCombat extends Challenge @EventHandler public void onCraftItem(CraftItemEvent event) { - if(!Host.IsLive() || !Host.isChallengeStarted()) + if(_firstWeaponCrafted || !Host.IsLive() || !Host.isChallengeStarted()) return; ItemStack result = event.getRecipe().getResult(); - InventoryHolder holder = event.getInventory().getHolder(); String name = result.getType().toString().toLowerCase(); - - if (_craftedWeapon.contains(holder)) - return; if(name.contains("sword") || name.contains("axe")) { Player player = (Player) event.getInventory().getHolder(); - UtilTextMiddle.display("", C.cGold + player.getName() + " has crafted a weapon!", 5, 30, 5, UtilServer.getPlayers()); + UtilTextMiddle.display("", C.cGold + player.getName() + " has crafted the first weapon!", 5, 30, 5, UtilServer.getPlayers()); for(Player others : UtilServer.getPlayers()) { others.playSound(others.getLocation(), Sound.HORSE_ARMOR, 1.0F, 1.0F); } - - _craftedWeapon.add(holder); + + _firstWeaponCrafted = true; } } @@ -241,7 +235,5 @@ public class ChallengeEvolutionOfCombat extends Challenge Host.InventoryOpenBlock = false; Host.InventoryClick = false; Host.DamagePvP = false; - - _craftedWeapon.clear(); } }