From 9f9527d2e22ac1f22cadeb084d4c1ca9455cf7f9 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Thu, 17 May 2018 14:53:34 +1000 Subject: [PATCH] Fixes #1784 --- .../plotsquared/bukkit/listeners/PlayerEvents.java | 12 +++++++----- .../com/intellectualcrafters/plot/flag/Flags.java | 1 + 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java index a6d5497ef..86d7b2484 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java @@ -927,13 +927,15 @@ public class PlayerEvents extends PlotListener implements Listener { @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void onPeskyMobsChangeTheWorldLikeWTFEvent(EntityChangeBlockEvent event) { - String world = event.getBlock().getWorld().getName(); - if (!PS.get().hasPlotArea(world)) { - return; - } Entity e = event.getEntity(); if (!(e instanceof FallingBlock)) { - event.setCancelled(true); + Location location = BukkitUtil.getLocation(event.getBlock().getLocation()); + PlotArea area = location.getPlotArea(); + if (area != null) { + Plot plot = area.getOwnedPlot(location); + if (plot != null && Flags.MOB_BREAK.isTrue(plot)) return; + event.setCancelled(true); + } } } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/flag/Flags.java b/Core/src/main/java/com/intellectualcrafters/plot/flag/Flags.java index 02bbd151e..5e46db04c 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/flag/Flags.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/flag/Flags.java @@ -80,6 +80,7 @@ public final class Flags { public static final BooleanFlag HOSTILE_ATTACK = new BooleanFlag("hostile-attack"); public static final BooleanFlag HOSTILE_INTERACT = new BooleanFlag("hostile-interact"); public static final BooleanFlag MOB_PLACE = new BooleanFlag("mob-place"); + public static final BooleanFlag MOB_BREAK = new BooleanFlag("mob-break"); public static final BooleanFlag FORCEFIELD = new BooleanFlag("forcefield"); public static final BooleanFlag INVINCIBLE = new BooleanFlag("invincible"); public static final BooleanFlag ITEM_DROP = new BooleanFlag("item-drop");