From eb1c3263ecd7ca251f5eac7d14a3963bbda2fbb5 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Thu, 15 Feb 2018 18:59:40 +1100 Subject: [PATCH] Fix deny-exit flag --- .../src/main/java/com/plotsquared/listener/PlotListener.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Core/src/main/java/com/plotsquared/listener/PlotListener.java b/Core/src/main/java/com/plotsquared/listener/PlotListener.java index 4ea404537..3a3930664 100644 --- a/Core/src/main/java/com/plotsquared/listener/PlotListener.java +++ b/Core/src/main/java/com/plotsquared/listener/PlotListener.java @@ -179,7 +179,7 @@ public class PlotListener { } public static boolean plotExit(final PlotPlayer player, Plot plot) { - player.deleteMeta("lastplot"); + Object previous = player.deleteMeta("lastplot"); EventUtil.manager.callLeave(player, plot); if (plot.hasOwner()) { PlotArea pw = plot.getArea(); @@ -187,6 +187,9 @@ public class PlotListener { return true; } if (Flags.DENY_EXIT.isTrue(plot)) { + if (previous != null) { + player.setMeta("lastplot", previous); + } return false; } if (plot.getFlag(Flags.GAMEMODE).isPresent() || plot.getFlag(Flags.GUEST_GAMEMODE).isPresent()) {