2011-05-04 10:39:56 +00:00
|
|
|
package com.earth2me.essentials.commands;
|
2011-11-21 01:55:26 +00:00
|
|
|
|
2013-10-16 19:59:39 +00:00
|
|
|
import com.earth2me.essentials.CommandSource;
|
2011-05-04 10:39:56 +00:00
|
|
|
import com.earth2me.essentials.User;
|
|
|
|
import org.bukkit.Server;
|
2011-05-04 14:23:22 +00:00
|
|
|
|
2015-04-15 04:06:16 +00:00
|
|
|
import static com.earth2me.essentials.I18n.tl;
|
2013-06-08 11:53:23 +00:00
|
|
|
|
|
|
|
|
2015-04-15 04:06:16 +00:00
|
|
|
public class Commandsocialspy extends EssentialsToggleCommand {
|
|
|
|
public Commandsocialspy() {
|
|
|
|
super("socialspy", "essentials.socialspy.others");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void run(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception {
|
|
|
|
toggleOtherPlayers(server, sender, args);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
protected void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception {
|
2016-03-03 19:54:18 +00:00
|
|
|
handleToggleWithArgs(server, user, args);
|
2015-04-15 04:06:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
void togglePlayer(CommandSource sender, User user, Boolean enabled) throws NotEnoughArgumentsException {
|
|
|
|
if (enabled == null) {
|
|
|
|
enabled = !user.isSocialSpyEnabled();
|
|
|
|
}
|
|
|
|
|
|
|
|
user.setSocialSpyEnabled(enabled);
|
|
|
|
|
|
|
|
|
|
|
|
user.sendMessage(tl("socialSpy", user.getDisplayName(), enabled ? tl("enabled") : tl("disabled")));
|
|
|
|
if (!sender.isPlayer() || !sender.getPlayer().equals(user.getBase())) {
|
|
|
|
sender.sendMessage(tl("socialSpy", user.getDisplayName(), enabled ? tl("enabled") : tl("disabled")));
|
|
|
|
}
|
|
|
|
}
|
2011-05-04 10:39:56 +00:00
|
|
|
}
|