diff --git a/lang/en_US.yml b/lang/en_US.yml index 9411b12..24723dc 100644 --- a/lang/en_US.yml +++ b/lang/en_US.yml @@ -15,6 +15,7 @@ command: switch: survival: Changes the game mode of a player to survival creative: Changes the game mode of a player to creative + adventure: Changes the game mode of a player to adventure config: overview: "[setting] - empty for list of settings" settings: "Available Settings: " diff --git a/plugin.yml b/plugin.yml index 1e0f0bd..93c1246 100644 --- a/plugin.yml +++ b/plugin.yml @@ -23,16 +23,19 @@ permissions: description: Ignores the force of a gamemode, when region optional is disabled default: false limitedcreative.switch_gamemode: - description: Allows switching of own game mode to creative and back + description: Allows switching of own game mode to creative/adventure and back default: op limitedcreative.switch_gamemode.backonly: description: Allows switching of own game mode to default of the not world he is in, but not back default: false limitedcreative.switch_gamemode.survival: - description: Allows switching of own game mode to survival, but not to creative + description: Allows switching of own game mode to survival, but not to creative/adventure default: false limitedcreative.switch_gamemode.creative: - description: Allows switching of own game mode to creative, but not to survival + description: Allows switching of own game mode to creative, but not to survival/adventure + default: false + limitedcreative.switch_gamemode.adventure: + description: Allows switching of own game mode to adventure, but not to creative/survival default: false limitedcreative.switch_gamemode.other: description: Allows switching of other users game mode diff --git a/src/de/jaschastarke/minecraft/limitedcreative/Commands.java b/src/de/jaschastarke/minecraft/limitedcreative/Commands.java index 1b42a6b..9236c1f 100644 --- a/src/de/jaschastarke/minecraft/limitedcreative/Commands.java +++ b/src/de/jaschastarke/minecraft/limitedcreative/Commands.java @@ -39,6 +39,7 @@ public class Commands { public enum Action { C, CREATIVE, S, SURVIVAL, + A, ADVENTURE, E, ENABLE, D, DISABLE, R, REGION, @@ -64,6 +65,10 @@ public class Commands { case SURVIVAL: this.setGameMode(GameMode.SURVIVAL, sender, args); return true; + case A: + case ADVENTURE: + this.setGameMode(GameMode.ADVENTURE, sender, args); + return true; case E: case ENABLE: this.setOption(sender, args, true); @@ -95,6 +100,7 @@ public class Commands { StringBuilder message = new StringBuilder(); message.append("/"+c+" s[urvival] ["+L("command.player")+"] - "+L("command.switch.survival")+"\n"); message.append("/"+c+" c[reative] ["+L("command.player")+"] - "+L("command.switch.creative")+"\n"); + message.append("/"+c+" a[dventure] ["+L("command.player")+"] - "+L("command.switch.adventure")+"\n"); if (hasPermission(sender, Perms.CONFIG)) { message.append("/"+c+" e[nable] "+L("command.config.overview")+"\n"); message.append("/"+c+" d[isable] "+L("command.config.overview")+"\n"); @@ -164,7 +170,8 @@ public class Commands { Players.get(target).isGameModeAllowed(gm) || (gm == plugin.com.getDefaultGameMode(target.getWorld()) && hasPermission(sender, Perms.GM_BACKONLY)) || (gm == GameMode.CREATIVE && hasPermission(sender, Perms.GM_CREATIVE)) || - (gm == GameMode.SURVIVAL && hasPermission(sender, Perms.GM_SURVIVAL))) { + (gm == GameMode.SURVIVAL && hasPermission(sender, Perms.GM_SURVIVAL)) || + (gm == GameMode.ADVENTURE && hasPermission(sender, Perms.GM_ADVENTURE))) { target.setGameMode(gm); } else { throw new LackingPermissionException(); diff --git a/src/de/jaschastarke/minecraft/limitedcreative/LCPlayer.java b/src/de/jaschastarke/minecraft/limitedcreative/LCPlayer.java index bcbbc12..f9b8ab4 100644 --- a/src/de/jaschastarke/minecraft/limitedcreative/LCPlayer.java +++ b/src/de/jaschastarke/minecraft/limitedcreative/LCPlayer.java @@ -515,7 +515,7 @@ public class LCPlayer { } public boolean isGameModeAllowed(GameMode gm) { - if (plugin.config.getRegionOptional() && isActiveRegionGameMode()) { + if (plugin.config.getRegionOptional() && isActiveRegionGameMode(gm)) { return true; } return false; diff --git a/src/de/jaschastarke/minecraft/limitedcreative/Perms.java b/src/de/jaschastarke/minecraft/limitedcreative/Perms.java index 72ffaa6..f5be286 100644 --- a/src/de/jaschastarke/minecraft/limitedcreative/Perms.java +++ b/src/de/jaschastarke/minecraft/limitedcreative/Perms.java @@ -27,6 +27,7 @@ public enum Perms implements IPermission { GM_BACKONLY("switch_gamemode.backonly"), GM_SURVIVAL("switch_gamemode.survival"), GM_CREATIVE("switch_gamemode.creative"), + GM_ADVENTURE("switch_gamemode.adventure"), GM_OTHER("switch_gamemode.other"), KEEPINVENTORY("keepinventory");