2011-05-04 12:39:56 +02:00
|
|
|
package com.earth2me.essentials.commands;
|
2011-11-21 02:55:26 +01:00
|
|
|
|
2013-10-16 21:59:39 +02:00
|
|
|
import com.earth2me.essentials.CommandSource;
|
2011-05-04 12:39:56 +02:00
|
|
|
import com.earth2me.essentials.User;
|
2024-02-03 21:38:14 +01:00
|
|
|
import com.earth2me.essentials.utils.CommonPlaceholders;
|
2011-05-04 12:39:56 +02:00
|
|
|
import org.bukkit.Server;
|
2011-05-04 16:23:22 +02:00
|
|
|
|
2015-04-15 06:06:16 +02: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 20:54:18 +01:00
|
|
|
handleToggleWithArgs(server, user, args);
|
2015-04-15 06:06:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2020-10-03 19:46:05 +02:00
|
|
|
protected void togglePlayer(final CommandSource sender, final User user, Boolean enabled) {
|
2015-04-15 06:06:16 +02:00
|
|
|
if (enabled == null) {
|
|
|
|
enabled = !user.isSocialSpyEnabled();
|
|
|
|
}
|
|
|
|
|
|
|
|
user.setSocialSpyEnabled(enabled);
|
|
|
|
|
2024-02-10 05:01:20 +01:00
|
|
|
user.sendTl("socialSpy", user.getDisplayName(), CommonPlaceholders.enableDisable(user.getSource(), enabled));
|
2015-04-15 06:06:16 +02:00
|
|
|
if (!sender.isPlayer() || !sender.getPlayer().equals(user.getBase())) {
|
2024-02-10 05:01:20 +01:00
|
|
|
sender.sendTl("socialSpy", user.getDisplayName(), CommonPlaceholders.enableDisable(user.getSource(), enabled));
|
2015-04-15 06:06:16 +02:00
|
|
|
}
|
|
|
|
}
|
2011-05-04 12:39:56 +02:00
|
|
|
}
|