From fab06a00637722588a994e0350d62e2dc5048f7c Mon Sep 17 00:00:00 2001 From: boy0001 Date: Fri, 20 Feb 2015 21:30:49 +1100 Subject: [PATCH] main --- .../intellectualcrafters/plot/BukkitMain.java | 4 ++-- .../plot/listeners/PlayerEvents.java | 17 ++++++++++------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/BukkitMain.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/BukkitMain.java index 4c690bbf6..fe78f82e7 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/BukkitMain.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/BukkitMain.java @@ -93,7 +93,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain { // TODO restructure this public static boolean teleportPlayer(final Player player, final Location from, final Plot plot) { - final Plot bot = PlayerFunctions.getBottomPlot(player.getWorld().getName(), plot); + final Plot bot = PlotHelper.getBottomPlot(player.getWorld().getName(), plot); final PlayerTeleportToPlotEvent event = new PlayerTeleportToPlotEvent(player, from, bot); Bukkit.getServer().getPluginManager().callEvent(event); if (!event.isCancelled()) { @@ -247,7 +247,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain { final Entity[] entities = chunk.getEntities(); Entity entity; for (int i = entities.length - 1; i >= 0; i--) { - if (!((entity = entities[i]) instanceof Player) && !.isInPlot(entity.getLocation())) { + if (!((entity = entities[i]) instanceof Player) && (PlotHelper.getPlot(BukkitUtil.getLocation(entity)) == null)) { entity.remove(); } } 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 28c77f999..3f4520a43 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java @@ -562,7 +562,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi return; } Location loc = BukkitUtil.getLocation(event.getLocation()); - final String world = loc.getWorld().getName(); + final String world = loc.getWorld(); if (!isPlotWorld(world)) { return; } @@ -621,12 +621,15 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi e.setCancelled(true); return; } - } else if (!plot.isAdded(p)) { - if (!BukkitMain.hasPermission(p, "plots.admin.build.other")) { - if (isPlotArea(loc)) { - PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.other"); - e.setCancelled(true); - return; + } else { + UUID uuid = UUIDHandler.getUUID(p); + if (!plot.isAdded(uuid)) + if (!BukkitMain.hasPermission(p, "plots.admin.build.other")) { + if (isPlotArea(loc)) { + PlayerFunctions.sendMessage(p, C.NO_PERMISSION, "plots.admin.build.other"); + e.setCancelled(true); + return; + } } } }