Incomplete Spectator-Support

This commit is contained in:
Jascha Starke 2016-03-02 19:57:25 +01:00
parent 256f165622
commit 1efdf717b5
4 changed files with 15 additions and 0 deletions

View file

@ -138,6 +138,14 @@ public class FeatureSwitchGameMode extends CoreModule<LimitedCreative> {
public boolean adventure(CommandContext context, String player) throws MissingPermissionCommandException, CommandException { public boolean adventure(CommandContext context, String player) throws MissingPermissionCommandException, CommandException {
return changeGameMode(context, player, GameMode.ADVENTURE, SwitchGameModePermissions.ADVENTURE); return changeGameMode(context, player, GameMode.ADVENTURE, SwitchGameModePermissions.ADVENTURE);
} }
@IsCommand("spectator")
@Alias("sp")
@Description(value = "command.switch.spectator", translate = true)
@NeedsPermission(value={"spectator", "backonly"}, optional = true)
@Usages("[player]")
public boolean spectator(CommandContext context, String player) throws MissingPermissionCommandException, CommandException {
return changeGameMode(context, player, GameMode.SPECTATOR, SwitchGameModePermissions.SPECTATOR);
}
@Override @Override
public List<TabCompletion> getTabCompleter(MethodCommand cmd) { public List<TabCompletion> getTabCompleter(MethodCommand cmd) {

View file

@ -46,6 +46,11 @@ public class SwitchGameModePermissions extends ParentPermissionContainerNode {
*/ */
@IsChildPermission @IsChildPermission
public final static BasicPermission ADVENTURE = new BasicPermission(ALL, "adventure", PermissionDefault.FALSE); public final static BasicPermission ADVENTURE = new BasicPermission(ALL, "adventure", PermissionDefault.FALSE);
/**
* Allows switching of own game mode to spectator, but not to creative/survival/adventure
*/
@IsChildPermission
public final static BasicPermission SPECTATOR = new BasicPermission(ALL, "spectator", PermissionDefault.FALSE);
/** /**
* Allows switching of other users game mode * Allows switching of other users game mode

View file

@ -11,6 +11,7 @@ command.regions: LimitedCreative-Region-Command: configure creative regions
command.switch.survival: Changes the game mode of a player to survival command.switch.survival: Changes the game mode of a player to survival
command.switch.creative: Changes the game mode of a player to creative command.switch.creative: Changes the game mode of a player to creative
command.switch.adventure: Changes the game mode of a player to adventure command.switch.adventure: Changes the game mode of a player to adventure
command.switch.spectator: Changes the game mode of a player to spectator
command.config.reload: Reloads configuration and re-initializes all active modules. command.config.reload: Reloads configuration and re-initializes all active modules.
command.config.reload.success: The plugin was successfully reloaded. command.config.reload.success: The plugin was successfully reloaded.
command.gamemode.changed: {0}''s game mode has been changed command.gamemode.changed: {0}''s game mode has been changed

View file

@ -11,6 +11,7 @@ command.regions: LimitedCreative-Region-Kommando: Kreativ-Regionen konfigurieren
command.switch.survival: Ändert den Spielmodus des Spielers zu Überleben command.switch.survival: Ändert den Spielmodus des Spielers zu Überleben
command.switch.creative: Ändert den Spielmodus des Spielers zu Kreativ command.switch.creative: Ändert den Spielmodus des Spielers zu Kreativ
command.switch.adventure: Ändert den Spielmodus des Spielers zu Abenteuer command.switch.adventure: Ändert den Spielmodus des Spielers zu Abenteuer
command.switch.spectator: Ändert den Spielmodus des Spielers zu Beobachter
command.config.reload: Lädt die Konfiguration neu und initialisiert alle Module neu command.config.reload: Lädt die Konfiguration neu und initialisiert alle Module neu
command.config.reload.success: Das Plugin wurde erfolgreich neu geladen command.config.reload.success: Das Plugin wurde erfolgreich neu geladen
command.gamemode.changed: {0}''s GameMode wurde geändert command.gamemode.changed: {0}''s GameMode wurde geändert