Allow toggling vanish for other players

Permission: essentials.vanish.others
This commit is contained in:
KHobbits 2013-08-11 21:48:30 +01:00
parent 8b11b870b1
commit fb9fc579d0
19 changed files with 60 additions and 54 deletions

View File

@ -3,42 +3,65 @@ 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;
public class Commandvanish extends EssentialsCommand
public class Commandvanish extends EssentialsToggleCommand
{
public Commandvanish()
{
super("vanish");
super("vanish", "essentials.vanish.others");
}
@Override
protected void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
{
toggleOtherPlayers(server, sender, args);
}
@Override
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
if (args.length < 1)
if (args.length == 1)
{
if (user.isVanished())
Boolean toggle = matchToggleArgument(args[0]);
if (toggle == null && user.isAuthorized(othersPermission))
{
user.setVanished(false);
user.sendMessage(_("unvanished"));
toggleOtherPlayers(server, user.getBase(), args);
}
else
{
user.setVanished(true);
user.sendMessage(_("vanished"));
togglePlayer(user.getBase(), user, toggle);
}
}
else if (args.length == 2 && user.isAuthorized(othersPermission))
{
toggleOtherPlayers(server, user.getBase(), args);
}
else
{
if (args[0].contains("on") || args[0].contains("ena") || args[0].equalsIgnoreCase("1"))
{
user.setVanished(true);
}
else
{
user.setVanished(false);
}
user.sendMessage(user.isVanished() ? _("vanished") : _("unvanished"));
togglePlayer(user.getBase(), user, null);
}
}
}
@Override
void togglePlayer(CommandSender sender, User user, Boolean enabled) throws NotEnoughArgumentsException
{
if (enabled == null)
{
enabled = !user.isVanished();
}
user.setVanished(enabled);
user.sendMessage(_("vanish", user.getDisplayName(), enabled ? _("enabled") : _("disabled")));
if (enabled == true)
{
user.sendMessage(_("vanished"));
}
if (!sender.equals(user.getBase()))
{
sender.sendMessage(_("vanish", user.getDisplayName(), enabled ? _("enabled") : _("disabled")));
}
}
}

View File

@ -452,7 +452,6 @@ unknownItemName=\u00a74Unknown item name\: {0}.
unlimitedItemPermission=\u00a74No permission for unlimited item {0}.
unlimitedItems=\u00a76Unlimited items\:\u00a7r
unmutedPlayer=\u00a76Player\u00a7c {0} \u00a76unmuted.
unvanished=\u00a76You are once again visible.
unvanishedReload=\u00a74A reload has forced you to become visible.
upgradingFilesError=Error while upgrading the files.
uptime=\u00a76Uptime\:\u00a7c {0}
@ -522,4 +521,5 @@ totalSellableAll=\u00a7aThe total worth of all sellable items and blocks is \u00
totalSellableBlocks=\u00a7aThe total worth of all sellable blocks is \u00a7c{1}\u00a7a.
radiusTooBig=\u00a74Radius is too big\! Maximum radius is {0}.
isIpBanned=\u00a76IP \u00a7c{0} \u00a76is banned.
mobDataList=\u00a76Valid mob data\:\u00a7r {0}
mobDataList=\u00a76Valid mob data\:\u00a7r {0}
vanish=\u00a76Vanish for {0}\u00a76\: {1}

View File

@ -457,7 +457,6 @@ unknownItemName=Neznamy nazev itemu\: {0}
unlimitedItemPermission=\u00a7cNemas opravneni pro neomezeny item\: {0}.
unlimitedItems=Neomezene itemy\:
unmutedPlayer=Hrac {0} byl umlcen.
unvanished=\u00a76Uz jsi zase videt.
unvanishedReload=\u00a74A reload te zase zviditelni.
upgradingFilesError=Chyba pri updatovani souboru.
uptime=\u00a76Server je online\:\u00a7c {0}
@ -528,4 +527,4 @@ totalSellableBlocks=\u00a7aThe total worth of all sellable blocks is \u00a7c{1}\
radiusTooBig=\u00a74Radius is too big\! Maximum radius is {0}.
isIpBanned=\u00a76IP \u00a7c{0} \u00a76is banned.
mobDataList=\u00a76Valid mob data\:\u00a7r {0}
vanish=\u00a76Vanish for {0}\u00a76\: {1}

