Disallow placing throwing tnt

This commit is contained in:
samczsun 2016-06-30 19:44:36 -04:00 committed by cnr
parent c442376ccc
commit f6d882fcb4

View File

@ -127,6 +127,15 @@ public class PerkBomber extends Perk
UtilPlayer.message(event.getPlayer(), F.main(GetName(), "You cannot drop " + F.item("Throwing TNT") + "."));
}
@EventHandler (ignoreCancelled = true)
public void on(BlockPlaceEvent event)
{
if (!isThrowingTnt(event.getItemInHand()))
return;
event.setCancelled(true);
UtilPlayer.message(event.getPlayer(), F.main(GetName(), "You cannot place " + F.item("Throwing TNT") + "."));
}
@EventHandler
public void TNTDeathRemove(PlayerDeathEvent event)
{
@ -139,6 +148,7 @@ public class PerkBomber extends Perk
int oldAmount = _tntCount.get(event.getEntity()).get();
if (oldAmount < remove.size())
{
// fixme If you die with someone else's tnt, then this will occur
System.out.println("Strange.... expected " + oldAmount + " of tnt for " + event.getEntity().getName() + " but removed " + remove.size() + " instead");
_tntCount.get(event.getEntity()).set(0);
}