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 9d8673f0a..66ba7b39d 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java @@ -806,8 +806,23 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen if (area == null) { return; } - if (area.getOwnedPlot(loc) == null) { + Plot plot = area.getOwnedPlot(loc); + if (plot == null) { e.setCancelled(true); + return; + } + switch (b.getType()) { + case WATER: + case STATIONARY_WATER: + if (FlagManager.isPlotFlagFalse(plot, "ice-melt")) { + e.setCancelled(true); + } + break; + case SNOW: + if (FlagManager.isPlotFlagFalse(plot, "snow-melt")) { + e.setCancelled(true); + } + break; } } 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 8a87bb6a8..36201ade8 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlotPlusListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlotPlusListener.java @@ -28,28 +28,24 @@ 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.Material; -import org.bukkit.block.BlockState; 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.BlockDamageEvent; -import org.bukkit.event.block.BlockFadeEvent; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.player.PlayerDropItemEvent; 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<>(); @@ -101,25 +97,6 @@ public class PlotPlusListener extends PlotListener implements Listener { }, 0L, 20L); } - @EventHandler(priority = EventPriority.HIGH) - public void onMelt(BlockFadeEvent event) { - BlockState state = event.getNewState(); - - if (state.getType() != Material.WATER && state.getType() != Material.STATIONARY_WATER) { - return; - } - Plot plot = BukkitUtil.getLocation(state.getLocation()).getOwnedPlot(); - if (plot == null) { - return; - } - if (!FlagManager.isBooleanFlag(plot, "ice-melt", false)) { - event.setCancelled(true); - } - if (FlagManager.isPlotFlagFalse(plot, "snow-melt")) { - event.setCancelled(true); - } - } - @EventHandler(priority = EventPriority.HIGH) public void onInteract(BlockDamageEvent event) { Player player = event.getPlayer();