mirror of
https://github.com/taoneill/war.git
synced 2025-02-22 22:31:20 +01:00
Closes gh-367. Using flint and steel on enemy spawn doesn't give you a fire block anymore. :)
This commit is contained in:
parent
a4a3ced0e5
commit
a9c09c3f16
@ -159,8 +159,17 @@ public class WarBlockListener implements Listener {
|
||||
private void cancelAndKeepItem(BlockPlaceEvent event) {
|
||||
event.setCancelled(true);
|
||||
ItemStack inHand = event.getItemInHand();
|
||||
ItemStack newItemInHand = new ItemStack(inHand.getType(), inHand.getAmount(), inHand.getDurability(), inHand.getData().getData());
|
||||
newItemInHand.setDurability(inHand.getDurability());
|
||||
ItemStack newItemInHand = null;
|
||||
|
||||
if (inHand.getType() == Material.FIRE) {
|
||||
// Weird bukkit/mc behavior where item in hand is reported as fire while using flint & steel.
|
||||
// Just give the user his f&s back but almost broken (max durability is 8).
|
||||
newItemInHand = new ItemStack(Material.FLINT_AND_STEEL, 1, (short)1);
|
||||
} else {
|
||||
newItemInHand = new ItemStack(inHand.getType(), inHand.getAmount(), inHand.getDurability(), inHand.getData().getData());
|
||||
newItemInHand.setDurability(inHand.getDurability());
|
||||
}
|
||||
|
||||
event.getPlayer().setItemInHand(newItemInHand);
|
||||
}
|
||||
|
||||
|
@ -253,16 +253,15 @@ public class WarPlayerListener implements Listener {
|
||||
if (zone != null && zone.getLoadoutSelections().containsKey(player.getName())
|
||||
&& zone.getLoadoutSelections().get(player.getName()).isStillInSpawn()) {
|
||||
event.setUseItemInHand(Result.DENY);
|
||||
War.war.badMsg(player, "Can't use items while still in spawn.");
|
||||
|
||||
ItemStack inHand = event.getItem();
|
||||
|
||||
if (inHand != null) {
|
||||
ItemStack newItemInHand = new ItemStack(inHand.getType(), inHand.getAmount(), inHand.getDurability(), inHand.getData().getData());
|
||||
newItemInHand.setDurability(inHand.getDurability());
|
||||
event.getPlayer().setItemInHand(newItemInHand);
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
War.war.badMsg(player, "Can't use items while still in spawn.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user