View File

@ -452,7 +452,6 @@ unknownItemName=Ukendt ting navn\: {0}
unlimitedItemPermission=\u00a7cIngen tilladelse til ubegr\u00e6nset ting {0}.
unlimitedItems=Ubegr\u00c3\u00a6nsede ting\:
unmutedPlayer=Spilleren {0} unmuted.
unvanished=\u00a76You are once again visible.
unvanishedReload=\u00a74A reload has forced you to become visible.
upgradingFilesError=Fejl under opgradering af filerne.
uptime=\u00a76Uptime\:\u00a7c {0}
@ -523,4 +522,4 @@ totalSellableBlocks=\u00a7aThe total worth of all sellable blocks is \u00a7c{1}\
radiusTooBig=\u00a74Radius is too big\! Maximum radius is {0}.
isIpBanned=\u00a76IP \u00a7c{0} \u00a76is banned.
mobDataList=\u00a76Valid mob data\:\u00a7r {0}
vanish=\u00a76Vanish for {0}\u00a76\: {1}

View File

@ -452,7 +452,6 @@ unknownItemName=\u00a74Unbekannter Gegenstand\: {0}.
unlimitedItemPermission=\u00a74Du hast keine Rechte f\u00fcr unendlich {0}.
unlimitedItems=\u00a76Unendliche Objekte\:\u00a7r
unmutedPlayer=\u00a76Spieler\u00a7c {0}\u00a76 ist nicht mehr stumm.
unvanished=\u00a76Du bist wieder sichtbar.
unvanishedReload=\u00a74Ein Neuladen des Servers hat dich sichtbar gemacht.
upgradingFilesError=Fehler beim Aktualisieren der Dateien
uptime=\u00a76Laufzeit\:\u00a7c {0}
@ -523,4 +522,4 @@ totalSellableBlocks=\u00a7aThe total worth of all sellable blocks is \u00a7c{1}\
radiusTooBig=\u00a74Radius is too big\! Maximum radius is {0}.
isIpBanned=\u00a76IP \u00a7c{0} \u00a76is banned.
mobDataList=\u00a76Valid mob data\:\u00a7r {0}
vanish=\u00a76Vanish for {0}\u00a76\: {1}

View File

@ -452,7 +452,6 @@ unknownItemName=\u00a74Unknown item name\: {0}.
unlimitedItemPermission=\u00a74No permission for unlimited item {0}.
unlimitedItems=\u00a76Unlimited items\:\u00a7r
unmutedPlayer=\u00a76Player\u00a7c {0} \u00a76unmuted.
unvanished=\u00a76You are once again visible.
unvanishedReload=\u00a74A reload has forced you to become visible.
upgradingFilesError=Error while upgrading the files.
uptime=\u00a76Uptime\:\u00a7c {0}
@ -523,4 +522,4 @@ totalSellableBlocks=\u00a7aThe total worth of all sellable blocks is \u00a7c{1}\
radiusTooBig=\u00a74Radius is too big\! Maximum radius is {0}.
isIpBanned=\u00a76IP \u00a7c{0} \u00a76is banned.
mobDataList=\u00a76Valid mob data\:\u00a7r {0}
vanish=\u00a76Vanish for {0}\u00a76\: {1}

View File

@ -452,7 +452,6 @@ unknownItemName=Nombre de objeto desconocido\: {0}
unlimitedItemPermission=\u00a7cNo tienes permiso para objetos ilimitados {0}.
unlimitedItems=Objetos ilimitados.
unmutedPlayer=Jugador {0} desmuteado.
unvanished=\u00a7aEres visible nuevamente.
unvanishedReload=\u00a7cUn reinicio te ha forzado a ser visible.
upgradingFilesError=Error mientras se actualizaban los archivos
uptime=\u00a76Uptime\:\u00a7c {0}
@ -523,4 +522,4 @@ totalSellableBlocks=\u00a7aThe total worth of all sellable blocks is \u00a7c{1}\
radiusTooBig=\u00a74Radius is too big\! Maximum radius is {0}.
isIpBanned=\u00a76IP \u00a7c{0} \u00a76is banned.
mobDataList=\u00a76Valid mob data\:\u00a7r {0}
vanish=\u00a76Vanish for {0}\u00a76\: {1}

