From f1f6b2781e903483ac551478d29be9ff53152b08 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Mon, 6 Jun 2016 06:34:05 +1000 Subject: [PATCH] Fix INSTABREAK flag --- .../bukkit/listeners/PlotPlusListener.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlotPlusListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlotPlusListener.java index a6bfe059d..d447431e4 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlotPlusListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlotPlusListener.java @@ -8,13 +8,19 @@ import com.plotsquared.bukkit.events.PlayerEnterPlotEvent; import com.plotsquared.bukkit.events.PlayerLeavePlotEvent; import com.plotsquared.bukkit.util.BukkitUtil; import com.plotsquared.listener.PlotListener; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map.Entry; +import java.util.UUID; import org.bukkit.Bukkit; import org.bukkit.GameMode; +import org.bukkit.block.Block; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; +import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockDamageEvent; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.player.PlayerDropItemEvent; @@ -22,11 +28,6 @@ import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.plugin.java.JavaPlugin; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map.Entry; -import java.util.UUID; - public class PlotPlusListener extends PlotListener implements Listener { private static final HashMap feedRunnable = new HashMap<>(); @@ -89,7 +90,12 @@ public class PlotPlusListener extends PlotListener implements Listener { return; } if (Flags.INSTABREAK.isTrue(plot)) { - event.getBlock().breakNaturally(); + Block block = event.getBlock(); + BlockBreakEvent call = new BlockBreakEvent(block, player); + Bukkit.getServer().getPluginManager().callEvent(call); + if (!call.isCancelled()) { + event.getBlock().breakNaturally(); + } } }