- /lc a[dventure] command
This commit is contained in:
Jascha Starke 2012-08-04 12:04:04 +02:00
parent 585aa06fae
commit 8166b4d923
5 changed files with 17 additions and 5 deletions

View file

@ -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: "

View file

@ -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

View file

@ -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();

View file

@ -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;

View file

@ -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");