Skip to content
Permalink
Browse files

Ender crystal explosions can't be cause tracked.

  • Loading branch information...
wizjany committed Jul 27, 2019
1 parent aa41378 commit 4044e2b122338761b3fc4fe1b9834197a1578ad7
@@ -70,7 +70,9 @@
import org.bukkit.entity.EntityType;
import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.Item;
import org.bukkit.entity.ItemFrame;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Painting;
import org.bukkit.entity.Player;
import org.bukkit.entity.ThrownPotion;
import org.bukkit.event.Cancellable;
@@ -651,6 +653,15 @@ public void onHangingBreak(HangingBreakEvent event) {
if (event.isCancelled() && remover instanceof Player) {
playDenyEffect((Player) remover, event.getEntity().getLocation());
}
} else if (event.getCause() == HangingBreakEvent.RemoveCause.EXPLOSION){
DestroyEntityEvent destroyEntityEvent = new DestroyEntityEvent(event, Cause.unknown(), event.getEntity());
destroyEntityEvent.getRelevantFlags().add(Flags.OTHER_EXPLOSION);
if (event.getEntity() instanceof ItemFrame) {
destroyEntityEvent.getRelevantFlags().add(Flags.ENTITY_ITEM_FRAME_DESTROY);
} else if (event.getEntity() instanceof Painting) {
destroyEntityEvent.getRelevantFlags().add(Flags.ENTITY_PAINTING_DESTROY);
}
Events.fireToCancel(event, destroyEntityEvent);
}
}

0 comments on commit 4044e2b

Please sign in to comment.
You can’t perform that action at this time.