View File

@ -452,7 +452,6 @@ unknownItemName=Tuntematon tavaran nimi\: {0}
unlimitedItemPermission=\u00a7cEi lupaa loputtomalle tavaralle {0}.
unlimitedItems=Loputtomat tavarat\:
unmutedPlayer=Pelaajat {0} voi taas puhua.
unvanished=\u00a7aOlet taas n\u00e4kyvill\u00e4.
unvanishedReload=\u00a7cSinut on pakotettu taas n\u00e4kyv\u00e4ksi uudelleen latauksen vuoksi.
upgradingFilesError=Virhe p\u00e4ivitett\u00e4ess\u00e4 tiedostoja
uptime=\u00a76Uptime\:\u00a7c {0}
@ -523,4 +522,4 @@ totalSellableBlocks=\u00a7aThe total worth of all sellable blocks is \u00a7c{1}\
radiusTooBig=\u00a74Radius is too big\! Maximum radius is {0}.
isIpBanned=\u00a76IP \u00a7c{0} \u00a76is banned.
mobDataList=\u00a76Valid mob data\:\u00a7r {0}
vanish=\u00a76Vanish for {0}\u00a76\: {1}

View File

@ -452,7 +452,6 @@ unknownItemName=Nom d''objet inconnu \: {0}
unlimitedItemPermission=\u00a7cPas de permission pour l''objet illimit\u00e9 {0}.
unlimitedItems=Objets illimit\u00e9s \:
unmutedPlayer=Le joueur {0} n''est plus muet.
unvanished=\u00a7aVous \u00eates de nouveau visible.
unvanishedReload=\u00a7cUn reload vous a rendu de nouveau visible.
upgradingFilesError=Erreur durant la mise \u00e0 jour des fichiers.
uptime=\u00a76Dur\u00e9e de fonctionnement \:\u00a7c {0}
@ -523,4 +522,4 @@ totalSellableBlocks=\u00a7aThe total worth of all sellable blocks is \u00a7c{1}\
radiusTooBig=\u00a74Radius is too big\! Maximum radius is {0}.
isIpBanned=\u00a76IP \u00a7c{0} \u00a76is banned.
mobDataList=\u00a76Valid mob data\:\u00a7r {0}
vanish=\u00a76Vanish for {0}\u00a76\: {1}

View File

@ -452,7 +452,6 @@ unknownItemName=Nome oggetto sconosciuto\: {0}
unlimitedItemPermission=\u00a7cNessun permesso per l''oggetto {0} illimitato.
unlimitedItems=Oggetti illimitati\:
unmutedPlayer=Player {0} smutato.
unvanished=\u00a76You are once again visible.
unvanishedReload=\u00a74A reload has forced you to become visible.
upgradingFilesError=Errore durante l''aggiornamento dei file
uptime=\u00a76Uptime\:\u00a7c {0}
@ -523,4 +522,4 @@ totalSellableBlocks=\u00a7aThe total worth of all sellable blocks is \u00a7c{1}\
radiusTooBig=\u00a74Radius is too big\! Maximum radius is {0}.
isIpBanned=\u00a76IP \u00a7c{0} \u00a76is banned.
mobDataList=\u00a76Valid mob data\:\u00a7r {0}
vanish=\u00a76Vanish for {0}\u00a76\: {1}

View File

