Better Border-Check for collapsed regions
This commit is contained in:
parent
64eda8f1bd
commit
9a6d57f2e2
4 changed files with 11 additions and 8 deletions
2
pom.xml
2
pom.xml
|
@ -3,7 +3,7 @@
|
|||
<groupId>de.jaschastarke</groupId>
|
||||
<artifactId>LimitedCreative</artifactId>
|
||||
<name>LimitedCreative</name>
|
||||
<version>2.0</version>
|
||||
<version>2.1-SNAPSHOT</version>
|
||||
<url>https://github.com/possi/LimitedCreative</url>
|
||||
|
||||
<properties>
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue