2011-05-04 10:39:56 +00:00
|
|
|
package com.earth2me.essentials.commands;
|
2011-11-21 01:55:26 +00:00
|
|
|
|
|
|
|
import static com.earth2me.essentials.I18n._;
|
2011-05-04 10:39:56 +00:00
|
|
|
import com.earth2me.essentials.User;
|
2013-03-25 14:18:09 +00:00
|
|
|
import org.bukkit.command.CommandSender;
|
2011-05-04 10:39:56 +00:00
|
|
|
import org.bukkit.Server;
|
2011-05-04 14:23:22 +00:00
|
|
|
|
2011-05-04 10:39:56 +00:00
|
|
|
|
|
|
|
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
|
2011-05-04 10:39:56 +00:00
|
|
|
{
|
2013-03-25 14:05:35 +00:00
|
|
|
if (args.length > 0 && user.isAuthorized("essentials.socialspy.others"))
|
2013-03-25 14:18:09 +00:00
|
|
|
{
|
|
|
|
User target = getPlayer(server, user, args, 0);
|
2013-03-25 14:05:35 +00:00
|
|
|
user.sendMessage(_("socialSpy", target.getDisplayName(), target.toggleSocialSpy() ? _("enabled") : _("disabled")));
|
2013-03-25 14:18:09 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-03-25 14:05:35 +00:00
|
|
|
user.sendMessage(_("socialSpy", user.getDisplayName(), user.toggleSocialSpy() ? _("enabled") : _("disabled")));
|
2013-03-25 14:18:09 +00:00
|
|
|
}
|
|
|
|
}
|
2013-03-25 14:05:35 +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
|
|
|
|
{
|
2013-03-25 14:05:35 +00:00
|
|
|
if (args.length > 0)
|
2013-03-25 14:18:09 +00:00
|
|
|
{
|
|
|
|
User target = getPlayer(server, args, 0, true, false);
|
2013-03-25 14:05:35 +00:00
|
|
|
sender.sendMessage(_("socialSpy", target.getDisplayName(), target.toggleSocialSpy() ? _("enabled") : _("disabled")));
|
2013-03-25 14:18:09 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
throw new NotEnoughArgumentsException();
|
|
|
|
}
|
2011-05-04 10:39:56 +00:00
|
|
|
}
|
|
|
|
}
|