diff options
Diffstat (limited to 'Essentials/src/com/earth2me/essentials/commands/Commandvanish.java')
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandvanish.java | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandvanish.java b/Essentials/src/com/earth2me/essentials/commands/Commandvanish.java new file mode 100644 index 000000000..ea051e4be --- /dev/null +++ b/Essentials/src/com/earth2me/essentials/commands/Commandvanish.java @@ -0,0 +1,43 @@ +package com.earth2me.essentials.commands; + +import static com.earth2me.essentials.I18n._; +import com.earth2me.essentials.User; +import org.bukkit.Server; + + +public class Commandvanish extends EssentialsCommand +{ + public Commandvanish() + { + super("vanish"); + } + + @Override + protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception + { + if (args.length < 1) + { + user.toggleVanished(); + if (user.isVanished()) + { + user.sendMessage(_("vanished")); + } + else + { + user.sendMessage(_("unvanished")); + } + } + 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")); + } + } +} |