Adding game mode command for quick toggling (/gm /creative /gamemode)

This commit is contained in:
KHobbits 2011-11-03 23:33:04 +00:00
parent a9a8216f4d
commit 6e4bf932ec
10 changed files with 92 additions and 30 deletions

View File

@ -0,0 +1,44 @@
package com.earth2me.essentials.commands;
import com.earth2me.essentials.User;
import com.earth2me.essentials.Util;
import org.bukkit.GameMode;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class Commandgamemode extends EssentialsCommand
{
public Commandgamemode()
{
super("gamemode");
}
@Override
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
{
Player player;
if (args.length == 0)
{
if (sender instanceof Player)
{
player = ess.getUser(sender); }
else
{
throw new NotEnoughArgumentsException();
}
}
else
{
player = server.getPlayer(args[0]);
if (player == null)
{
throw new Exception(Util.i18n("playerNotFound"));
}
}
player.setGameMode(player.getGameMode() == GameMode.SURVIVAL ? GameMode.CREATIVE : GameMode.SURVIVAL);
//TODO: add this to messages?
sender.sendMessage(Util.format("gameMode", Util.i18n(player.getGameMode().toString().toLowerCase()), player.getDisplayName()));
}
}

View File

@ -53,7 +53,7 @@ public class Commandwhois extends EssentialsCommand
sender.sendMessage("");
sender.sendMessage(Util.format("whoisIs", u.getDisplayName(), u.getName()));
sender.sendMessage(Util.format("whoisHealth", u.getHealth()));
sender.sendMessage(Util.format("whoisGamemode", u.getGameMode().toString()));
sender.sendMessage(Util.format("whoisGamemode", Util.i18n(u.getGameMode().toString().toLowerCase())));
sender.sendMessage(Util.format("whoisLocation", u.getLocation().getWorld().getName(), u.getLocation().getBlockX(), u.getLocation().getBlockY(), u.getLocation().getBlockZ()));
if (!ess.getSettings().isEcoDisabled())
{

View File

@ -33,18 +33,19 @@ cantFindGeoIpDB = Can''t find GeoIP database!
cantReadGeoIpDB = Failed to read GeoIP database!
cantSpawnItem = \u00a7cYou are not allowed to spawn the item {0}
commandFailed = Command {0} failed:
commandHelpFailedForPlugin = Error getting help for: {0}
commandHelpFailedForPlugin = Error getting help for: {0}
commandNotLoaded = \u00a7cCommand {0} is improperly loaded.
compassBearing = \u00a77Bearing: {0} ({1} degrees).
configFileMoveError = Failed to move config.yml to backup location.
configFileRenameError = Failed to rename temp file to config.yml
connectedPlayers = Connected players:
connectedPlayers = Connected players:
connectionFailed = Failed to open connection.
cooldownWithMessage = \u00a7cCooldown: {0}
corruptNodeInConfig = \u00a74Notice: Your configuration file has a corrupt {0} node.
couldNotFindTemplate = Could not find template {0}
creatingConfigFromTemplate = Creating config from template: {0}
creatingEmptyConfig = Creating empty config: {0}
creative=creative
day = day
days = days
defaultBanReason = The Ban Hammer has spoken!
@ -104,8 +105,8 @@ hour = hour
hours = hours
ignorePlayer = You ignore player {0} from now on.
illegalDate = Illegal date format.
infoChapter = Select chapter:
infoChapterPages = Chapter {0}, page \u00a7c{1}\u00a7f of \u00a7c{2}\u00a7f:
infoChapter = Select chapter:
infoChapterPages = Chapter {0}, page \u00a7c{1}\u00a7f of \u00a7c{2}\u00a7f:
infoFileDoesNotExist = File info.txt does not exist. Creating one for you.
infoPages = Page \u00a7c{0}\u00a7f of \u00a7c{1}\u00a7f:
infoUnknownChapter = Unknown chapter.
@ -285,6 +286,7 @@ spawnSet = \u00a77Spawn location set for group {0}.
spawned = spawned
suicideMessage = \u00a77Goodbye Cruel World...
suicideSuccess = \u00a77{0} took their own life
survival=survival
takenFromAccount = \u00a7c{0} has been taken from your account.
takenFromOthersAccount = \u00a7c{0} has been taken from {1} account.
teleportAAll = \u00a77Teleporting request sent to all players...

View File

@ -33,18 +33,19 @@ cantFindGeoIpDB = Kan ikke finde GeoIP database!
cantReadGeoIpDB = Fejl ved l\u00e6sning af GeoIP database!
cantSpawnItem = \u00a7cDu er ikke tilladt at spawne elementet {0}
commandFailed = Kommando {0} fejlede:
commandHelpFailedForPlugin=Fejl ved at f\u00e5 hj\u00e6lp til: {0}
commandHelpFailedForPlugin=Fejl ved at f\u00e5 hj\u00e6lp til: {0}
commandNotLoaded = \u00a7cCommand {0} er ikke indl\u00e6st korrekt.
compassBearing = \u00a77B\u00e6rer: {0} ({1} grader).
configFileMoveError = Kunne ikke flytte config.yml til backup placering.
configFileRenameError = Kunne ikke omd\u00f8be temp fil til config.yml
connectedPlayers = Tilsluttede spillere:
connectedPlayers = Tilsluttede spillere:
connectionFailed = Failed ved \u00e5bning af forbindelse.
cooldownWithMessage = \u00a7cNedk\u00f8lning: {0}
corruptNodeInConfig = \u00a74Notice: Din konfigurations fil har en korrupt {0} node.
couldNotFindTemplate = Kunne ikke finde skabelon {0}
creatingConfigFromTemplate = Opretter config fra skabelon: {0}
creatingEmptyConfig = Opretter tom config: {0}
creative=creative
day = dag
days = dage
defaultBanReason = Ban hammeren har talt!
@ -104,8 +105,8 @@ hour = time
hours = timer
ignorePlayer = Du ignorere spiller {0} fra nu af.
illegalDate = Ilegal dato format.
infoChapter = V\u00e6lg kapitel:
infoChapterPages = Kapitel {0}, side \u00a7c{1}\u00a7f af \u00a7c{2}\u00a7f:
infoChapter = V\u00e6lg kapitel:
infoChapterPages = Kapitel {0}, side \u00a7c{1}\u00a7f af \u00a7c{2}\u00a7f:
infoFileDoesNotExist = Fil info.txt eksisterer ikke. Laver en for dig.
infoPages = Side \u00a7c{0}\u00a7f af \u00a7c{1}\u00a7f:
infoUnknownChapter = Ukendt kapitel.
@ -190,7 +191,7 @@ nickInUse = \u00a7cDet navn er allerede i brug.
nickNamesAlpha = \u00a7cKaldenavne skal v\u00e6re alfanumeriske.
nickNoMore = \u00a7Du har ikke l\u00e6ngere et kaldenavn.
nickOthersPermission = \u00a7cDu har ikke tilladelse til at \u00e6ndre andres kaldenavn
nickSet = \u00a77Dit kaldenavn er nu \u00a7c{0}
nickSet = \u00a77Dit kaldenavn er nu \u00a7c{0}
noAccessCommand = \u00a7cDu har ikke adgang til den kommando.
noAccessPermission = \u00a7cDu har ikke tilladelse til at f\u00e5 adgang til det {0}.
noDestroyPermission = \u00a7cDu har ikke tilladelse til at \u00f8del\u00e6gge det {0}.
@ -285,6 +286,7 @@ spawnSet = \u00a77Spawn placering sat for gruppe {0}.
spawned = spawnet
suicideMessage = \u00a77Farvel grusomme verden...
suicideSuccess = \u00a77{0} tog sit eget liv
survival=survival
takenFromAccount = \u00a7c{0} er taget fra din konto.
takenFromOthersAccount = \u00a7c{0} er blevet taget fra {1} konto.
teleportAAll = \u00a77Teleporting request sent to all players...

View File

@ -33,18 +33,19 @@ cantFindGeoIpDB = Kann GeoIP-Datenbank nicht finden!
cantReadGeoIpDB = Fehler beim Einlesen der GeoIP-Datenbank!
cantSpawnItem = \u00a7cDu darfst {0} nicht erzeugen.
commandFailed = Befehl {0} scheiterte:
commandHelpFailedForPlugin=Fehler beim Abrufen der Hilfe f\u00fcr: {0}
commandHelpFailedForPlugin=Fehler beim Abrufen der Hilfe f\u00fcr: {0}
commandNotLoaded = \u00a7cBefehl {0} ist nicht richtig geladen.
compassBearing = \u00a77Peilung: {0} ({1} Grad).
configFileMoveError = Verschieben von config.yml in den Sicherheitskopien-Ordner gescheitert.
configFileRenameError = Verschieben einer tempor\u00e4ren Datei nach config.yml gescheitert.
connectedPlayers = Verbundene Spieler:
connectedPlayers = Verbundene Spieler:
connectionFailed = Fehler beim Verbindungsaufbau.
cooldownWithMessage = \u00a7cBeschr\u00e4nkung: {0}
corruptNodeInConfig = \u00a74Hinweis: Deine Konfigurationsdatei hat einen ung\u00fcltigen Knoten {0}.
couldNotFindTemplate = Vorlage {0} konnte nicht gefunden werden.
creatingConfigFromTemplate = Erstelle Konfiguration aus Vorlage: {0}
creatingEmptyConfig = Erstelle leere Konfiguration: {0}
creative=creative
day = Tag
days = Tage
defaultBanReason = Der Bann-Hammer hat gesprochen!
@ -104,8 +105,8 @@ hour = Stunde
hours = Stunden
ignorePlayer = Du ignorierst ab jetzt Spieler {0}.
illegalDate = Ung\u00fcltiges Datumsformat.
infoChapter = W\u00e4hle Kapitel:
infoChapterPages = Kapitel {0}, Seite \u00a7c{1}\u00a7f von \u00a7c{2}\u00a7f:
infoChapter = W\u00e4hle Kapitel:
infoChapterPages = Kapitel {0}, Seite \u00a7c{1}\u00a7f von \u00a7c{2}\u00a7f:
infoFileDoesNotExist = Datei info.txt existiert nicht. Erzeuge eine neue Datei.
infoPages = Seite \u00a7c{0}\u00a7f von \u00a7c{1}\u00a7f:
infoUnknownChapter = Unbekanntes Kapitel:
@ -285,6 +286,7 @@ spawnSet = \u00a77Spawn-Punkt gesetzt f\u00fcr Gruppe {0}.
spawned = erzeugt
suicideMessage = \u00a77Lebewohl grausame Welt...
suicideSuccess = \u00a77{0} hat sich das Leben genommen.
survival=survival
takenFromAccount = \u00a7c{0} wurden aus deiner Geldb\u00f6rse genommen.
takenFromOthersAccount = \u00a7c{0} wurde von {1} wurde Rechnung getragen.
teleportAAll = \u00a77Teleportierungsanfrage zu allen Spielern gesendet...

View File

@ -38,13 +38,14 @@ commandNotLoaded = \u00a7cCommand {0} is improperly loaded.
compassBearing = \u00a77Bearing: {0} ({1} degrees).
configFileMoveError = Failed to move config.yml to backup location.
configFileRenameError = Failed to rename temp file to config.yml
connectedPlayers = Connected players:
connectedPlayers = Connected players:
connectionFailed = Failed to open connection.
cooldownWithMessage = \u00a7cCooldown: {0}
corruptNodeInConfig = \u00a74Notice: Your configuration file has a corrupt {0} node.
couldNotFindTemplate = Could not find template {0}
creatingConfigFromTemplate = Creating config from template: {0}
creatingEmptyConfig = Creating empty config: {0}
creative=creative
day = day
days = days
defaultBanReason = The Ban Hammer has spoken!
@ -104,8 +105,8 @@ hour = hour
hours = hours
ignorePlayer = You ignore player {0} from now on.
illegalDate = Illegal date format.
infoChapter = Select chapter:
infoChapterPages = Chapter {0}, page \u00a7c{1}\u00a7f of \u00a7c{2}\u00a7f:
infoChapter = Select chapter:
infoChapterPages = Chapter {0}, page \u00a7c{1}\u00a7f of \u00a7c{2}\u00a7f:
infoFileDoesNotExist = File info.txt does not exist. Creating one for you.
infoPages = Page \u00a7c{0}\u00a7f of \u00a7c{1}\u00a7f:
infoUnknownChapter = Unknown chapter.
@ -285,6 +286,7 @@ spawnSet = \u00a77Spawn location set for group {0}.
spawned = spawned
suicideMessage = \u00a77Goodbye Cruel World...
suicideSuccess = \u00a77{0} took their own life
survival=survival
takenFromAccount = \u00a7c{0} has been taken from your account.
takenFromOthersAccount = \u00a7c{0} has been taken from {1} account.
teleportAAll = \u00a77Teleporting request sent to all players...

View File

@ -45,6 +45,7 @@ corruptNodeInConfig = \u00a74Notice: Tu archivo de configuracion tiene un nodo {
couldNotFindTemplate = No se puede encontrar el template {0}
creatingConfigFromTemplate = Creando configuracion desde el template: {0}
creatingEmptyConfig = Creando configuracion vacia: {0}
creative=creative
day = dia
days = dias
defaultBanReason = Baneado por incumplir las normas!
@ -285,6 +286,7 @@ spawnSet = \u00a77El lugar de nacimiento ha sido puesto para el grupo {0}.
spawned = nacido
suicideMessage = \u00a77Adios mundo cruel...
suicideSuccess = \u00a77{0} se quito su propia vida
survival=survival
takenFromAccount = \u00a7c{0} ha sido sacado de tu cuenta.
takenFromOthersAccount = \u00a7c{0} ha sido sacado de la cuenta de {1}.
teleportAAll = \u00a77Peticion de teletransporte enviada a todos los jugadores...

View File

@ -5,10 +5,10 @@
action = * {0} {1}
addedToAccount = \u00a7a{0} a \u00e9t\u00e9 rajout\u00e9 a votre compte.
addedToOthersAccount = \u00a7a{0} a \u00e9t\u00e9 ajout\u00e9 \u00e0 {1} compte.
alertBroke = a cass\u00e9:
alertBroke = a cass\u00e9:
alertFormat = \u00a73[{0}] \u00a7f {1} \u00a76 {2} \u00e0:{3}
alertPlaced = a plac\u00e9:
alertUsed = a utilis\u00e9:
alertPlaced = a plac\u00e9:
alertUsed = a utilis\u00e9:
autoAfkKickReason=You have been kicked for idling more than {0} minutes.
backAfterDeath = \u00a77Utilisez la commande /back pour retourner \u00e0 l''endroit ou vous \u00eates mort.
backUsageMsg = \u00a77Retour a votre emplacement pr\u00e9c\u00e8dent.
@ -45,6 +45,7 @@ corruptNodeInConfig = \u00a74Annonce: Votre fichier de configuration a un {0} n\
couldNotFindTemplate = Le mod\u00e8le {0} est introuvable
creatingConfigFromTemplate = Cr\u00e9ation de la configuration \u00e0 partir du mod\u00e8le : {0}
creatingEmptyConfig = Cr\u00e9ation d''une configuration vierge : {0}
creative=creative
day = jour
days = jours
defaultBanReason = Le marteau du ban a frapp\u00e9!
@ -104,7 +105,7 @@ hour = heure
hours = heures
ignorePlayer = Vous ignorez d\u00e9sormais {0}.
illegalDate = Format de date ill\u00e9gal.
infoChapter = S\u00e9lectionner le chapitre :
infoChapter = S\u00e9lectionner le chapitre :
infoChapterPages = Chapitre {0}, page \u00a7c{1}\u00a7f sur \u00a7c{2}\u00a7f:
infoFileDoesNotExist = Le fichier info.txt n''existe pas. Le fichier est en cours de cr\u00e9ation pour vous.
infoPages = Page \u00a7c{0}\u00a7f de \u00a7c{1}\u00a7f.
@ -285,6 +286,7 @@ spawnSet = \u00a77Le point de spawn a \u00e9t\u00e9 d\u00e9fini pour le groupe {
spawned = spawn\u00e9
suicideMessage = \u00a77Au revoir monde cruel...
suicideSuccess = \u00a77{0} a pris sa propre vie.
survival=survival
takenFromAccount = \u00a7c{0} ont \u00e9t\u00e9 pris de votre compte.
takenFromOthersAccount = \u00a7c{0} a \u00e9t\u00e9 prise de {1} compte.
teleportAAll = \u00a77Teleporting request sent to all players...

View File

@ -38,13 +38,14 @@ commandNotLoaded = \u00a7cOpdracht {0} is fout geladen.
compassBearing = \u00a77Ligging: {0} ({1} graden).
configFileMoveError = Het verplaatsen van config.yml naar de backup locatie is mislukt.
configFileRenameError = Fout bij het hernoemen van de tijdelijke map naar config.yml
connectedPlayers = Spelers online:
connectedPlayers = Spelers online:
connectionFailed = Fout bij het verbinden.
cooldownWithMessage = \u00a7cAfkoeltijd: {0}
corruptNodeInConfig = \u00a74Waarschuwing: Het configuratiebestand bevat een fout {0}.
couldNotFindTemplate = Het sjabloon kon niet worden gevonden {0}
creatingConfigFromTemplate = Bezig met aanmaken van een config vanaf sjabloon: {0}
creatingEmptyConfig = Bezig met een lege config aanmaken: {0}
creative=creative
day = dag
days = dagen
defaultBanReason = De Ban Hamer heeft gesproken!
@ -104,8 +105,8 @@ hour = uur
hours = uren
ignorePlayer = Je negeert {0} vanaf nu.
illegalDate = Illegaal data formaat.
infoChapter = Selecteer hoofdstuk:
infoChapterPages = Hoofdstuk {0}, Pagina \u00a7c{1}\u00a7f van de \u00a7c{2}\u00a7f:
infoChapter = Selecteer hoofdstuk:
infoChapterPages = Hoofdstuk {0}, Pagina \u00a7c{1}\u00a7f van de \u00a7c{2}\u00a7f:
infoFileDoesNotExist = Bestand info.txt bestaat niet. Bezig met aanmaken.
infoPages = Pagina \u00a7c{0}\u00a7f van de \u00a7c{1}\u00a7f:
infoUnknownChapter = Onbekend hoofdstuk.
@ -285,6 +286,7 @@ spawnSet = \u00a77Spawn locatie voor de groep {0} ingesteld.
spawned = gespawned
suicideMessage = \u00a77Vaarwel vreedzame wereld...
suicideSuccess = \u00a77{0} pleegde zelfmoord
survival=survival
takenFromAccount = \u00a7c{0} is van je bank rekening afgehaald.
takenFromOthersAccount = \u00a7c{0} is overgenomen uit {1} account.
teleportAAll = \u00a77Teleporting request sent to all players...
@ -368,4 +370,4 @@ worthSet = Waarde ingesteld
year = jaar
years = jaren
youAreHealed = \u00a77Je bent genezen.
youHaveNewMail = \u00a7cJe hebt {0} berichten!\u00a7f Type \u00a77/mail read\u00a7f om je berichten te bekijken.
youHaveNewMail = \u00a7cJe hebt {0} berichten!\u00a7f Type \u00a77/mail read\u00a7f om je berichten te bekijken.

View File

@ -78,7 +78,7 @@ commands:
eco:
description: Manages the server economy.
usage: /<command> [give|take|reset] [player] [amount]
aliases: [economy,emoney]
aliases: [economy,eeco,eeconomy]
essentials:
description: Reloads essentials.
usage: /<command>
@ -90,6 +90,10 @@ commands:
description: Throw a fireball.
usage: /<command>
aliases: [efireball]
gamemode:
description: Change player gamemode.
usage: /<command> [player]
aliases: [gm,creative,creativemode,egamemode,ecreative,ecreativemode,egm]
getpos:
description: Get your current coordinates.
usage: /<command>
@ -104,8 +108,8 @@ commands:
aliases: [egive]
god:
description: Enables your godly powers.
usage: /<command>
aliases: [tgm,godmode,egod,egodmode,etgm]
usage: /<command> [player]
aliases: [tgm,godmode,egod,etgm,egodmode]
heal:
description: Heals you or the given player.
usage: /<command> <player>
@ -177,7 +181,7 @@ commands:
me:
description: Describes an action in the context of the player.
usage: /<command> [description]
aliases: [eme]
aliases: [action,describe,eme,eaction,edescribe]
motd:
description: Views the Message Of The Day.
usage: /<command>
@ -212,7 +216,7 @@ commands:
aliases: [pt,epowertool,ept]
powertooltoggle:
description: Enables or disables all current powertools
usage: /<command>
usage: /<command>
aliases: [ptt,epowertooltoggle,eptt]
ptime:
description: Adjust player's client time. Add @ prefix to fix.