Only mods and higher should use Mod Chat Channel

This commit is contained in:
Svenja Reissaus 2018-08-02 11:54:39 -03:00
parent 1ac9c123d0
commit d6d8031804
3 changed files with 12 additions and 1 deletions

View File

@ -37,8 +37,12 @@ public class CmdChat extends FCommand {
if (modeString != null) {
modeString = modeString.toLowerCase();
if (modeString.startsWith("m")) {
// Only allow Mods and higher rank to switch to this channel.
if (modeString.startsWith("m") && fme.getRole().isAtLeast(Role.MODERATOR)) {
modeTarget = ChatMode.MOD;
} else if (modeString.startsWith("m") && !fme.getRole().isAtLeast(Role.MODERATOR)) {
msg(TL.COMMAND_CHAT_MOD_ONLY);
return;
} else if (modeString.startsWith("p")) {
modeTarget = ChatMode.PUBLIC;
} else if (modeString.startsWith("a")) {

View File

@ -63,8 +63,14 @@ public class FactionsChatListener implements Listener {
fplayer.sendMessage("[MCspy]: " + message);
}
}
} else {
// Just in case player gets demoted while in faction chat.
me.msg(TL.COMMAND_CHAT_MOD_ONLY);
event.setCancelled(true);
return;
}
Bukkit.getLogger().log(Level.INFO, ChatColor.stripColor("Mod Chat: " + message));
event.setCancelled(true);

View File

@ -188,6 +188,7 @@ public enum TL {
COMMAND_CHAT_MODE_TRUCE("&c&l[!] &5Truce &7only chat mode."),
COMMAND_CHAT_MODE_FACTION("&c&l[!] &aFaction&7 only chat mode."),
COMMAND_CHAT_MODE_MOD("&c&l[!] &dMod &7only chat mode."),
COMMAND_CHAT_MOD_ONLY("&c&l[!] &7Only Mods can talk through this chat mode."),
COMMAND_CHATSPY_ENABLE("&c&l[!] &7You have &cenabled &7chat spying mode."),
COMMAND_CHATSPY_ENABLELOG(" has ENABLED chat spying mode."),