diff --git a/PlotSquared/pom.xml b/PlotSquared/pom.xml index abc5838b2..5f9158e68 100644 --- a/PlotSquared/pom.xml +++ b/PlotSquared/pom.xml @@ -8,7 +8,7 @@ UTF-8 PlotSquared - 2.11.8 + 2.11.9 PlotSquared jar diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSquared.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSquared.java index dfdea3af4..222f89457 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSquared.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSquared.java @@ -291,7 +291,9 @@ public class PlotSquared { } public static boolean removePlot(final String world, final PlotId id, final boolean callEvent) { - EventUtil.manager.callDelete(world, id); + if (callEvent) { + EventUtil.manager.callDelete(world, id); + } plots.get(world).remove(id); if (MainUtil.lastPlot.containsKey(world)) { final PlotId last = MainUtil.lastPlot.get(world); 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 eb89d8e94..bd8fa2821 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java @@ -257,9 +257,10 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi } } - @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) + @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) public void onJoin(final PlayerJoinEvent event) { final Player player = event.getPlayer(); + BukkitUtil.removePlayer(player.getName()); if (!player.hasPlayedBefore()) { player.saveData(); } @@ -326,7 +327,12 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi if (plot.isDenied(pp.getUUID())) { if (!Permissions.hasPermission(pp, "plots.admin.entry.denied")) { MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.entry.denied"); - player.teleport(event.getFrom()); + if (!plot.equals(MainUtil.getPlot(BukkitUtil.getLocation(event.getFrom())))) { + player.teleport(event.getFrom()); + } + else { + player.teleport(player.getWorld().getSpawnLocation()); + } event.setCancelled(true); return; } @@ -367,7 +373,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi final Set recipients = event.getRecipients(); recipients.clear(); for (final Player p : Bukkit.getOnlinePlayers()) { - if (MainUtil.getPlot(BukkitUtil.getLocation(p)) == plot) { + if (MainUtil.getPlot(BukkitUtil.getLocation(p)).equals(plot)) { recipients.add(p); } } @@ -984,6 +990,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi if (plot != null) { final PlotPlayer pp = BukkitUtil.getPlayer(player); if (plot.isDenied(pp.getUUID())) { + System.out.print(2); if (Permissions.hasPermission(pp, "plots.admin.enter.denied")) { return; } @@ -1059,7 +1066,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi } } - @EventHandler + @EventHandler(priority= EventPriority.MONITOR) public void onLeave(final PlayerQuitEvent event) { PlotPlayer pp = BukkitUtil.getPlayer(event.getPlayer()); EventUtil.unregisterPlayer(pp); @@ -1076,6 +1083,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi PlotSquared.log(String.format("&cPlot &6%s &cwas deleted + cleared due to &6%s&c getting banned", plot.getId(), event.getPlayer().getName())); } } + BukkitUtil.removePlayer(pp.getName()); } @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotListener.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotListener.java index df0532340..71746bd2a 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotListener.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotListener.java @@ -123,7 +123,7 @@ public class PlotListener extends APlotListener { final String sTitleMain = C.TITLE_ENTERED_PLOT.s().replaceAll("%x%", plot.id.x + "").replaceAll("%z%", plot.id.y + "").replaceAll("%world%", plot.world + "").replaceAll("%greeting%", greeting); final String sTitleSub = C.TITLE_ENTERED_PLOT_SUB.s().replaceFirst("%s", getName(plot.owner)).replaceAll("%greeting%", greeting); if (AbstractTitle.TITLE_CLASS != null) { - AbstractTitle.TITLE_CLASS.sendTitle(pp, sTitleMain, sTitleSub, ChatColor.valueOf(C.TITLE_ENTERED_PLOT_COLOR.s()), ChatColor.valueOf(C.TITLE_ENTERED_PLOT_SUB_COLOR.s())); + AbstractTitle.TITLE_CLASS.sendTitle(pp, sTitleMain, sTitleSub, ChatColor.valueOf(C.TITLE_ENTERED_PLOT_COLOR.s()), ChatColor.valueOf(C.TITLE_ENTERED_PLOT_SUB_COLOR.s()), 1, 2, 1); } } { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/comment/CommentManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/comment/CommentManager.java index f5c0156f3..5f4d64681 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/comment/CommentManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/comment/CommentManager.java @@ -50,7 +50,7 @@ public class CommentManager { total = count.get(); } if (size.decrementAndGet() == 0 && total > 0) { - AbstractTitle.TITLE_CLASS.sendTitle(player, "", C.INBOX_NOTIFICATION.s().replaceAll("%s", "" + total), ChatColor.GOLD, ChatColor.valueOf(C.TITLE_ENTERED_PLOT_SUB_COLOR.s())); + AbstractTitle.TITLE_CLASS.sendTitle(player, "", C.INBOX_NOTIFICATION.s().replaceAll("%s", "" + total), ChatColor.GOLD, ChatColor.valueOf(C.TITLE_ENTERED_PLOT_SUB_COLOR.s()), 1, 2, 1); } } }); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/titles/AbstractTitle.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/titles/AbstractTitle.java index 2238c0a1e..66569a20b 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/titles/AbstractTitle.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/titles/AbstractTitle.java @@ -7,5 +7,5 @@ import com.intellectualcrafters.plot.object.PlotPlayer; public abstract class AbstractTitle { public static AbstractTitle TITLE_CLASS; - public abstract void sendTitle(PlotPlayer player, String head, String sub, ChatColor head_color, ChatColor sub_color); + public abstract void sendTitle(PlotPlayer player, String head, String sub, ChatColor head_color, ChatColor sub_color, int in, int delay, int out); } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/titles/DefaultTitle.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/titles/DefaultTitle.java index aab07feac..7a277f7f3 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/titles/DefaultTitle.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/titles/DefaultTitle.java @@ -7,15 +7,15 @@ import com.intellectualcrafters.plot.object.PlotPlayer; public class DefaultTitle extends AbstractTitle { @Override - public void sendTitle(final PlotPlayer player, final String head, final String sub, final ChatColor head_color, final ChatColor sub_color) { + public void sendTitle(final PlotPlayer player, final String head, final String sub, final ChatColor head_color, final ChatColor sub_color, int in, int delay, int out) { try { - final DefaultTitleManager title = new DefaultTitleManager(head, sub, 1, 2, 1); + final DefaultTitleManager title = new DefaultTitleManager(head, sub, in, delay, out); title.setTitleColor(head_color); title.setSubtitleColor(sub_color); title.send(((BukkitPlayer) player).player); } catch (final Throwable e) { AbstractTitle.TITLE_CLASS = new DefaultTitle_183(); - AbstractTitle.TITLE_CLASS.sendTitle(player, head, sub, head_color, sub_color); + AbstractTitle.TITLE_CLASS.sendTitle(player, head, sub, head_color, sub_color, in, delay, out); } } } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/titles/DefaultTitle_183.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/titles/DefaultTitle_183.java index 8198efcce..d8c9ea49b 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/titles/DefaultTitle_183.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/titles/DefaultTitle_183.java @@ -7,15 +7,15 @@ import com.intellectualcrafters.plot.object.PlotPlayer; public class DefaultTitle_183 extends AbstractTitle { @Override - public void sendTitle(final PlotPlayer player, final String head, final String sub, final ChatColor head_color, final ChatColor sub_color) { + public void sendTitle(final PlotPlayer player, final String head, final String sub, final ChatColor head_color, final ChatColor sub_color, int in, int delay, int out) { try { - final DefaultTitleManager_183 title = new DefaultTitleManager_183(head, sub, 1, 2, 1); + final DefaultTitleManager_183 title = new DefaultTitleManager_183(head, sub, in, delay, out); title.setTitleColor(head_color); title.setSubtitleColor(sub_color); title.send(((BukkitPlayer) player).player); } catch (final Throwable e) { AbstractTitle.TITLE_CLASS = new HackTitle(); - AbstractTitle.TITLE_CLASS.sendTitle(player, head, sub, head_color, sub_color); + AbstractTitle.TITLE_CLASS.sendTitle(player, head, sub, head_color, sub_color, in, delay, out); } } } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/titles/HackTitle.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/titles/HackTitle.java index 1f7f55071..79bb5e744 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/titles/HackTitle.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/titles/HackTitle.java @@ -9,9 +9,9 @@ import com.intellectualcrafters.plot.object.PlotPlayer; public class HackTitle extends AbstractTitle { @Override - public void sendTitle(final PlotPlayer player, final String head, final String sub, final ChatColor head_color, final ChatColor sub_color) { + public void sendTitle(final PlotPlayer player, final String head, final String sub, final ChatColor head_color, final ChatColor sub_color, int in, int delay, int out) { try { - final HackTitleManager title = new HackTitleManager(head, sub, 1, 2, 1); + final HackTitleManager title = new HackTitleManager(head, sub, in, delay, out); title.setTitleColor(head_color); title.setSubtitleColor(sub_color); title.send(((BukkitPlayer) player).player); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java index 5930f6c68..dac77a27b 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java @@ -92,8 +92,6 @@ public class ExpireManager { expiredPlots.get(world).remove(plot); return; } - final PlotDeleteEvent event = new PlotDeleteEvent(world, plot.id); - Bukkit.getServer().getPluginManager().callEvent(event); for (final UUID helper : plot.trusted) { final PlotPlayer player = UUIDHandler.getPlayer(helper); if (player != null) { @@ -119,7 +117,7 @@ public class ExpireManager { manager.clearPlot(plotworld, plot, false, null); MainUtil.removeSign(plot); DBFunc.delete(world, plot); - PlotSquared.removePlot(world, plot.id, true); + PlotSquared.removePlot(world, plot.id, false); expiredPlots.get(world).remove(plot); PlotSquared.log("&cDeleted expired plot: " + plot.id); PlotSquared.log("&3 - World: " + plot.world); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitUtil.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitUtil.java index 1f44a1567..681d80387 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitUtil.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitUtil.java @@ -34,10 +34,8 @@ public class BukkitUtil extends BlockManager { private static PlotPlayer lastPlotPlayer = null; public static void removePlayer(final String plr) { - if ((lastPlayer != null) && lastPlayer.getName().equals(plr)) { - lastPlayer = null; - lastPlotPlayer = null; - } + lastPlayer = null; + lastPlotPlayer = null; UUIDHandler.players.remove(plr); }