mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
Added chat spy toggle
This commit is contained in:
parent
6006b0e011
commit
ea6d5778c8
@ -64,18 +64,32 @@ public class Toggle extends SubCommand {
|
|||||||
public Toggle() {
|
public Toggle() {
|
||||||
toggles = new HashMap<>();
|
toggles = new HashMap<>();
|
||||||
toggles.put("titles",
|
toggles.put("titles",
|
||||||
new Command<PlotPlayer>("titles", "/plot toggle titles", "Toggle titles for yourself", C.PERMISSION_PLOT_TOGGLE_TITLES.s()) {
|
new Command<PlotPlayer>("titles", "/plot toggle titles", "Toggle titles for yourself", C.PERMISSION_PLOT_TOGGLE_TITLES.s()) {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(PlotPlayer player, String[] args) {
|
public boolean onCommand(PlotPlayer player, String[] args) {
|
||||||
if (toggle(player, "disabletitles")) {
|
if (toggle(player, "disabletitles")) {
|
||||||
MainUtil.sendMessage(player, C.TOGGLE_ENABLED, getCommand());
|
MainUtil.sendMessage(player, C.TOGGLE_ENABLED, getCommand());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
MainUtil.sendMessage(player, C.TOGGLE_DISABLED, getCommand());
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
});
|
||||||
MainUtil.sendMessage(player, C.TOGGLE_DISABLED, getCommand());
|
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;
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
toggles.put("chat",
|
toggles.put("chat",
|
||||||
new Command<PlotPlayer>("chat", "/plot toggle chat", "Toggle plot chat for yourself", C.PERMISSION_PLOT_TOGGLE_CHAT.s()) {
|
new Command<PlotPlayer>("chat", "/plot toggle chat", "Toggle plot chat for yourself", C.PERMISSION_PLOT_TOGGLE_CHAT.s()) {
|
||||||
|
@ -626,7 +626,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
|||||||
recipients.clear();
|
recipients.clear();
|
||||||
for (final Player p : Bukkit.getOnlinePlayers()) {
|
for (final Player p : Bukkit.getOnlinePlayers()) {
|
||||||
PlotPlayer pp = BukkitUtil.getPlayer(p);
|
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);
|
recipients.add(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user