diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 5589e6907..963aeac22 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -10,15 +10,7 @@
-
-
-
-
-
-
-
-
@@ -42,28 +34,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -74,38 +44,27 @@
-
-
+
+
-
-
+
+
-
-
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
+
@@ -114,8 +73,8 @@
-
-
+
+
@@ -199,11 +158,31 @@
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -228,7 +207,6 @@
-
@@ -267,12 +245,13 @@
-
+
+
@@ -847,7 +826,7 @@
-
+
1411382351159
@@ -1025,11 +1004,19 @@
1413634257996
1413634257996
-
+
+ 1413706779041
+ 1413706779041
+
+
+ 1413706970695
+ 1413706970695
+
+
-
+
@@ -1127,8 +1114,6 @@
-
-
@@ -1152,7 +1137,9 @@
-
+
+
+
@@ -1223,13 +1210,6 @@
-
-
-
-
-
-
-
@@ -1475,14 +1455,6 @@
-
-
-
-
-
-
-
-
@@ -1510,26 +1482,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1538,22 +1490,10 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -1640,12 +1580,50 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/PlotSquared/src/com/intellectualcrafters/plot/listeners/PlayerEvents.java b/PlotSquared/src/com/intellectualcrafters/plot/listeners/PlayerEvents.java
index 74e05f060..61ccc64da 100644
--- a/PlotSquared/src/com/intellectualcrafters/plot/listeners/PlayerEvents.java
+++ b/PlotSquared/src/com/intellectualcrafters/plot/listeners/PlayerEvents.java
@@ -9,6 +9,7 @@
package com.intellectualcrafters.plot.listeners;
import com.intellectualcrafters.plot.*;
+import com.intellectualcrafters.plot.commands.Setup;
import com.intellectualcrafters.plot.events.PlayerEnterPlotEvent;
import com.intellectualcrafters.plot.events.PlayerLeavePlotEvent;
import org.bukkit.*;
@@ -157,19 +158,13 @@ public class PlayerEvents implements Listener {
} else if (adventure.contains(str)) {
return GameMode.ADVENTURE;
} else {
- return GameMode.SURVIVAL;
+ return Bukkit.getDefaultGameMode();
}
}
- private HashMap previousGamemode = new HashMap<>();
-
public void plotEntry(Player player, Plot plot) {
if (plot.hasOwner()) {
if(plot.settings.getFlag("gamemode") != null) {
- if(previousGamemode.containsKey(player.getName())) {
- previousGamemode.remove(player.getName());
- }
- previousGamemode.put(player.getName(), player.getGameMode());
player.setGameMode(getGameMode(plot.settings.getFlag("gamemode").getValue()));
}
if(plot.settings.getFlag("time") != null) {
@@ -206,10 +201,7 @@ public class PlayerEvents implements Listener {
PlayerLeavePlotEvent callEvent = new PlayerLeavePlotEvent(player, plot);
Bukkit.getPluginManager().callEvent(callEvent);
}
- if(previousGamemode.containsKey(player.getName())) {
- player.setGameMode(previousGamemode.get(player.getName()));
- previousGamemode.remove(player.getName());
- }
+ player.setGameMode(Bukkit.getDefaultGameMode());
player.resetPlayerTime();
player.resetPlayerWeather();
PlayerFunctions.sendMessage(player, plot.settings.getLeaveMessage());
@@ -711,6 +703,16 @@ public class PlayerEvents implements Listener {
}
}
+ @EventHandler
+ public void onLeave(PlayerQuitEvent event) {
+ if(PlotSelection.currentSelection.containsKey(event.getPlayer().getName())) {
+ PlotSelection.currentSelection.remove(event.getPlayer().getName());
+ }
+ if(Setup.setupMap.containsKey(event.getPlayer().getName())) {
+ Setup.setupMap.remove(event.getPlayer().getName());
+ }
+ }
+
@EventHandler(
priority = EventPriority.HIGH, ignoreCancelled = true)
public void onBucketFill(PlayerBucketFillEvent e) {