@ -452,7 +452,6 @@ unknownItemName=Onbekende voorwerp naam\: {0}
unlimitedItemPermission=\u00a7cOnbevoegd om oneindig {0} te hebben.
unlimitedItems=Oneindige voorwerpen\:
unmutedPlayer=Speler {0} mag weer spreken.
unvanished=\u00a7aU bent weer zichtbaar.
unvanishedReload=\u00a7cEen herlading heeft je geforceerd om zichtbaar te worden.
upgradingFilesError=Fout tijdens het upgraden van de bestanden.
uptime=\u00a76Tijd dat de server aanstaat\:\u00a7c {0}
@ -523,4 +522,4 @@ totalSellableBlocks=\u00a7aThe total worth of all sellable blocks is \u00a7c{1}\
radiusTooBig=\u00a74Radius is too big\! Maximum radius is {0}.
isIpBanned=\u00a76IP \u00a7c{0} \u00a76is banned.
mobDataList=\u00a76Valid mob data\:\u00a7r {0}
vanish=\u00a76Vanish for {0}\u00a76\: {1}

View File

@ -452,7 +452,6 @@ unknownItemName=\u00a74Nieznana nazwa przedmiotu\: {0}.
unlimitedItemPermission=\u00a74Brak uprawnien dla nielimitowanego przedmiotu {0}.
unlimitedItems=\u00a77Nielimitowane przedmioty\:\u00a7r
unmutedPlayer=\u00a77Gracz\u00a7c {0} \u00a77moze znowu mowic.
unvanished=\u00a77Znow jestes widoczny.
unvanishedReload=\u00a74Przeladowanie spowodowalo ze cie widac.
upgradingFilesError=Wystapil blad podczas aktualizowaniu plikow.
uptime=\u00a77Aktywny od\:\u00a7c {0}
@ -523,4 +522,4 @@ totalSellableBlocks=\u00a7aThe total worth of all sellable blocks is \u00a7c{1}\
radiusTooBig=\u00a74Radius is too big\! Maximum radius is {0}.
isIpBanned=\u00a76IP \u00a7c{0} \u00a76is banned.
mobDataList=\u00a76Valid mob data\:\u00a7r {0}
vanish=\u00a76Vanish for {0}\u00a76\: {1}

View File

@ -452,7 +452,6 @@ unknownItemName=\u00a74Nome de item desconhecido\: {0}.
unlimitedItemPermission=\u00a74Nenhuma permissao para itens ilimitados de {0}.
unlimitedItems=\u00a76Itens ilimitados\:\u00a7r
unmutedPlayer=\u00a76Jogador\u00a7c {0} \u00a76nao est\u00c3\u00a1 mais silenciado.
unvanished=\u00a76Voc\u00c3\u00aa est\u00c3\u00a1 vis\u00c3\u00advel novamente.
unvanishedReload=\u00a74Um reload for\u00c3\u00a7ou-lhe a ficar vis\u00c3\u00advel novamente.
upgradingFilesError=Erro ao aprimorar os arquivos.
uptime=\u00a76Uptime\:\u00a7c {0}
@ -523,4 +522,4 @@ totalSellableBlocks=\u00a7aThe total worth of all sellable blocks is \u00a7c{1}\
radiusTooBig=\u00a74Radius is too big\! Maximum radius is {0}.
isIpBanned=\u00a76IP \u00a7c{0} \u00a76is banned.
mobDataList=\u00a76Valid mob data\:\u00a7r {0}
vanish=\u00a76Vanish for {0}\u00a76\: {1}

View File

@ -452,7 +452,6 @@ unknownItemName=\u00a74Nume obiect necunoscut\: {0}.
unlimitedItemPermission=\u00a74Nu ai permissiunea pentru obiecte nelimitate {0}.
unlimitedItems=\u00a76Obiecte nelimitate\:\u00a7r
unmutedPlayer=\u00a76Jucatorul\u00a7c {0} \u00a76are voie sa vorbeasca.
unvanished=\u00a76Esti din nou vizibil.
unvanishedReload=\u00a74O reincarcare te-a fortat sa devii din nou vizibil.
upgradingFilesError=Eroare urcand fisierele.
uptime=\u00a76Uptime\:\u00a7c {0}
@ -523,4 +522,4 @@ totalSellableBlocks=\u00a7aThe total worth of all sellable blocks is \u00a7c{1}\
radiusTooBig=\u00a74Radius is too big\! Maximum radius is {0}.
isIpBanned=\u00a76IP \u00a7c{0} \u00a76is banned.
mobDataList=\u00a76Valid mob data\:\u00a7r {0}
vanish=\u00a76Vanish for {0}\u00a76\: {1}

