2012-05-17 10:25:02 +00:00
|
|
|
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
|
2012-06-16 13:02:13 +00:00
|
|
|
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
2012-05-17 10:25:02 +00:00
|
|
|
{
|
2012-06-15 09:02:04 +00:00
|
|
|
if (args.length < 1)
|
2012-05-17 10:25:02 +00:00
|
|
|
{
|
2012-06-16 12:53:46 +00:00
|
|
|
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
|
|
|
}
|
2012-05-17 10:25:02 +00:00
|
|
|
}
|
2012-06-16 12:53:46 +00:00
|
|
|
else
|
2012-05-17 10:25:02 +00:00
|
|
|
{
|
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
|
|
|
{
|
2012-06-16 12:53:46 +00:00
|
|
|
user.setVanished(true);
|
2012-06-15 09:02:04 +00:00
|
|
|
}
|
2012-06-16 12:53:46 +00:00
|
|
|
else
|
2012-06-15 09:02:04 +00:00
|
|
|
{
|
2012-06-16 12:53:46 +00:00
|
|
|
user.setVanished(false);
|
2012-06-15 09:02:04 +00:00
|
|
|
}
|
2012-06-16 12:53:46 +00:00
|
|
|
user.sendMessage(user.isVanished() ? _("vanished") : _("unvanished"));
|
2012-05-17 10:25:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|