Made TNT blocking work.

This commit is contained in:
sk89q 2011-01-19 23:38:16 -08:00
parent c3f0bbb41c
commit 430f2f57e9

View File

@ -48,7 +48,7 @@ public void onEntityDamageByBlock(EntityDamageByBlockEvent event) {
Entity defender = event.getEntity();
DamageCause type = event.getCause();
if (defender instanceof Player) {
if (defender instanceof Player) {
Player player = (Player)defender;
if (plugin.invinciblePlayers.contains(player.getName())) {
@ -133,6 +133,20 @@ public void onEntityExplode(EntityExplodeEvent event) {
return;
}
}
} else { // Shall assume that this is TNT
if (plugin.blockTNT) {
event.setCancelled(true);
return;
}
if (plugin.useRegions) {
Vector pt = toVector(event.getEntity().getLocation());
if (!plugin.regionManager.getApplicableRegions(pt).allowsTNT()) {
event.setCancelled(true);
return;
}
}
}
}
}