View File

@ -452,7 +452,6 @@ unknownItemName=\u00a74\u041d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u0
unlimitedItemPermission=\u00a74\u041d\u0435\u0442 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043d\u0435\u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u0430 {0}.
unlimitedItems=\u00a76\u0411\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0435 \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u044b\:\u00a7r
unmutedPlayer=\u00a76\u0418\u0433\u0440\u043e\u043a\u0443\u00a7c {0} \u00a76\u0432\u0435\u0440\u043d\u0443\u043b\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u0449\u0430\u0442\u044c\u0441\u044f.
unvanished=\u00a76\u0412\u044b \u043e\u043f\u044f\u0442\u044c \u0432\u0438\u0434\u0438\u043c\u044b.
unvanishedReload=\u00a74\u041f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a \u0441\u0434\u0435\u043b\u0430\u043b \u0432\u0430\u0441 \u0432\u0438\u0434\u0438\u043c\u044b\u043c.
upgradingFilesError=\u041e\u0448\u0438\u0431\u043a\u0430 \u043f\u0440\u0438 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438 \u0444\u0430\u0439\u043b\u043e\u0432.
uptime=\u00a76\u0418\u0433\u0440\u043e\u0432\u043e\u0435 \u0432\u0440\u0435\u043c\u044f\:\u00a7c {0}
@ -523,4 +522,4 @@ totalSellableBlocks=\u00a7aThe total worth of all sellable blocks is \u00a7c{1}\
radiusTooBig=\u00a74Radius is too big\! Maximum radius is {0}.
isIpBanned=\u00a76IP \u00a7c{0} \u00a76is banned.
mobDataList=\u00a76Valid mob data\:\u00a7r {0}
vanish=\u00a76Vanish for {0}\u00a76\: {1}

View File

@ -452,7 +452,6 @@ unknownItemName=Ok\u00e4nt objektnamn\: {0}
unlimitedItemPermission=\u00a7cInget tillst\u00e5nd f\u00f6r obegr\u00e4nsad tillg\u00e5ng av {0}.
unlimitedItems=Obegr\u00e4nsade objekt\:
unmutedPlayer=Spelaren {0} \u00e4r inte bannlyst l\u00e4ngre.
unvanished=\u00a7aDu \u00e4r synlig igen.
unvanishedReload=\u00a7cEn omladdning har tvingat dig att bli synlig.
upgradingFilesError=Fel vid uppgradering av filerna
uptime=\u00a76Upptid\:\u00a7c {0}
@ -523,4 +522,4 @@ totalSellableBlocks=\u00a7aThe total worth of all sellable blocks is \u00a7c{1}\
radiusTooBig=\u00a74Radius is too big\! Maximum radius is {0}.
isIpBanned=\u00a76IP \u00a7c{0} \u00a76is banned.
mobDataList=\u00a76Valid mob data\:\u00a7r {0}
vanish=\u00a76Vanish for {0}\u00a76\: {1}

View File

@ -452,7 +452,6 @@ unknownItemName=\u00a74\u672a\u77e5\u7684\u7269\u54c1\u540d\u79f0\:{0}
unlimitedItemPermission=\u00a74\u6ca1\u6709\u6743\u9650\u6765\u4f7f\u8be5\u7269\u54c1\u65e0\u9650 {0}
unlimitedItems=\u00a76\u65e0\u9650\u7269\u54c1\:
unmutedPlayer=\u00a76\u73a9\u5bb6 \u00a7c{0}\u00a76 \u88ab\u5141\u8bb8\u53d1\u8a00
unvanished=\u00a76\u5df2\u9000\u51fa\u9690\u8eab\u6a21\u5f0f.
unvanishedReload=\u00a74\u63d2\u4ef6\u91cd\u8f7d\u8feb\u4f7f\u4f60\u7684\u9690\u8eab\u6a21\u5f0f\u5931\u6548.
upgradingFilesError=\u5347\u7ea7\u6587\u4ef6\u65f6\u53d1\u751f\u9519\u8bef
uptime=\u00a76\u8fd0\u884c\u65f6\u95f4\:\u00a7c {0}
@ -523,4 +522,4 @@ totalSellableBlocks=\u00a7aThe total worth of all sellable blocks is \u00a7c{1}\
radiusTooBig=\u00a74Radius is too big\! Maximum radius is {0}.
isIpBanned=\u00a76IP \u00a7c{0} \u00a76is banned.
mobDataList=\u00a76Valid mob data\:\u00a7r {0}
vanish=\u00a76Vanish for {0}\u00a76\: {1}

