From c1d4c481fb1136441c6e3d9fdbe3c70163532ad1 Mon Sep 17 00:00:00 2001 From: MattBDev Date: Sun, 17 Jul 2016 23:20:31 -0400 Subject: [PATCH] Fix #1244 --- .../bukkit/listeners/EntitySpawnListener.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/EntitySpawnListener.java b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/EntitySpawnListener.java index 5c871eaf5..3c1ea45e1 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/EntitySpawnListener.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/listeners/EntitySpawnListener.java @@ -1,5 +1,7 @@ package com.plotsquared.bukkit.listeners; +import com.intellectualcrafters.plot.config.Settings; +import com.intellectualcrafters.plot.flag.Flags; import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotArea; @@ -14,14 +16,14 @@ public class EntitySpawnListener implements Listener { @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) public void creatureSpawnEvent(EntitySpawnEvent event) { Entity entity = event.getEntity(); + Location location = BukkitUtil.getLocation(entity.getLocation()); + PlotArea area = location.getPlotArea(); + if (area == null) { + return; + } + Plot plot = area.getOwnedPlotAbs(location); switch (entity.getType()) { case ENDER_CRYSTAL: - Location location = BukkitUtil.getLocation(entity.getLocation()); - PlotArea area = location.getPlotArea(); - if (area == null) { - return; - } - Plot plot = area.getOwnedPlotAbs(location); if (plot == null) { if (!area.MOB_SPAWNING) { event.setCancelled(true); @@ -32,5 +34,8 @@ public class EntitySpawnListener implements Listener { event.setCancelled(true); } } + if (Settings.Done.RESTRICT_BUILDING && plot.hasFlag(Flags.DONE)) { + event.setCancelled(true); + } } }