diff --git a/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java b/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java index 94775d2f2..ae99b81d2 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java @@ -126,6 +126,7 @@ public class DebugExec extends SubCommand { scope.put("Settings", new Settings()); scope.put("StringMan", new StringMan()); scope.put("MathMan", new MathMan()); + scope.put("FlagManager", new FlagManager()); // Classes scope.put("Location", Location.class); diff --git a/src/main/java/com/intellectualcrafters/plot/util/EventUtil.java b/src/main/java/com/intellectualcrafters/plot/util/EventUtil.java index 11984fc32..4521db6ea 100644 --- a/src/main/java/com/intellectualcrafters/plot/util/EventUtil.java +++ b/src/main/java/com/intellectualcrafters/plot/util/EventUtil.java @@ -87,14 +87,13 @@ public abstract class EventUtil { if (!plot.hasOwner()) { return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms); } - Flag use = FlagManager.getPlotFlag(plot, "break"); + Flag use = FlagManager.getPlotFlag(plot, "use"); if (use != null) { HashSet value = (HashSet) use.getValue(); if (value.contains(PlotBlock.EVERYTHING) || value.contains(block.getPlotBlock())) { return true; } } - Flag destroy = FlagManager.getPlotFlag(plot, "break"); if (destroy != null) { HashSet value = (HashSet) destroy.getValue(); diff --git a/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java b/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java index 6205eb9b3..7bfa2cf5b 100644 --- a/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java +++ b/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java @@ -492,7 +492,6 @@ public class MainUtil { public static boolean teleportPlayer(final PlotPlayer player, final Location from, final Plot plot) { final Plot bot = MainUtil.getBottomPlot(plot); - boolean result = EventUtil.manager.callTeleport(player, from, plot); if (result) { diff --git a/src/main/java/com/intellectualcrafters/plot/util/StringMan.java b/src/main/java/com/intellectualcrafters/plot/util/StringMan.java index 0bf0127f2..d84434b0f 100644 --- a/src/main/java/com/intellectualcrafters/plot/util/StringMan.java +++ b/src/main/java/com/intellectualcrafters/plot/util/StringMan.java @@ -242,11 +242,11 @@ public class StringMan { } public static boolean isEqual(String a, String b) { - return (a == b || (a.length() == b.length() && a.hashCode() == b.hashCode() && a.equals(b))); + return (a == b || (a != null && b != null && a.length() == b.length() && a.hashCode() == b.hashCode() && a.equals(b))); } public static boolean isEqualIgnoreCase(String a, String b) { - return (a == b || (a.length() == b.length() && a.equalsIgnoreCase(b))); + return (a == b || (a != null && b != null && a.length() == b.length() && a.equalsIgnoreCase(b))); } public static String repeat(String s, int n) { diff --git a/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java b/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java index afd24475f..b16cbd793 100644 --- a/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java +++ b/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java @@ -1096,6 +1096,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen case BEACON: case BED_BLOCK: case SIGN: + case WALL_SIGN: case SIGN_POST: case ENCHANTMENT_TABLE: case BREWING_STAND: @@ -1125,7 +1126,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen if (eventType != null && !player.isSneaking()) { break; } - if (hand == null) { + if (hand == null || hand.getType() == Material.AIR || hand.getType().isBlock()) { eventType = PlayerBlockEventType.INTERACT_BLOCK; lb = new BukkitLazyBlock(block); break; diff --git a/src/main/java/com/plotsquared/bukkit/object/BukkitPlayer.java b/src/main/java/com/plotsquared/bukkit/object/BukkitPlayer.java index bde96af75..8a9bba232 100644 --- a/src/main/java/com/plotsquared/bukkit/object/BukkitPlayer.java +++ b/src/main/java/com/plotsquared/bukkit/object/BukkitPlayer.java @@ -8,6 +8,7 @@ import org.bukkit.Effect; import org.bukkit.GameMode; import org.bukkit.WeatherType; import org.bukkit.entity.Player; +import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; import org.bukkit.permissions.Permission; import org.bukkit.permissions.PermissionDefault; import org.bukkit.plugin.PluginManager; @@ -130,7 +131,7 @@ public class BukkitPlayer extends PlotPlayer { if (Math.abs(loc.getX()) >= 30000000 || Math.abs(loc.getZ()) >= 30000000) { return; } - this.player.teleport(new org.bukkit.Location(BukkitUtil.getWorld(loc.getWorld()), loc.getX() + 0.5, loc.getY(), loc.getZ() + 0.5, loc.getYaw(), loc.getPitch())); + this.player.teleport(new org.bukkit.Location(BukkitUtil.getWorld(loc.getWorld()), loc.getX() + 0.5, loc.getY(), loc.getZ() + 0.5, loc.getYaw(), loc.getPitch()), TeleportCause.COMMAND); } @Override diff --git a/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java b/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java index 9621a8c09..16101966c 100644 --- a/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java +++ b/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java @@ -31,11 +31,11 @@ import com.intellectualcrafters.plot.object.schematic.PlotItem; import com.intellectualcrafters.plot.util.BlockManager; import com.intellectualcrafters.plot.util.MathMan; import com.intellectualcrafters.plot.util.StringComparison; +import com.intellectualcrafters.plot.util.StringMan; import com.intellectualcrafters.plot.util.UUIDHandler; import com.plotsquared.bukkit.object.BukkitPlayer; public class BukkitUtil extends BlockManager { - private static HashMap worlds = new HashMap<>(); private static String lastString = null; private static World lastWorld = null; @@ -145,14 +145,12 @@ public class BukkitUtil extends BlockManager { } public static World getWorld(final String string) { - if (string == lastString) { + if (StringMan.isEqual(string,lastString)) { return lastWorld; } - World world = worlds.get(string); - if (world == null) { - world = Bukkit.getWorld(string); - worlds.put(string, world); - } + World world = Bukkit.getWorld(string); + lastString = string; + lastWorld = world; return world; } diff --git a/target/PlotSquared-Bukkit.jar b/target/PlotSquared-Bukkit.jar index 0372182ad..d9a41481e 100644 Binary files a/target/PlotSquared-Bukkit.jar and b/target/PlotSquared-Bukkit.jar differ diff --git a/target/PlotSquared-Sponge.jar b/target/PlotSquared-Sponge.jar index c90bef59e..2ba5f269f 100644 Binary files a/target/PlotSquared-Sponge.jar and b/target/PlotSquared-Sponge.jar differ