TF-EssentialsX/Essentials/src/com/earth2me/essentials/commands/Commandvanish.java

45 lines
888 B
Java
Raw Normal View History

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
{
2012-06-15 09:02:04 +00:00
if (args.length < 1)
{
if (user.isVanished())
2012-06-15 09:02:04 +00:00
{
2013-06-02 16:45:56 +00:00
user.setVanished(false);
user.sendMessage(_("unvanished"));
2012-06-15 09:02:04 +00:00
}
else
{
2013-06-02 16:45:56 +00:00
user.setVanished(true);
user.sendMessage(_("vanished"));
2012-06-15 09:02:04 +00:00
}
}
else
{
2012-06-18 14:35:21 +00:00
if (args[0].contains("on") || args[0].contains("ena") || args[0].equalsIgnoreCase("1"))
2012-06-15 09:02:04 +00:00
{
user.setVanished(true);
2012-06-15 09:02:04 +00:00
}
else
2012-06-15 09:02:04 +00:00
{
user.setVanished(false);
2012-06-15 09:02:04 +00:00
}
user.sendMessage(user.isVanished() ? _("vanished") : _("unvanished"));
}
}
}