From 9f792fa54b70a534176f6ea7008cbb96559d69b3 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Wed, 24 Apr 2019 21:23:57 -0400 Subject: [PATCH] Fixes #2328 I hope this doesn't cause more issues than it solves --- .../plotsquared/bukkit/BukkitMain.java | 4 ++-- .../bukkit/listeners/EntitySpawnListener.java | 6 +++--- .../bukkit/listeners/PlayerEvents.java | 17 +++++++---------- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/BukkitMain.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/BukkitMain.java index 12dd070fc..8aaea98fe 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/BukkitMain.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/BukkitMain.java @@ -420,7 +420,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain case SHULKER: if (Settings.Enabled_Components.KILL_ROAD_MOBS) { LivingEntity livingEntity = (LivingEntity) entity; - List meta = entity.getMetadata("plot"); + List meta = entity.getMetadata("shulkerPlot"); if (!meta.isEmpty()) { if (livingEntity.isLeashed()) { continue; @@ -457,7 +457,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain if (area != null) { PlotId currentPlotId = PlotId.of(area.getPlotAbs(pLoc)); if (currentPlotId != null) { - entity.setMetadata("plot", new FixedMetadataValue( + entity.setMetadata("shulkerPlot", new FixedMetadataValue( (Plugin) PlotSquared.get().IMP, currentPlotId)); } } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntitySpawnListener.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntitySpawnListener.java index f15663fdb..27a24ba9d 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntitySpawnListener.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/EntitySpawnListener.java @@ -62,7 +62,7 @@ public class EntitySpawnListener implements Listener { public static void test(Entity entity) { @NotNull World world = entity.getWorld(); List meta = entity.getMetadata(KEY); - if (meta == null || meta.isEmpty()) { + if (meta.isEmpty()) { if (PlotSquared.get().hasPlotArea(world.getName())) { entity.setMetadata(KEY, new FixedMetadataValue((Plugin) PlotSquared.get().IMP, entity.getLocation())); @@ -126,8 +126,8 @@ public class EntitySpawnListener implements Listener { event.setCancelled(true); } case SHULKER: - if (!entity.hasMetadata("plot")) { - entity.setMetadata("plot", + if (!entity.hasMetadata("shulkerPlot")) { + entity.setMetadata("shulkerPlot", new FixedMetadataValue((Plugin) PlotSquared.get().IMP, plot.getId())); } } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java index c611e80f4..346983255 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java @@ -10,10 +10,13 @@ import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.flag.Flags; import com.github.intellectualsites.plotsquared.plot.listener.PlayerBlockEventType; import com.github.intellectualsites.plotsquared.plot.listener.PlotListener; -import com.github.intellectualsites.plotsquared.plot.object.Location; import com.github.intellectualsites.plotsquared.plot.object.*; import com.github.intellectualsites.plotsquared.plot.util.*; -import org.bukkit.*; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.FluidCollisionMode; +import org.bukkit.Material; +import org.bukkit.World; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.block.BlockState; @@ -1048,17 +1051,11 @@ import java.util.regex.Pattern; public void onBigBoom(EntityExplodeEvent event) { Location location = BukkitUtil.getLocation(event.getLocation()); PlotArea area = location.getPlotArea(); - if (area == null) { + boolean plotArea = location.isPlotArea(); + if (!plotArea) { if (!PlotSquared.get().hasPlotArea(location.getWorld())) { return; } - Iterator iterator = event.blockList().iterator(); - while (iterator.hasNext()) { - iterator.next(); - if (location.isPlotArea()) { - iterator.remove(); - } - } return; } Plot plot = area.getOwnedPlot(location);