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

44 lines
1.2 KiB
Java
Raw Normal View History

package com.earth2me.essentials.commands;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.User;
2013-03-25 14:18:09 +00:00
import org.bukkit.command.CommandSender;
import org.bukkit.Server;
public class Commandsocialspy extends EssentialsCommand
{
public Commandsocialspy()
{
super("socialspy");
}
@Override
2011-12-01 13:42:39 +00:00
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
{
if (args.length > 0 && user.isAuthorized("essentials.socialspy.others"))
2013-03-25 14:18:09 +00:00
{
User target = getPlayer(server, user, args, 0);
user.sendMessage(_("socialSpy", target.getDisplayName(), target.toggleSocialSpy() ? _("enabled") : _("disabled")));
2013-03-25 14:18:09 +00:00
}
else
{
user.sendMessage(_("socialSpy", user.getDisplayName(), user.toggleSocialSpy() ? _("enabled") : _("disabled")));
2013-03-25 14:18:09 +00:00
}
}
2013-03-25 14:18:09 +00:00
@Override
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
{
if (args.length > 0)
2013-03-25 14:18:09 +00:00
{
User target = getPlayer(server, args, 0, true, false);
sender.sendMessage(_("socialSpy", target.getDisplayName(), target.toggleSocialSpy() ? _("enabled") : _("disabled")));
2013-03-25 14:18:09 +00:00
}
else
{
throw new NotEnoughArgumentsException();
}
}
}