Added chat spy toggle

This commit is contained in:
boy0001 2015-09-01 15:09:46 +10:00
parent 6006b0e011
commit ea6d5778c8
2 changed files with 25 additions and 11 deletions

View File

@ -77,6 +77,20 @@ public class Toggle extends SubCommand {
return true;
}
});
toggles.put("chatspy",
new Command<PlotPlayer>("chatspy", "/plot toggle chatspy", "Toggle chat spying", C.PERMISSION_COMMANDS_CHAT.s()) {
@Override
public boolean onCommand(PlotPlayer player, String[] args) {
if (toggle(player, "chatspy")) {
MainUtil.sendMessage(player, C.TOGGLE_ENABLED, getCommand());
}
else {
MainUtil.sendMessage(player, C.TOGGLE_DISABLED, getCommand());
}
return true;
}
});
toggles.put("chat",
new Command<PlotPlayer>("chat", "/plot toggle chat", "Toggle plot chat for yourself", C.PERMISSION_PLOT_TOGGLE_CHAT.s()) {

View File

@ -626,7 +626,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
recipients.clear();
for (final Player p : Bukkit.getOnlinePlayers()) {
PlotPlayer pp = BukkitUtil.getPlayer(p);
if (Permissions.hasPermission(pp, C.PERMISSION_COMMANDS_CHAT) || plot.equals(pp.getCurrentPlot())) {
if (pp.getAttribute("chatspy") || plot.equals(pp.getCurrentPlot())) {
recipients.add(p);
}
}