diff --git a/pom.xml b/pom.xml
index 611927c..2dcadfe 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
de.jaschastarke
LimitedCreative
LimitedCreative
- 2.0
+ 2.1-SNAPSHOT
https://github.com/possi/LimitedCreative
diff --git a/src/main/java/de/jaschastarke/minecraft/limitedcreative/regions/BlockListener.java b/src/main/java/de/jaschastarke/minecraft/limitedcreative/regions/BlockListener.java
index 1aea99a..5a71ccc 100644
--- a/src/main/java/de/jaschastarke/minecraft/limitedcreative/regions/BlockListener.java
+++ b/src/main/java/de/jaschastarke/minecraft/limitedcreative/regions/BlockListener.java
@@ -50,7 +50,7 @@ public class BlockListener extends Listener {
}
} else if (diffrent_region) {
// do not break inside of "survial-region in creative world" when outside
- if (getRM().getRegionSet(block).getFlag(Flags.GAMEMODE) != null) {
+ if (getRM().getRegionSet(block).getFlag(Flags.GAMEMODE) != null && getRM().getRegionSet(block).getFlag(Flags.GAMEMODE, player) != player.getGameMode()) {
player.sendMessage(L("blocked.inside_break"));
event.setCancelled(true);
}
@@ -81,7 +81,7 @@ public class BlockListener extends Listener {
}
} else if (diffrent_region) {
// do not build inside of "survial-region in creative world" when outside
- if (getRM().getRegionSet(event.getBlock()).getFlag(Flags.GAMEMODE) != null) {
+ if (getRM().getRegionSet(event.getBlock()).getFlag(Flags.GAMEMODE) != null && getRM().getRegionSet(event.getBlock()).getFlag(Flags.GAMEMODE, event.getPlayer()) != event.getPlayer().getGameMode()) {
event.getPlayer().sendMessage(L("blocked.inside_place"));
event.setCancelled(true);
}
diff --git a/src/main/java/de/jaschastarke/minecraft/limitedcreative/regions/PlayerData.java b/src/main/java/de/jaschastarke/minecraft/limitedcreative/regions/PlayerData.java
index 2843f0d..72c24a6 100644
--- a/src/main/java/de/jaschastarke/minecraft/limitedcreative/regions/PlayerData.java
+++ b/src/main/java/de/jaschastarke/minecraft/limitedcreative/regions/PlayerData.java
@@ -84,22 +84,25 @@ public class PlayerData {
return getGameMode("region_gamemode");
}
public void storeActiveRegionGameMode(GameMode regionGameMode) {
- getSect(n()).set("region_gamemode", regionGameMode);
+ getSect(n()).set("region_gamemode", regionGameMode != null ? regionGameMode.toString() : null);
cleanUp();
+ save();
}
public GameMode getPermanentRegionGameMode() {
return getGameMode("permanent_gamemode");
}
public void storePermanentGameMode(GameMode currentGameMode) {
- getSect(n()).set("permanent_gamemode", currentGameMode);
+ getSect(n()).set("permanent_gamemode", currentGameMode != null ? currentGameMode.toString() : null);
cleanUp();
+ save();
}
public GameMode getOptionalRegionGameMode(String regionHash) {
return getGameMode("optional_gamemode." + regionHash);
}
public void setOptionalRegionGameMode(String regionHash, GameMode currentGameMode) {
- getSect(n()+".optional_gamemode").set(regionHash, currentGameMode);
+ getSect(n()+".optional_gamemode").set(regionHash, currentGameMode != null ? currentGameMode.toString() : null);
cleanUp();
+ save();
}
private GameMode getGameMode(String path) {
diff --git a/src/main/java/de/jaschastarke/minecraft/limitedcreative/regions/PlayerListener.java b/src/main/java/de/jaschastarke/minecraft/limitedcreative/regions/PlayerListener.java
index b0ce16e..a415f7c 100644
--- a/src/main/java/de/jaschastarke/minecraft/limitedcreative/regions/PlayerListener.java
+++ b/src/main/java/de/jaschastarke/minecraft/limitedcreative/regions/PlayerListener.java
@@ -48,7 +48,7 @@ public class PlayerListener extends Listener {
}
} else if (diffrent_region) {
// do not break inside of "survial-region in creative world" when outside
- if (getRM().getRegionSet(block).getFlag(Flags.GAMEMODE) != null) {
+ if (getRM().getRegionSet(block).getFlag(Flags.GAMEMODE) != null && getRM().getRegionSet(block).getFlag(Flags.GAMEMODE, event.getPlayer()) != event.getPlayer().getGameMode()) { // TODO: Rework
event.getPlayer().sendMessage(L("blocked.inside_interact"));
event.setCancelled(true);
}
@@ -69,7 +69,7 @@ public class PlayerListener extends Listener {
}
} else if (diffrent_region) {
// do not break inside of "survial-region in creative world" when outside
- if (getRM().getRegionSet(loc).getFlag(Flags.GAMEMODE) != null) {
+ if (getRM().getRegionSet(loc).getFlag(Flags.GAMEMODE) != null && getRM().getRegionSet(loc).getFlag(Flags.GAMEMODE, event.getPlayer()) != event.getPlayer().getGameMode()) {
event.getPlayer().sendMessage(L("blocked.inside_interact_entity"));
event.setCancelled(true);
}