summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKHobbits <rob@khobbits.co.uk>2012-11-16 01:35:35 +0000
committerKHobbits <rob@khobbits.co.uk>2012-11-16 01:37:47 +0000
commit42872650d25c1403ef9e6c435819f6e8c50a2c60 (patch)
tree627d685dd71e73ae285f29c5f099a3c535ff47de
parent5728f964a55169b26b2dbcc13cf58f6595345926 (diff)
downloadEssentials-42872650d25c1403ef9e6c435819f6e8c50a2c60.tar
Essentials-42872650d25c1403ef9e6c435819f6e8c50a2c60.tar.gz
Essentials-42872650d25c1403ef9e6c435819f6e8c50a2c60.tar.lz
Essentials-42872650d25c1403ef9e6c435819f6e8c50a2c60.tar.xz
Essentials-42872650d25c1403ef9e6c435819f6e8c50a2c60.zip
Add tptoggle others Essentials style.
-rw-r--r--Essentials/src/com/earth2me/essentials/commands/Commandtptoggle.java61
-rw-r--r--Essentials/src/messages.properties2
-rw-r--r--Essentials/src/messages_cs.properties2
-rw-r--r--Essentials/src/messages_da.properties2
-rw-r--r--Essentials/src/messages_de.properties2
-rw-r--r--Essentials/src/messages_en.properties2
-rw-r--r--Essentials/src/messages_es.properties6
-rw-r--r--Essentials/src/messages_fi.properties2
-rw-r--r--Essentials/src/messages_fr.properties10
-rw-r--r--Essentials/src/messages_it.properties2
-rw-r--r--Essentials/src/messages_nl.properties2
-rw-r--r--Essentials/src/messages_pl.properties2
-rw-r--r--Essentials/src/messages_pt.properties2
-rw-r--r--Essentials/src/messages_se.properties2
-rw-r--r--Essentials/src/plugin.yml2
15 files changed, 80 insertions, 21 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandtptoggle.java b/Essentials/src/com/earth2me/essentials/commands/Commandtptoggle.java
index 6a17de81a..769060980 100644
--- a/Essentials/src/com/earth2me/essentials/commands/Commandtptoggle.java
+++ b/Essentials/src/com/earth2me/essentials/commands/Commandtptoggle.java
@@ -3,6 +3,8 @@ package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
import org.bukkit.Server;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
public class Commandtptoggle extends EssentialsCommand
@@ -13,28 +15,59 @@ public class Commandtptoggle extends EssentialsCommand
}
@Override
+ public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
+ {
+ if (args.length < 1)
+ {
+ throw new NotEnoughArgumentsException();
+ }
+
+ toggleOtherPlayers(server, sender, args);
+ }
+
+ @Override
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
- User otherUser = null;
- if (args.length > 0 && user.isAuthorized("essentials.tptoggle.others"))
+ if (args.length > 0 && args[0].trim().length() > 2 && user.isAuthorized("essentials.tptoggle.others"))
{
- otherUser = ess.getUser(server.getPlayer(args[0]));
- if (otherUser == null)
+ toggleOtherPlayers(server, user, args);
+ return;
+ }
+
+ user.sendMessage(user.toggleTeleportEnabled() ? _("teleportationEnabled") : _("teleportationDisabled"));
+ }
+
+ private void toggleOtherPlayers(final Server server, final CommandSender sender, final String[] args)
+ {
+ for (Player matchPlayer : server.matchPlayer(args[0]))
+ {
+ final User player = ess.getUser(matchPlayer);
+ if (player.isHidden())
+ {
+ continue;
+ }
+
+ if (args.length > 1)
+ {
+ if (args[1].contains("on") || args[1].contains("ena") || args[1].equalsIgnoreCase("1"))
{
- throw new Exception(_("playerNotFound"));
+ player.setTeleportEnabled(true);
}
else
{
- ess.getUser(server.getPlayer(args[0])).sendMessage(user.toggleTeleportEnabled()
- ? _("teleportationEnabled")
- : _("teleportationDisabled"));
+ player.setTeleportEnabled(false);
}
- }
- else
- {
- user.sendMessage(user.toggleTeleportEnabled()
- ? _("teleportationEnabled")
- : _("teleportationDisabled"));
+ }
+ else
+ {
+ player.toggleTeleportEnabled();
+ }
+
+ final boolean enabled = player.isTeleportEnabled();
+
+
+ player.sendMessage(enabled ? _("teleportationEnabled") : _("teleportationDisabled"));
+ sender.sendMessage(enabled ? _("teleportationEnabledFor", matchPlayer.getDisplayName()) : _("teleportationDisabledFor", matchPlayer.getDisplayName()));
}
}
}
diff --git a/Essentials/src/messages.properties b/Essentials/src/messages.properties
index ea780bb03..c7170ae0b 100644
--- a/Essentials/src/messages.properties
+++ b/Essentials/src/messages.properties
@@ -460,3 +460,5 @@ gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00
invalidHomeName=\u00a74Invalid home name
invalidWarpName=\u00a74Invalid warp name
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.
+teleportationEnabledFor=\u00a76Teleportation enabled for {0}
+teleportationDisabledFor=\u00a76Teleportation disabled for {0}
diff --git a/Essentials/src/messages_cs.properties b/Essentials/src/messages_cs.properties
index f8eccb7f9..6eef42338 100644
--- a/Essentials/src/messages_cs.properties
+++ b/Essentials/src/messages_cs.properties
@@ -463,3 +463,5 @@ gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00
invalidHomeName=\u00a74Invalid home name
invalidWarpName=\u00a74Invalid warp name
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.
+teleportationEnabledFor=\u00a76Teleportation enabled for {0}
+teleportationDisabledFor=\u00a76Teleportation disabled for {0}
diff --git a/Essentials/src/messages_da.properties b/Essentials/src/messages_da.properties
index 06339f3b6..45329febb 100644
--- a/Essentials/src/messages_da.properties
+++ b/Essentials/src/messages_da.properties
@@ -460,3 +460,5 @@ gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00
invalidHomeName=\u00a74Invalid home name
invalidWarpName=\u00a74Invalid warp name
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.
+teleportationEnabledFor=\u00a76Teleportation enabled for {0}
+teleportationDisabledFor=\u00a76Teleportation disabled for {0}
diff --git a/Essentials/src/messages_de.properties b/Essentials/src/messages_de.properties
index 487fbf85b..b8f087cd7 100644
--- a/Essentials/src/messages_de.properties
+++ b/Essentials/src/messages_de.properties
@@ -460,3 +460,5 @@ gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00
invalidHomeName=\u00a74Invalid home name
invalidWarpName=\u00a74Invalid warp name
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.
+teleportationEnabledFor=\u00a76Teleportation enabled for {0}
+teleportationDisabledFor=\u00a76Teleportation disabled for {0}
diff --git a/Essentials/src/messages_en.properties b/Essentials/src/messages_en.properties
index ea780bb03..c7170ae0b 100644
--- a/Essentials/src/messages_en.properties
+++ b/Essentials/src/messages_en.properties
@@ -460,3 +460,5 @@ gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00
invalidHomeName=\u00a74Invalid home name
invalidWarpName=\u00a74Invalid warp name
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.
+teleportationEnabledFor=\u00a76Teleportation enabled for {0}
+teleportationDisabledFor=\u00a76Teleportation disabled for {0}
diff --git a/Essentials/src/messages_es.properties b/Essentials/src/messages_es.properties
index cd6d1208c..a2dec7c90 100644
--- a/Essentials/src/messages_es.properties
+++ b/Essentials/src/messages_es.properties
@@ -251,7 +251,7 @@ noPendingRequest=No tienes ninguna peticion pendiente.
noPerm=\u00a7cNo tienes el permiso de \u00a7f{0}\u00a7c.
noPermToSpawnMob=\u00a7cNo tienes permisos para spawnear a este mob.
noPlacePermission=\u00a7cNo tienes permiso para situar ese bloque en ese lugar.
-noPowerTools=Usted no tiene ningunas herramientas eléctricas asignadas.
+noPowerTools=Usted no tiene ningunas herramientas el\u00c3\u00a9ctricas asignadas.
noRules=\u00a7cNo hay reglas especificadas todavia.
noWarpsDefined=No hay teletransportes definidos aun.
none=ninguno
@@ -448,7 +448,7 @@ youHaveNewMail=\u00a7cTienes {0} mensajes!\u00a7f Pon \u00a77/mail read\u00a7f p
posX=\u00a76X: {0} (+Este <-> -Oeste)
posY=\u00a76Y: {0} (+Arriba <-> -abajo)
posZ=\u00a76Z: {0} (+Sur <-> -Norte)
-posYaw=\u00a76guiñar: {0} (Rotacion)
+posYaw=\u00a76gui\u00c3\u00b1ar: {0} (Rotacion)
posPitch=\u00a76Tono: {0} (Angulo de cabeza)
distance=\u00a76Distancia: {0}
giveSpawn=\u00a76Se a dado\u00a7c {0} \u00a76de\u00a7c {1} a\u00a7c {2}\u00a76.
@@ -460,3 +460,5 @@ gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00
invalidHomeName=\u00a74Nombre de casa invalido
invalidWarpName=\u00a74Nombre de warp invalido
userUnknown=\u00a74Peligro: El jugador '\u00a7c{0}\u00a74' Nunca a ingresado a este servidor.
+teleportationEnabledFor=\u00a76Teleportation enabled for {0}
+teleportationDisabledFor=\u00a76Teleportation disabled for {0}
diff --git a/Essentials/src/messages_fi.properties b/Essentials/src/messages_fi.properties
index 3ff85ebfb..ff9df7257 100644
--- a/Essentials/src/messages_fi.properties
+++ b/Essentials/src/messages_fi.properties
@@ -460,3 +460,5 @@ gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00
invalidHomeName=\u00a74Invalid home name
invalidWarpName=\u00a74Invalid warp name
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.
+teleportationEnabledFor=\u00a76Teleportation enabled for {0}
+teleportationDisabledFor=\u00a76Teleportation disabled for {0}
diff --git a/Essentials/src/messages_fr.properties b/Essentials/src/messages_fr.properties
index 605c0b884..fb858afe2 100644
--- a/Essentials/src/messages_fr.properties
+++ b/Essentials/src/messages_fr.properties
@@ -35,7 +35,7 @@ burnMsg=\u00a77Vous avez enflamm\u00e9 {0} pour {1} seconde(s).
canTalkAgain=\u00a77Vous pouvez de nouveau parler.
cantFindGeoIpDB=N'arrive pas \u00e0 trouver la base de donn\u00e9es GeoIP!
cantReadGeoIpDB=Echec de la lecture de la base de donn\u00e9es GeoIP!
-cantSpawnItem=\u00a7cVous n''avez pas le droit de faire appara\u00eEtre {0}
+cantSpawnItem=\u00a7cVous n''avez pas le droit de faire appara\u00eetre {0}
chatTypeAdmin=[A]
chatTypeLocal=[L]
chatTypeSpy=[Spy]
@@ -91,7 +91,7 @@ essentialsHelp2=Le fichier est corrompuet Essentials ne peut l'ouvrir. Essential
essentialsReload=\u00a77Essentials {0} a \u00e9t\u00e9 recharg\u00e9.
exp=\u00a7c{0} \u00a77a\u00a7c {1} \u00a77exp (niveau\u00a7c {2}\u00a77) et a besoin de\u00a7c {3} \u00a77pour monter d'un niveau.
expSet=\u00a7c{0} \u00a77a maintenant\u00a7c {1} \u00a77exp.
-extinguish=\u00a77Vous cessez de br\u00FBler.
+extinguish=\u00a77Vous cessez de br\u00fbler.
extinguishOthers=\u00a77Vous avez \u00e9teint la combustion de {0}.
failedToCloseConfig=Echec de la fermeture de la configuration {0}
failedToCreateConfig=Echec de la cr\u00e9ation de la configuration {0}
@@ -142,7 +142,7 @@ 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=\u00a7e ---- \u00a76{2} \u00a7e--\u00a76 Page \u00a74{0}\u00a76/\u00a74{1} \u00a7e----
infoUnknownChapter=Chapitre inconnu.
-invBigger=Les inventaires des autres joueurs sont plus gros que le v\u00F4tre.
+invBigger=Les inventaires des autres joueurs sont plus gros que le v\u00f4tre.
invRestored=Votre inventaire vous a \u00e9t\u00e9 rendu.
invSee=Vous voyez l''inventaire de {0}.
invSeeHelp=Utilisez /invsee pour revenir \u00e0 votre inventaire.
@@ -459,4 +459,6 @@ antiBuildDrop=\u00a74Vous n'\u00eates pas autoris\u00e9s \u00e0 jeter\u00a7c {0}
gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 portions, \u00a7c{3}\u00a76 entit\u00e9s
invalidHomeName=\u00a74Nom de r\u00e9sindence invalide
invalidWarpName=\u00a74Nom de warp invalide
-userUnknown=\u00a74Attention : Le joueur '\u00a7c{0}\u00a74' n'est jamais venu sur ce serveur. \ No newline at end of file
+userUnknown=\u00a74Attention : Le joueur '\u00a7c{0}\u00a74' n'est jamais venu sur ce serveur.
+teleportationEnabledFor=\u00a76Teleportation enabled for {0}
+teleportationDisabledFor=\u00a76Teleportation disabled for {0}
diff --git a/Essentials/src/messages_it.properties b/Essentials/src/messages_it.properties
index 5f414f6ee..901433e83 100644
--- a/Essentials/src/messages_it.properties
+++ b/Essentials/src/messages_it.properties
@@ -460,3 +460,5 @@ gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00
invalidHomeName=\u00a74Invalid home name
invalidWarpName=\u00a74Invalid warp name
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.
+teleportationEnabledFor=\u00a76Teleportation enabled for {0}
+teleportationDisabledFor=\u00a76Teleportation disabled for {0}
diff --git a/Essentials/src/messages_nl.properties b/Essentials/src/messages_nl.properties
index 2b49d17bb..aeaa048b4 100644
--- a/Essentials/src/messages_nl.properties
+++ b/Essentials/src/messages_nl.properties
@@ -460,3 +460,5 @@ gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00
invalidHomeName=\u00a74Invalid home name
invalidWarpName=\u00a74Invalid warp name
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.
+teleportationEnabledFor=\u00a76Teleportation enabled for {0}
+teleportationDisabledFor=\u00a76Teleportation disabled for {0}
diff --git a/Essentials/src/messages_pl.properties b/Essentials/src/messages_pl.properties
index 24884d9d6..094a22663 100644
--- a/Essentials/src/messages_pl.properties
+++ b/Essentials/src/messages_pl.properties
@@ -460,3 +460,5 @@ gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00
invalidHomeName=\u00a74Invalid home name
invalidWarpName=\u00a74Invalid warp name
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.
+teleportationEnabledFor=\u00a76Teleportation enabled for {0}
+teleportationDisabledFor=\u00a76Teleportation disabled for {0}
diff --git a/Essentials/src/messages_pt.properties b/Essentials/src/messages_pt.properties
index cdb544026..513bf2f4d 100644
--- a/Essentials/src/messages_pt.properties
+++ b/Essentials/src/messages_pt.properties
@@ -460,3 +460,5 @@ gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00
invalidHomeName=\u00a74Invalid home name
invalidWarpName=\u00a74Invalid warp name
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.
+teleportationEnabledFor=\u00a76Teleportation enabled for {0}
+teleportationDisabledFor=\u00a76Teleportation disabled for {0}
diff --git a/Essentials/src/messages_se.properties b/Essentials/src/messages_se.properties
index de1061753..75d175330 100644
--- a/Essentials/src/messages_se.properties
+++ b/Essentials/src/messages_se.properties
@@ -460,3 +460,5 @@ gcWorld=\u00a76{0} "\u00a7c{1}\u00a76": \u00a7c{2}\u00a76 chunks, \u00a7c{3}\u00
invalidHomeName=\u00a74Invalid home name
invalidWarpName=\u00a74Invalid warp name
userUnknown=\u00a74Warning: The user '\u00a7c{0}\u00a74' has never joined this server.
+teleportationEnabledFor=\u00a76Teleportation enabled for {0}
+teleportationDisabledFor=\u00a76Teleportation disabled for {0}
diff --git a/Essentials/src/plugin.yml b/Essentials/src/plugin.yml
index c24c4de30..95c7e943a 100644
--- a/Essentials/src/plugin.yml
+++ b/Essentials/src/plugin.yml
@@ -404,7 +404,7 @@ commands:
aliases: [etppos]
tptoggle:
description: Blocks all forms of teleportation.
- usage: /<command>
+ usage: /<command> [player [on|off]]
aliases: [etptoggle]
tree:
description: Spawn a tree where you are looking.