diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index f190150f3..09b50a577 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -10,7 +10,8 @@
-
+
+
@@ -37,10 +38,10 @@
-
-
+
+
-
+
@@ -66,10 +67,10 @@
-
+
-
+
@@ -116,11 +117,11 @@
-
+
-
-
+
+
@@ -217,9 +218,9 @@
-
-
+
+
@@ -764,7 +765,7 @@
-
+
1411382351159
@@ -930,11 +931,15 @@
1413622665156
1413622665156
-
+
+ 1413627152131
+ 1413627152131
+
+
-
+
@@ -971,7 +976,7 @@
-
+
@@ -1447,24 +1452,28 @@
-
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
+
@@ -1479,19 +1488,15 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java b/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java
index b49db0260..c6cce82e8 100644
--- a/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java
+++ b/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java
@@ -1250,6 +1250,12 @@ public class PlotMain extends JavaPlugin {
for(String str : materialFlags.values()) {
FlagManager.addFlag(new AbstractFlag(str));
}
+ List otherFlags = Arrays.asList(
+ "gamemode"
+ );
+ for(String str : otherFlags) {
+ FlagManager.addFlag(new AbstractFlag(str));
+ }
}
public static void addPlotWorld(String world, PlotWorld plotworld, PlotManager manager) {
diff --git a/PlotSquared/src/com/intellectualcrafters/plot/listeners/PlayerEvents.java b/PlotSquared/src/com/intellectualcrafters/plot/listeners/PlayerEvents.java
index e0358284c..41f482a0f 100644
--- a/PlotSquared/src/com/intellectualcrafters/plot/listeners/PlayerEvents.java
+++ b/PlotSquared/src/com/intellectualcrafters/plot/listeners/PlayerEvents.java
@@ -135,8 +135,27 @@ public class PlayerEvents implements Listener {
}
}
+ private GameMode getGameMode(String str) {
+ str = str.toLowerCase();
+ List creative = Arrays.asList("creative" , "cr", "1");
+ List survival = Arrays.asList("survival" , "su", "0");
+ List adventure = Arrays.asList("adventure", "ad", "2");
+ if (creative.equals(str)) {
+ return GameMode.CREATIVE;
+ } else if (survival.equals(str)) {
+ return GameMode.SURVIVAL;
+ } else if (adventure.equals(str)) {
+ return GameMode.ADVENTURE;
+ } else {
+ return GameMode.SURVIVAL;
+ }
+ }
+
public void plotEntry(Player player, Plot plot) {
if (plot.hasOwner()) {
+ if(plot.settings.getFlag("gamemode") != null) {
+ player.setGameMode(getGameMode(plot.settings.getFlag("gamemode").getValue()));
+ }
if (C.TITLE_ENTERED_PLOT.s().length() > 2) {
String sTitleMain = C.TITLE_ENTERED_PLOT.s().replaceFirst("%s", plot.getDisplayName());
String sTitleSub = C.TITLE_ENTERED_PLOT_SUB.s().replaceFirst("%s", getName(plot.owner));