diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java index e56e10fe2..a55d45ced 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java @@ -416,7 +416,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi final Set recipients = event.getRecipients(); recipients.clear(); for (final Player p : Bukkit.getOnlinePlayers()) { - if (plot.equals(MainUtil.getPlot(BukkitUtil.getLocation(p)))) { + if (p.hasPermission("plots.admin.command.chat") || plot.equals(MainUtil.getPlot(BukkitUtil.getLocation(p)))) { recipients.add(p); } } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java index a4709ffb1..c94b5d2e6 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java @@ -272,7 +272,7 @@ public class MainUtil { z = bot.getZ() + plotworld.DEFAULT_HOME.z; } final int y = Math.max(getHeighestBlock(plot.world, x, z), manager.getSignLoc(PlotSquared.getPlotWorld(plot.world), plot).getY()); - return new Location(plot.world, x, y, z); + return new Location(plot.world, x, y + 1, z); } final Location top = getPlotTopLoc(plot.world, plot.id); final Location bot = getPlotBottomLoc(plot.world, plot.id); @@ -280,7 +280,7 @@ public class MainUtil { final int z = bot.getZ(); PlotManager manager = PlotSquared.getPlotManager(plot.world); final int y = Math.max(getHeighestBlock(plot.world, x, z), manager.getSignLoc(PlotSquared.getPlotWorld(plot.world), plot).getY()); - return new Location(plot.world, x, y, z); + return new Location(plot.world, x, y + 1, z); } public static boolean teleportPlayer(final PlotPlayer player, final Location from, final Plot plot) { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitChunkManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitChunkManager.java index cdc7fd918..82da9abd7 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitChunkManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitChunkManager.java @@ -96,14 +96,14 @@ public class BukkitChunkManager extends ChunkManager { @Override public void regenerateChunk(String world, ChunkLoc loc) { - World bukkitWorld = Bukkit.getWorld(world); - bukkitWorld.regenerateChunk(loc.x, loc.z); - Chunk chunk = bukkitWorld.getChunkAt(loc.x, loc.z); - for (final Entity entity : chunk.getEntities()) { - if (entity instanceof Player) { - final Plot plot = MainUtil.getPlot(BukkitUtil.getLocation(entity.getLocation())); + World worldObj = Bukkit.getWorld(world); + worldObj.regenerateChunk(loc.x, loc.z); + for (final Player player : worldObj.getPlayers()) { + org.bukkit.Location locObj = player.getLocation(); + if (locObj.getBlockX() >> 4 == loc.x && locObj.getBlockZ() >> 4 == loc.z && !locObj.getBlock().isEmpty()) { + final Plot plot = MainUtil.getPlot(BukkitUtil.getLocation(locObj)); if (plot != null) { - final PlotPlayer pp = BukkitUtil.getPlayer((Player) entity); + final PlotPlayer pp = BukkitUtil.getPlayer(player); pp.teleport(MainUtil.getDefaultHome(plot)); } }