View File

@ -452,7 +452,6 @@ unknownItemName=\u00a74\u672a\u77e5\u7684\u7269\u54c1\u540d\u7a31\:{0}
unlimitedItemPermission=\u00a74\u6c92\u6709\u6b0a\u9650\u4f86\u4f7f\u8a72\u7269\u54c1\u7121\u9650 {0}
unlimitedItems=\u00a76\u7121\u9650\u7269\u54c1\:
unmutedPlayer=\u00a76\u73a9\u5bb6 \u00a7c{0}\u00a76 \u88ab\u5141\u8a31\u767c\u8a00
unvanished=\u00a76\u5df2\u9000\u51fa\u96b1\u8eab\u6a21\u5f0f.
unvanishedReload=\u00a74\u5916\u639b\u7a0b\u5f0f\u91cd\u8f09\u8feb\u4f7f\u4f60\u7684\u96b1\u8eab\u6a21\u5f0f\u5931\u6548.
upgradingFilesError=\u5347\u7d1a\u6587\u4ef6\u6642\u767c\u751f\u932f\u8aa4
uptime=\u00a76\u904b\u884c\u6642\u9593\:\u00a7c {0}
@ -523,4 +522,4 @@ totalSellableBlocks=\u00a7aThe total worth of all sellable blocks is \u00a7c{1}\
radiusTooBig=\u00a74Radius is too big\! Maximum radius is {0}.
isIpBanned=\u00a76IP \u00a7c{0} \u00a76is banned.
mobDataList=\u00a76Valid mob data\:\u00a7r {0}
vanish=\u00a76Vanish for {0}\u00a76\: {1}

View File

@ -452,7 +452,6 @@ unknownItemName=\u00a74\u672a\u77e5\u7684\u7269\u54c1\u540d\u7a31\:{0}
unlimitedItemPermission=\u00a74\u6c92\u6709\u8a31\u53ef\u6b0a\u4f86\u4f7f\u8a72\u7269\u54c1\u7121\u9650 {0}
unlimitedItems=\u00a76\u7121\u9650\u7269\u54c1\:
unmutedPlayer=\u00a76\u73a9\u5bb6 \u00a7c{0}\u00a76 \u88ab\u5141\u8a31\u767c\u8a00
unvanished=\u00a76\u5df2\u9000\u51fa\u96b1\u8eab\u6a21\u5f0f.
unvanishedReload=\u00a74\u5916\u639b\u7a0b\u5f0f\u91cd\u8f09\u8feb\u4f7f\u4f60\u7684\u96b1\u8eab\u6a21\u5f0f\u5931\u6548.
upgradingFilesError=\u5347\u7d1a\u6587\u4ef6\u6642\u767c\u751f\u932f\u8aa4
uptime=\u00a76\u904b\u884c\u6642\u9593\:\u00a7c {0}
@ -523,4 +522,4 @@ totalSellableBlocks=\u00a7aThe total worth of all sellable blocks is \u00a7c{1}\
radiusTooBig=\u00a74Radius is too big\! Maximum radius is {0}.
isIpBanned=\u00a76IP \u00a7c{0} \u00a76is banned.
mobDataList=\u00a76Valid mob data\:\u00a7r {0}
vanish=\u00a76Vanish for {0}\u00a76\: {1}