mirror of
https://github.com/EssentialsX/Essentials.git
synced 2025-01-27 02:21:22 +01:00
Adding game mode command for quick toggling (/gm /creative /gamemode)
This commit is contained in:
parent
a9a8216f4d
commit
6e4bf932ec
@ -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()));
|
||||||
|
}
|
||||||
|
}
|
@ -53,7 +53,7 @@ public class Commandwhois extends EssentialsCommand
|
|||||||
sender.sendMessage("");
|
sender.sendMessage("");
|
||||||
sender.sendMessage(Util.format("whoisIs", u.getDisplayName(), u.getName()));
|
sender.sendMessage(Util.format("whoisIs", u.getDisplayName(), u.getName()));
|
||||||
sender.sendMessage(Util.format("whoisHealth", u.getHealth()));
|
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()));
|
sender.sendMessage(Util.format("whoisLocation", u.getLocation().getWorld().getName(), u.getLocation().getBlockX(), u.getLocation().getBlockY(), u.getLocation().getBlockZ()));
|
||||||
if (!ess.getSettings().isEcoDisabled())
|
if (!ess.getSettings().isEcoDisabled())
|
||||||
{
|
{
|
||||||
|
@ -45,6 +45,7 @@ corruptNodeInConfig = \u00a74Notice: Your configuration file has a corrupt {0} n
|
|||||||
couldNotFindTemplate = Could not find template {0}
|
couldNotFindTemplate = Could not find template {0}
|
||||||
creatingConfigFromTemplate = Creating config from template: {0}
|
creatingConfigFromTemplate = Creating config from template: {0}
|
||||||
creatingEmptyConfig = Creating empty config: {0}
|
creatingEmptyConfig = Creating empty config: {0}
|
||||||
|
creative=creative
|
||||||
day = day
|
day = day
|
||||||
days = days
|
days = days
|
||||||
defaultBanReason = The Ban Hammer has spoken!
|
defaultBanReason = The Ban Hammer has spoken!
|
||||||
@ -285,6 +286,7 @@ spawnSet = \u00a77Spawn location set for group {0}.
|
|||||||
spawned = spawned
|
spawned = spawned
|
||||||
suicideMessage = \u00a77Goodbye Cruel World...
|
suicideMessage = \u00a77Goodbye Cruel World...
|
||||||
suicideSuccess = \u00a77{0} took their own life
|
suicideSuccess = \u00a77{0} took their own life
|
||||||
|
survival=survival
|
||||||
takenFromAccount = \u00a7c{0} has been taken from your account.
|
takenFromAccount = \u00a7c{0} has been taken from your account.
|
||||||
takenFromOthersAccount = \u00a7c{0} has been taken from {1} account.
|
takenFromOthersAccount = \u00a7c{0} has been taken from {1} account.
|
||||||
teleportAAll = \u00a77Teleporting request sent to all players...
|
teleportAAll = \u00a77Teleporting request sent to all players...
|
||||||
|
@ -45,6 +45,7 @@ corruptNodeInConfig = \u00a74Notice: Din konfigurations fil har en korrupt {0} n
|
|||||||
couldNotFindTemplate = Kunne ikke finde skabelon {0}
|
couldNotFindTemplate = Kunne ikke finde skabelon {0}
|
||||||
creatingConfigFromTemplate = Opretter config fra skabelon: {0}
|
creatingConfigFromTemplate = Opretter config fra skabelon: {0}
|
||||||
creatingEmptyConfig = Opretter tom config: {0}
|
creatingEmptyConfig = Opretter tom config: {0}
|
||||||
|
creative=creative
|
||||||
day = dag
|
day = dag
|
||||||
days = dage
|
days = dage
|
||||||
defaultBanReason = Ban hammeren har talt!
|
defaultBanReason = Ban hammeren har talt!
|
||||||
@ -285,6 +286,7 @@ spawnSet = \u00a77Spawn placering sat for gruppe {0}.
|
|||||||
spawned = spawnet
|
spawned = spawnet
|
||||||
suicideMessage = \u00a77Farvel grusomme verden...
|
suicideMessage = \u00a77Farvel grusomme verden...
|
||||||
suicideSuccess = \u00a77{0} tog sit eget liv
|
suicideSuccess = \u00a77{0} tog sit eget liv
|
||||||
|
survival=survival
|
||||||
takenFromAccount = \u00a7c{0} er taget fra din konto.
|
takenFromAccount = \u00a7c{0} er taget fra din konto.
|
||||||
takenFromOthersAccount = \u00a7c{0} er blevet taget fra {1} konto.
|
takenFromOthersAccount = \u00a7c{0} er blevet taget fra {1} konto.
|
||||||
teleportAAll = \u00a77Teleporting request sent to all players...
|
teleportAAll = \u00a77Teleporting request sent to all players...
|
||||||
|
@ -45,6 +45,7 @@ corruptNodeInConfig = \u00a74Hinweis: Deine Konfigurationsdatei hat einen ung\u0
|
|||||||
couldNotFindTemplate = Vorlage {0} konnte nicht gefunden werden.
|
couldNotFindTemplate = Vorlage {0} konnte nicht gefunden werden.
|
||||||
creatingConfigFromTemplate = Erstelle Konfiguration aus Vorlage: {0}
|
creatingConfigFromTemplate = Erstelle Konfiguration aus Vorlage: {0}
|
||||||
creatingEmptyConfig = Erstelle leere Konfiguration: {0}
|
creatingEmptyConfig = Erstelle leere Konfiguration: {0}
|
||||||
|
creative=creative
|
||||||
day = Tag
|
day = Tag
|
||||||
days = Tage
|
days = Tage
|
||||||
defaultBanReason = Der Bann-Hammer hat gesprochen!
|
defaultBanReason = Der Bann-Hammer hat gesprochen!
|
||||||
@ -285,6 +286,7 @@ spawnSet = \u00a77Spawn-Punkt gesetzt f\u00fcr Gruppe {0}.
|
|||||||
spawned = erzeugt
|
spawned = erzeugt
|
||||||
suicideMessage = \u00a77Lebewohl grausame Welt...
|
suicideMessage = \u00a77Lebewohl grausame Welt...
|
||||||
suicideSuccess = \u00a77{0} hat sich das Leben genommen.
|
suicideSuccess = \u00a77{0} hat sich das Leben genommen.
|
||||||
|
survival=survival
|
||||||
takenFromAccount = \u00a7c{0} wurden aus deiner Geldb\u00f6rse genommen.
|
takenFromAccount = \u00a7c{0} wurden aus deiner Geldb\u00f6rse genommen.
|
||||||
takenFromOthersAccount = \u00a7c{0} wurde von {1} wurde Rechnung getragen.
|
takenFromOthersAccount = \u00a7c{0} wurde von {1} wurde Rechnung getragen.
|
||||||
teleportAAll = \u00a77Teleportierungsanfrage zu allen Spielern gesendet...
|
teleportAAll = \u00a77Teleportierungsanfrage zu allen Spielern gesendet...
|
||||||
|
@ -45,6 +45,7 @@ corruptNodeInConfig = \u00a74Notice: Your configuration file has a corrupt {0} n
|
|||||||
couldNotFindTemplate = Could not find template {0}
|
couldNotFindTemplate = Could not find template {0}
|
||||||
creatingConfigFromTemplate = Creating config from template: {0}
|
creatingConfigFromTemplate = Creating config from template: {0}
|
||||||
creatingEmptyConfig = Creating empty config: {0}
|
creatingEmptyConfig = Creating empty config: {0}
|
||||||
|
creative=creative
|
||||||
day = day
|
day = day
|
||||||
days = days
|
days = days
|
||||||
defaultBanReason = The Ban Hammer has spoken!
|
defaultBanReason = The Ban Hammer has spoken!
|
||||||
@ -285,6 +286,7 @@ spawnSet = \u00a77Spawn location set for group {0}.
|
|||||||
spawned = spawned
|
spawned = spawned
|
||||||
suicideMessage = \u00a77Goodbye Cruel World...
|
suicideMessage = \u00a77Goodbye Cruel World...
|
||||||
suicideSuccess = \u00a77{0} took their own life
|
suicideSuccess = \u00a77{0} took their own life
|
||||||
|
survival=survival
|
||||||
takenFromAccount = \u00a7c{0} has been taken from your account.
|
takenFromAccount = \u00a7c{0} has been taken from your account.
|
||||||
takenFromOthersAccount = \u00a7c{0} has been taken from {1} account.
|
takenFromOthersAccount = \u00a7c{0} has been taken from {1} account.
|
||||||
teleportAAll = \u00a77Teleporting request sent to all players...
|
teleportAAll = \u00a77Teleporting request sent to all players...
|
||||||
|
@ -45,6 +45,7 @@ corruptNodeInConfig = \u00a74Notice: Tu archivo de configuracion tiene un nodo {
|
|||||||
couldNotFindTemplate = No se puede encontrar el template {0}
|
couldNotFindTemplate = No se puede encontrar el template {0}
|
||||||
creatingConfigFromTemplate = Creando configuracion desde el template: {0}
|
creatingConfigFromTemplate = Creando configuracion desde el template: {0}
|
||||||
creatingEmptyConfig = Creando configuracion vacia: {0}
|
creatingEmptyConfig = Creando configuracion vacia: {0}
|
||||||
|
creative=creative
|
||||||
day = dia
|
day = dia
|
||||||
days = dias
|
days = dias
|
||||||
defaultBanReason = Baneado por incumplir las normas!
|
defaultBanReason = Baneado por incumplir las normas!
|
||||||
@ -285,6 +286,7 @@ spawnSet = \u00a77El lugar de nacimiento ha sido puesto para el grupo {0}.
|
|||||||
spawned = nacido
|
spawned = nacido
|
||||||
suicideMessage = \u00a77Adios mundo cruel...
|
suicideMessage = \u00a77Adios mundo cruel...
|
||||||
suicideSuccess = \u00a77{0} se quito su propia vida
|
suicideSuccess = \u00a77{0} se quito su propia vida
|
||||||
|
survival=survival
|
||||||
takenFromAccount = \u00a7c{0} ha sido sacado de tu cuenta.
|
takenFromAccount = \u00a7c{0} ha sido sacado de tu cuenta.
|
||||||
takenFromOthersAccount = \u00a7c{0} ha sido sacado de la cuenta de {1}.
|
takenFromOthersAccount = \u00a7c{0} ha sido sacado de la cuenta de {1}.
|
||||||
teleportAAll = \u00a77Peticion de teletransporte enviada a todos los jugadores...
|
teleportAAll = \u00a77Peticion de teletransporte enviada a todos los jugadores...
|
||||||
|
@ -45,6 +45,7 @@ corruptNodeInConfig = \u00a74Annonce: Votre fichier de configuration a un {0} n\
|
|||||||
couldNotFindTemplate = Le mod\u00e8le {0} est introuvable
|
couldNotFindTemplate = Le mod\u00e8le {0} est introuvable
|
||||||
creatingConfigFromTemplate = Cr\u00e9ation de la configuration \u00e0 partir du mod\u00e8le : {0}
|
creatingConfigFromTemplate = Cr\u00e9ation de la configuration \u00e0 partir du mod\u00e8le : {0}
|
||||||
creatingEmptyConfig = Cr\u00e9ation d''une configuration vierge : {0}
|
creatingEmptyConfig = Cr\u00e9ation d''une configuration vierge : {0}
|
||||||
|
creative=creative
|
||||||
day = jour
|
day = jour
|
||||||
days = jours
|
days = jours
|
||||||
defaultBanReason = Le marteau du ban a frapp\u00e9!
|
defaultBanReason = Le marteau du ban a frapp\u00e9!
|
||||||
@ -285,6 +286,7 @@ spawnSet = \u00a77Le point de spawn a \u00e9t\u00e9 d\u00e9fini pour le groupe {
|
|||||||
spawned = spawn\u00e9
|
spawned = spawn\u00e9
|
||||||
suicideMessage = \u00a77Au revoir monde cruel...
|
suicideMessage = \u00a77Au revoir monde cruel...
|
||||||
suicideSuccess = \u00a77{0} a pris sa propre vie.
|
suicideSuccess = \u00a77{0} a pris sa propre vie.
|
||||||
|
survival=survival
|
||||||
takenFromAccount = \u00a7c{0} ont \u00e9t\u00e9 pris de votre compte.
|
takenFromAccount = \u00a7c{0} ont \u00e9t\u00e9 pris de votre compte.
|
||||||
takenFromOthersAccount = \u00a7c{0} a \u00e9t\u00e9 prise de {1} compte.
|
takenFromOthersAccount = \u00a7c{0} a \u00e9t\u00e9 prise de {1} compte.
|
||||||
teleportAAll = \u00a77Teleporting request sent to all players...
|
teleportAAll = \u00a77Teleporting request sent to all players...
|
||||||
|
@ -45,6 +45,7 @@ corruptNodeInConfig = \u00a74Waarschuwing: Het configuratiebestand bevat een fou
|
|||||||
couldNotFindTemplate = Het sjabloon kon niet worden gevonden {0}
|
couldNotFindTemplate = Het sjabloon kon niet worden gevonden {0}
|
||||||
creatingConfigFromTemplate = Bezig met aanmaken van een config vanaf sjabloon: {0}
|
creatingConfigFromTemplate = Bezig met aanmaken van een config vanaf sjabloon: {0}
|
||||||
creatingEmptyConfig = Bezig met een lege config aanmaken: {0}
|
creatingEmptyConfig = Bezig met een lege config aanmaken: {0}
|
||||||
|
creative=creative
|
||||||
day = dag
|
day = dag
|
||||||
days = dagen
|
days = dagen
|
||||||
defaultBanReason = De Ban Hamer heeft gesproken!
|
defaultBanReason = De Ban Hamer heeft gesproken!
|
||||||
@ -285,6 +286,7 @@ spawnSet = \u00a77Spawn locatie voor de groep {0} ingesteld.
|
|||||||
spawned = gespawned
|
spawned = gespawned
|
||||||
suicideMessage = \u00a77Vaarwel vreedzame wereld...
|
suicideMessage = \u00a77Vaarwel vreedzame wereld...
|
||||||
suicideSuccess = \u00a77{0} pleegde zelfmoord
|
suicideSuccess = \u00a77{0} pleegde zelfmoord
|
||||||
|
survival=survival
|
||||||
takenFromAccount = \u00a7c{0} is van je bank rekening afgehaald.
|
takenFromAccount = \u00a7c{0} is van je bank rekening afgehaald.
|
||||||
takenFromOthersAccount = \u00a7c{0} is overgenomen uit {1} account.
|
takenFromOthersAccount = \u00a7c{0} is overgenomen uit {1} account.
|
||||||
teleportAAll = \u00a77Teleporting request sent to all players...
|
teleportAAll = \u00a77Teleporting request sent to all players...
|
||||||
|
@ -78,7 +78,7 @@ commands:
|
|||||||
eco:
|
eco:
|
||||||
description: Manages the server economy.
|
description: Manages the server economy.
|
||||||
usage: /<command> [give|take|reset] [player] [amount]
|
usage: /<command> [give|take|reset] [player] [amount]
|
||||||
aliases: [economy,emoney]
|
aliases: [economy,eeco,eeconomy]
|
||||||
essentials:
|
essentials:
|
||||||
description: Reloads essentials.
|
description: Reloads essentials.
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
@ -90,6 +90,10 @@ commands:
|
|||||||
description: Throw a fireball.
|
description: Throw a fireball.
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
aliases: [efireball]
|
aliases: [efireball]
|
||||||
|
gamemode:
|
||||||
|
description: Change player gamemode.
|
||||||
|
usage: /<command> [player]
|
||||||
|
aliases: [gm,creative,creativemode,egamemode,ecreative,ecreativemode,egm]
|
||||||
getpos:
|
getpos:
|
||||||
description: Get your current coordinates.
|
description: Get your current coordinates.
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
@ -104,8 +108,8 @@ commands:
|
|||||||
aliases: [egive]
|
aliases: [egive]
|
||||||
god:
|
god:
|
||||||
description: Enables your godly powers.
|
description: Enables your godly powers.
|
||||||
usage: /<command>
|
usage: /<command> [player]
|
||||||
aliases: [tgm,godmode,egod,egodmode,etgm]
|
aliases: [tgm,godmode,egod,etgm,egodmode]
|
||||||
heal:
|
heal:
|
||||||
description: Heals you or the given player.
|
description: Heals you or the given player.
|
||||||
usage: /<command> <player>
|
usage: /<command> <player>
|
||||||
@ -177,7 +181,7 @@ commands:
|
|||||||
me:
|
me:
|
||||||
description: Describes an action in the context of the player.
|
description: Describes an action in the context of the player.
|
||||||
usage: /<command> [description]
|
usage: /<command> [description]
|
||||||
aliases: [eme]
|
aliases: [action,describe,eme,eaction,edescribe]
|
||||||
motd:
|
motd:
|
||||||
description: Views the Message Of The Day.
|
description: Views the Message Of The Day.
|
||||||
usage: /<command>
|
usage: /<command>
|
||||||
|
Loading…
Reference in New Issue
Block a user