- /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: switch:
survival: Changes the game mode of a player to survival survival: Changes the game mode of a player to survival
creative: Changes the game mode of a player to creative creative: Changes the game mode of a player to creative
adventure: Changes the game mode of a player to adventure
config: config:
overview: "[setting] - empty for list of settings" overview: "[setting] - empty for list of settings"
settings: "Available Settings: " settings: "Available Settings: "

View file

@ -23,16 +23,19 @@ permissions:
description: Ignores the force of a gamemode, when region optional is disabled description: Ignores the force of a gamemode, when region optional is disabled
default: false default: false
limitedcreative.switch_gamemode: 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 default: op
limitedcreative.switch_gamemode.backonly: limitedcreative.switch_gamemode.backonly:
description: Allows switching of own game mode to default of the not world he is in, but not back description: Allows switching of own game mode to default of the not world he is in, but not back
default: false default: false
limitedcreative.switch_gamemode.survival: 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 default: false
limitedcreative.switch_gamemode.creative: 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 default: false
limitedcreative.switch_gamemode.other: limitedcreative.switch_gamemode.other:
description: Allows switching of other users game mode description: Allows switching of other users game mode

View file

@ -39,6 +39,7 @@ public class Commands {
public enum Action { public enum Action {
C, CREATIVE, C, CREATIVE,
S, SURVIVAL, S, SURVIVAL,
A, ADVENTURE,
E, ENABLE, E, ENABLE,
D, DISABLE, D, DISABLE,
R, REGION, R, REGION,
@ -64,6 +65,10 @@ public class Commands {
case SURVIVAL: case SURVIVAL:
this.setGameMode(GameMode.SURVIVAL, sender, args); this.setGameMode(GameMode.SURVIVAL, sender, args);
return true; return true;
case A:
case ADVENTURE:
this.setGameMode(GameMode.ADVENTURE, sender, args);
return true;
case E: case E:
case ENABLE: case ENABLE:
this.setOption(sender, args, true); this.setOption(sender, args, true);
@ -95,6 +100,7 @@ public class Commands {
StringBuilder message = new StringBuilder(); StringBuilder message = new StringBuilder();
message.append("/"+c+" s[urvival] ["+L("command.player")+"] - "+L("command.switch.survival")+"\n"); 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+" 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)) { if (hasPermission(sender, Perms.CONFIG)) {
message.append("/"+c+" e[nable] "+L("command.config.overview")+"\n"); message.append("/"+c+" e[nable] "+L("command.config.overview")+"\n");
message.append("/"+c+" d[isable] "+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) || Players.get(target).isGameModeAllowed(gm) ||
(gm == plugin.com.getDefaultGameMode(target.getWorld()) && hasPermission(sender, Perms.GM_BACKONLY)) || (gm == plugin.com.getDefaultGameMode(target.getWorld()) && hasPermission(sender, Perms.GM_BACKONLY)) ||
(gm == GameMode.CREATIVE && hasPermission(sender, Perms.GM_CREATIVE)) || (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); target.setGameMode(gm);
} else { } else {
throw new LackingPermissionException(); throw new LackingPermissionException();

View file

@ -515,7 +515,7 @@ public class LCPlayer {
} }
public boolean isGameModeAllowed(GameMode gm) { public boolean isGameModeAllowed(GameMode gm) {
if (plugin.config.getRegionOptional() && isActiveRegionGameMode()) { if (plugin.config.getRegionOptional() && isActiveRegionGameMode(gm)) {
return true; return true;
} }
return false; return false;

View file

@ -27,6 +27,7 @@ public enum Perms implements IPermission {
GM_BACKONLY("switch_gamemode.backonly"), GM_BACKONLY("switch_gamemode.backonly"),
GM_SURVIVAL("switch_gamemode.survival"), GM_SURVIVAL("switch_gamemode.survival"),
GM_CREATIVE("switch_gamemode.creative"), GM_CREATIVE("switch_gamemode.creative"),
GM_ADVENTURE("switch_gamemode.adventure"),
GM_OTHER("switch_gamemode.other"), GM_OTHER("switch_gamemode.other"),
KEEPINVENTORY("keepinventory"); KEEPINVENTORY("keepinventory");