mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-12-25 01:47:41 +01:00
Make message for consoleonly feature configurable. [TICKET DBO 711]
This commit is contained in:
parent
d130a3d583
commit
f8d72eb591
@ -15,6 +15,7 @@ import fr.neatmonster.nocheatplus.config.ConfPaths;
|
|||||||
import fr.neatmonster.nocheatplus.config.ConfigFile;
|
import fr.neatmonster.nocheatplus.config.ConfigFile;
|
||||||
import fr.neatmonster.nocheatplus.config.ConfigManager;
|
import fr.neatmonster.nocheatplus.config.ConfigManager;
|
||||||
import fr.neatmonster.nocheatplus.permissions.Permissions;
|
import fr.neatmonster.nocheatplus.permissions.Permissions;
|
||||||
|
import fr.neatmonster.nocheatplus.utilities.ColorUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configurations specific for the "chat" checks. Every world gets one of these assigned to it, or if a world doesn't
|
* Configurations specific for the "chat" checks. Every world gets one of these assigned to it, or if a world doesn't
|
||||||
@ -120,6 +121,7 @@ public class ChatConfig extends AsyncCheckConfig {
|
|||||||
public final long loginsStartupDelay;
|
public final long loginsStartupDelay;
|
||||||
|
|
||||||
public final boolean consoleOnlyCheck;
|
public final boolean consoleOnlyCheck;
|
||||||
|
public final String consoleOnlyMessage;
|
||||||
|
|
||||||
|
|
||||||
public final boolean relogCheck;
|
public final boolean relogCheck;
|
||||||
@ -214,6 +216,7 @@ public class ChatConfig extends AsyncCheckConfig {
|
|||||||
relogActions = config.getOptimizedActionList(ConfPaths.CHAT_RELOG_ACTIONS, Permissions.CHAT_RELOG);
|
relogActions = config.getOptimizedActionList(ConfPaths.CHAT_RELOG_ACTIONS, Permissions.CHAT_RELOG);
|
||||||
|
|
||||||
consoleOnlyCheck = config.getBoolean(ConfPaths.PROTECT_COMMANDS_CONSOLEONLY_ACTIVE);
|
consoleOnlyCheck = config.getBoolean(ConfPaths.PROTECT_COMMANDS_CONSOLEONLY_ACTIVE);
|
||||||
|
consoleOnlyMessage = ColorUtil.replaceColors(config.getString(ConfPaths.PROTECT_COMMANDS_CONSOLEONLY_MSG));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,7 +173,7 @@ public class ChatListener extends CheckListener implements INotifyReload, JoinLe
|
|||||||
// Prevent /op and /deop commands from being used by players.
|
// Prevent /op and /deop commands from being used by players.
|
||||||
if (cc.consoleOnlyCheck && consoleOnlyCommands.hasAnyPrefixWords(lcMessage, lcAltMessage)) {
|
if (cc.consoleOnlyCheck && consoleOnlyCommands.hasAnyPrefixWords(lcMessage, lcAltMessage)) {
|
||||||
if (command == null || command.testPermission(player)){
|
if (command == null || command.testPermission(player)){
|
||||||
player.sendMessage(ChatColor.RED + "I'm sorry, but this command can't be executed in chat. Use the console instead!");
|
player.sendMessage(cc.consoleOnlyMessage);
|
||||||
}
|
}
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
|
@ -84,6 +84,7 @@ public abstract class ConfPaths {
|
|||||||
private static final String PROTECT_COMMANDS = PROTECT + "commands.";
|
private static final String PROTECT_COMMANDS = PROTECT + "commands.";
|
||||||
private static final String PROTECT_COMMANDS_CONSOLEONLY = PROTECT_COMMANDS + "consoleonly.";
|
private static final String PROTECT_COMMANDS_CONSOLEONLY = PROTECT_COMMANDS + "consoleonly.";
|
||||||
public static final String PROTECT_COMMANDS_CONSOLEONLY_ACTIVE = PROTECT_COMMANDS_CONSOLEONLY + "active";
|
public static final String PROTECT_COMMANDS_CONSOLEONLY_ACTIVE = PROTECT_COMMANDS_CONSOLEONLY + "active";
|
||||||
|
public static final String PROTECT_COMMANDS_CONSOLEONLY_MSG = PROTECT_COMMANDS_CONSOLEONLY + "message";
|
||||||
public static final String PROTECT_COMMANDS_CONSOLEONLY_CMDS = PROTECT_COMMANDS_CONSOLEONLY + "commands";
|
public static final String PROTECT_COMMANDS_CONSOLEONLY_CMDS = PROTECT_COMMANDS_CONSOLEONLY + "commands";
|
||||||
// Plugins settings.
|
// Plugins settings.
|
||||||
private static final String PROTECT_PLUGINS = PROTECT + "plugins.";
|
private static final String PROTECT_PLUGINS = PROTECT + "plugins.";
|
||||||
|
@ -71,6 +71,7 @@ public class DefaultConfig extends ConfigFile {
|
|||||||
set(ConfPaths.PROTECT_PLUGINS_HIDE_NOCOMMAND_CMDS, new LinkedList<String>());
|
set(ConfPaths.PROTECT_PLUGINS_HIDE_NOCOMMAND_CMDS, new LinkedList<String>());
|
||||||
// Commands (other).
|
// Commands (other).
|
||||||
set(ConfPaths.PROTECT_COMMANDS_CONSOLEONLY_ACTIVE, false);
|
set(ConfPaths.PROTECT_COMMANDS_CONSOLEONLY_ACTIVE, false);
|
||||||
|
set(ConfPaths.PROTECT_COMMANDS_CONSOLEONLY_MSG, "&cI'm sorry, but this command can't be executed in chat. Use the console instead!");
|
||||||
set(ConfPaths.PROTECT_COMMANDS_CONSOLEONLY_CMDS, Arrays.asList("op", "deop"));
|
set(ConfPaths.PROTECT_COMMANDS_CONSOLEONLY_CMDS, Arrays.asList("op", "deop"));
|
||||||
// Client motd.
|
// Client motd.
|
||||||
set(ConfPaths.PROTECT_CLIENTS_MOTD_ACTIVE, true);
|
set(ConfPaths.PROTECT_CLIENTS_MOTD_ACTIVE, true);
|
||||||
|
Loading…
Reference in New Issue
Block a user