Evolution of Combat minor changes to the "first weapon crafted" title functionality.
This commit is contained in:
parent
33baf90d51
commit
89953396b2
@ -1,7 +1,6 @@
|
|||||||
package nautilus.game.arcade.game.games.mineware.challenges;
|
package nautilus.game.arcade.game.games.mineware.challenges;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
|
||||||
|
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.UtilMath;
|
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.block.BlockPlaceEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
import org.bukkit.event.inventory.CraftItemEvent;
|
import org.bukkit.event.inventory.CraftItemEvent;
|
||||||
import org.bukkit.inventory.InventoryHolder;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class ChallengeEvolutionOfCombat extends Challenge
|
public class ChallengeEvolutionOfCombat extends Challenge
|
||||||
{
|
{
|
||||||
private HashSet<InventoryHolder> _craftedWeapon = new HashSet<InventoryHolder>();
|
private boolean _firstWeaponCrafted = false;
|
||||||
|
|
||||||
public ChallengeEvolutionOfCombat(MineWare host)
|
public ChallengeEvolutionOfCombat(MineWare host)
|
||||||
{
|
{
|
||||||
super(host, ChallengeType.LastStanding, "Evolution of Combat", "Find supplies and craft a weapon quicky.", "Then rush on your enemies!",
|
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
|
@EventHandler
|
||||||
public void onCraftItem(CraftItemEvent event)
|
public void onCraftItem(CraftItemEvent event)
|
||||||
{
|
{
|
||||||
if(!Host.IsLive() || !Host.isChallengeStarted())
|
if(_firstWeaponCrafted || !Host.IsLive() || !Host.isChallengeStarted())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ItemStack result = event.getRecipe().getResult();
|
ItemStack result = event.getRecipe().getResult();
|
||||||
InventoryHolder holder = event.getInventory().getHolder();
|
|
||||||
String name = result.getType().toString().toLowerCase();
|
String name = result.getType().toString().toLowerCase();
|
||||||
|
|
||||||
if (_craftedWeapon.contains(holder))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(name.contains("sword") || name.contains("axe"))
|
if(name.contains("sword") || name.contains("axe"))
|
||||||
{
|
{
|
||||||
Player player = (Player) event.getInventory().getHolder();
|
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())
|
for(Player others : UtilServer.getPlayers())
|
||||||
{
|
{
|
||||||
others.playSound(others.getLocation(), Sound.HORSE_ARMOR, 1.0F, 1.0F);
|
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.InventoryOpenBlock = false;
|
||||||
Host.InventoryClick = false;
|
Host.InventoryClick = false;
|
||||||
Host.DamagePvP = false;
|
Host.DamagePvP = false;
|
||||||
|
|
||||||
_craftedWeapon.clear();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user