From 574ca7a180eac3774a3de29aaa76b13859870818 Mon Sep 17 00:00:00 2001 From: boy0001 Date: Thu, 3 Sep 2015 15:48:36 +1000 Subject: [PATCH] Call plot leave on quit --- .../com/plotsquared/bukkit/listeners/PlayerEvents.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java b/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java index f43e43852..afd24475f 100644 --- a/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java +++ b/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java @@ -1617,11 +1617,15 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen @EventHandler(priority= EventPriority.MONITOR) public void onLeave(final PlayerQuitEvent event) { PlotPlayer pp = BukkitUtil.getPlayer(event.getPlayer()); + Plot plot = pp.getCurrentPlot(); + if (plot != null) { + plotExit(pp, plot); + } ExpireManager.dates.put(pp.getUUID(), System.currentTimeMillis()); EventUtil.unregisterPlayer(pp); if (Settings.DELETE_PLOTS_ON_BAN && event.getPlayer().isBanned()) { - for (final Plot plot : PS.get().getPlotsInWorld(pp.getName())) { - plot.deletePlot(null); + for (final Plot owned : PS.get().getPlotsInWorld(pp.getName())) { + owned.deletePlot(null); PS.debug(String.format("&cPlot &6%s &cwas deleted + cleared due to &6%s&c getting banned", plot.getId(), event.getPlayer().getName())); } }