Creeper explosions with a player target cause should no longer be ignored.

Also fixed primed tnt being checked twice for tnt flags. TNT Minecarts are not included, as was prior behavior.
Fixes WORLDGUARD-3344
This commit is contained in:
wizjany 2015-01-24 23:00:19 -05:00
parent 869ead63bc
commit 0f4e7b5061
3 changed files with 14 additions and 3 deletions

View File

@ -129,6 +129,17 @@ public Entity getFirstEntity() {
return null;
}
@Nullable
public Entity getFirstNonPlayerEntity() {
for (Object object : causes) {
if (object instanceof Entity && !(object instanceof Player)) {
return (Entity) object;
}
}
return null;
}
@Nullable
public Block getFirstBlock() {
for (Object object : causes) {

View File

@ -87,7 +87,7 @@ public void onBreakBlock(final BreakBlockEvent event) {
}
Entity entity;
if ((entity = event.getCause().getFirstEntity()) != null) {
if ((entity = event.getCause().getFirstNonPlayerEntity()) != null) {
// ================================================================
// CREEPER_EXPLOSION flag
// ================================================================

View File

@ -215,9 +215,9 @@ public boolean apply(Location target) {
String what;
/* TNT */
if (event.getCause().find(EntityType.PRIMED_TNT, EntityType.PRIMED_TNT) != null) {
if (event.getCause().find(EntityType.PRIMED_TNT, EntityType.MINECART_TNT) != null) {
canBreak = query.testBuild(target, associable, combine(event, DefaultFlag.BLOCK_BREAK, DefaultFlag.TNT));
what = "dynamite blocks";
what = "use dynamite";
/* Everything else */
} else {