mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-14 13:13:24 +00:00
Adding game mode command for quick toggling (/gm /creative /gamemode)
This commit is contained in:
parent
a9a8216f4d
commit
6e4bf932ec
10 changed files with 92 additions and 30 deletions
|
@ -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(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())
|
||||
{
|
||||
|
|
|
@ -45,6 +45,7 @@ corruptNodeInConfig = \u00a74Notice: Your configuration file has a corrupt {0} n
|
|||
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!
|
||||
|
@ -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...
|
||||
|
|
|
@ -45,6 +45,7 @@ corruptNodeInConfig = \u00a74Notice: Din konfigurations fil har en korrupt {0} n
|
|||
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!
|
||||
|
@ -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...
|
||||
|
|
|
@ -45,6 +45,7 @@ corruptNodeInConfig = \u00a74Hinweis: Deine Konfigurationsdatei hat einen ung\u0
|
|||
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!
|
||||
|
@ -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...
|
||||
|
|
|
@ -45,6 +45,7 @@ corruptNodeInConfig = \u00a74Notice: Your configuration file has a corrupt {0} n
|
|||
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!
|
||||
|
@ -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...
|
||||
|
|
|
@ -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...
|
||||
|
|
|
@ -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!
|
||||
|
@ -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...
|
||||
|
|
|
@ -45,6 +45,7 @@ corruptNodeInConfig = \u00a74Waarschuwing: Het configuratiebestand bevat een fou
|
|||
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!
|
||||
|
@ -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...
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue