mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-08 00:38:27 +01:00
Added more settings/permissions on request.
This commit is contained in:
parent
858f610e79
commit
811b1d4023
@ -70,14 +70,14 @@ public class LogAction extends ActionWithParameters {
|
|||||||
if (configurationFile.getBoolean(ConfPaths.LOGGING_ACTIVE)
|
if (configurationFile.getBoolean(ConfPaths.LOGGING_ACTIVE)
|
||||||
&& !violationData.player.hasPermission(violationData.actions.permissionSilent)) {
|
&& !violationData.player.hasPermission(violationData.actions.permissionSilent)) {
|
||||||
final String message = super.getMessage(violationData);
|
final String message = super.getMessage(violationData);
|
||||||
if (toChat && configurationFile.getBoolean(ConfPaths.LOGGING_LOGTOINGAMECHAT))
|
if (toChat && configurationFile.getBoolean(ConfPaths.LOGGING_INGAMECHAT))
|
||||||
for (final Player otherPlayer : Bukkit.getServer().getOnlinePlayers())
|
for (final Player otherPlayer : Bukkit.getServer().getOnlinePlayers())
|
||||||
if (otherPlayer.hasPermission(Permissions.ADMINISTRATION_NOTIFY))
|
if (otherPlayer.hasPermission(Permissions.ADMINISTRATION_NOTIFY))
|
||||||
otherPlayer.sendMessage(ChatColor.RED + "NCP: " + ChatColor.WHITE
|
otherPlayer.sendMessage(ChatColor.RED + "NCP: " + ChatColor.WHITE
|
||||||
+ CheckUtils.replaceColors(message));
|
+ CheckUtils.replaceColors(message));
|
||||||
if (toConsole && configurationFile.getBoolean(ConfPaths.LOGGING_LOGTOCONSOLE))
|
if (toConsole && configurationFile.getBoolean(ConfPaths.LOGGING_CONSOLE))
|
||||||
System.out.println("[NoCheatPlus] " + CheckUtils.removeColors(message));
|
System.out.println("[NoCheatPlus] " + CheckUtils.removeColors(message));
|
||||||
if (toFile && configurationFile.getBoolean(ConfPaths.LOGGING_LOGTOFILE))
|
if (toFile && configurationFile.getBoolean(ConfPaths.LOGGING_FILE))
|
||||||
CheckUtils.fileLogger.info(CheckUtils.removeColors(message));
|
CheckUtils.fileLogger.info(CheckUtils.removeColors(message));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -89,10 +89,13 @@ public class ChatListener implements Listener {
|
|||||||
final String command = event.getMessage().split(" ")[0].substring(1).toLowerCase();
|
final String command = event.getMessage().split(" ")[0].substring(1).toLowerCase();
|
||||||
|
|
||||||
// Protect some commands to prevent players for seeing which plugins are installed.
|
// Protect some commands to prevent players for seeing which plugins are installed.
|
||||||
if (ChatConfig.getConfig(player).protectPlugins
|
if (ChatConfig.getConfig(player).protectPlugins)
|
||||||
&& (command.equals("?") || command.equals("about") || command.equals("help")
|
if ((command.equalsIgnoreCase("help") || command.equalsIgnoreCase("?"))
|
||||||
|| command.equals("plugins") || command.equals("pl"))
|
&& !player.hasPermission(Permissions.ADMINISTRATION_BUKKIT_HELP)
|
||||||
&& !player.hasPermission(Permissions.ADMINISTRATION_PLUGINS)) {
|
|| (command.equalsIgnoreCase("plugins") || command.equalsIgnoreCase("pl"))
|
||||||
|
&& !player.hasPermission(Permissions.ADMINISTRATION_BUKKIT_PLUGINS)
|
||||||
|
|| (command.equalsIgnoreCase("version") || command.equalsIgnoreCase("ver"))
|
||||||
|
&& !player.hasPermission(Permissions.ADMINISTRATION_BUKKIT_VERSION)) {
|
||||||
event.getPlayer().sendMessage(
|
event.getPlayer().sendMessage(
|
||||||
ChatColor.RED + "I'm sorry, but you do not have permission to perform this command. "
|
ChatColor.RED + "I'm sorry, but you do not have permission to perform this command. "
|
||||||
+ "Please contact the server administrators if you believe that this is in error.");
|
+ "Please contact the server administrators if you believe that this is in error.");
|
||||||
|
@ -25,10 +25,11 @@ public abstract class ConfPaths {
|
|||||||
*/
|
*/
|
||||||
private static final String LOGGING = "logging.";
|
private static final String LOGGING = "logging.";
|
||||||
public static final String LOGGING_ACTIVE = LOGGING + "active";
|
public static final String LOGGING_ACTIVE = LOGGING + "active";
|
||||||
public static final String LOGGING_LOGTOFILE = LOGGING + "file";
|
public static final String LOGGING_CONSOLE = LOGGING + "console";
|
||||||
public static final String LOGGING_LOGTOCONSOLE = LOGGING + "console";
|
public static final String LOGGING_DEBUG = LOGGING + "debug";
|
||||||
public static final String LOGGING_LOGTOINGAMECHAT = LOGGING + "ingamechat";
|
public static final String LOGGING_FILE = LOGGING + "file";
|
||||||
public static final String LOGGING_DEBUGMESSAGES = LOGGING + "debugmessages";
|
public static final String LOGGING_FILENAME = LOGGING + "filename";
|
||||||
|
public static final String LOGGING_INGAMECHAT = LOGGING + "ingamechat";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* e e ,e, 888 888
|
* e e ,e, 888 888
|
||||||
|
@ -166,7 +166,7 @@ public class ConfigManager {
|
|||||||
fileHandler = null;
|
fileHandler = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
final File logFile = new File(folder, "nocheatplus.log");
|
final File logFile = new File(folder, global.getString(ConfPaths.LOGGING_FILENAME));
|
||||||
try {
|
try {
|
||||||
try {
|
try {
|
||||||
logFile.getParentFile().mkdirs();
|
logFile.getParentFile().mkdirs();
|
||||||
|
@ -36,10 +36,11 @@ public class DefaultConfig extends ConfigFile {
|
|||||||
* "8",P" "8",P" "8",P"
|
* "8",P" "8",P" "8",P"
|
||||||
*/
|
*/
|
||||||
set(ConfPaths.LOGGING_ACTIVE, true);
|
set(ConfPaths.LOGGING_ACTIVE, true);
|
||||||
set(ConfPaths.LOGGING_DEBUGMESSAGES, false);
|
set(ConfPaths.LOGGING_DEBUG, false);
|
||||||
set(ConfPaths.LOGGING_LOGTOFILE, true);
|
set(ConfPaths.LOGGING_CONSOLE, true);
|
||||||
set(ConfPaths.LOGGING_LOGTOCONSOLE, true);
|
set(ConfPaths.LOGGING_FILE, true);
|
||||||
set(ConfPaths.LOGGING_LOGTOINGAMECHAT, true);
|
set(ConfPaths.LOGGING_FILENAME, "nocheatplus.log");
|
||||||
|
set(ConfPaths.LOGGING_INGAMECHAT, true);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* e e ,e, 888 888
|
* e e ,e, 888 888
|
||||||
|
@ -23,8 +23,13 @@ public class Permissions {
|
|||||||
* d8888888b Y8b "88 888 888 888 888 888 888 888 888 d,dP 888 888 "88 888 888 888 "88 88" 888 888
|
* d8888888b Y8b "88 888 888 888 888 888 888 888 888 d,dP 888 888 "88 888 888 888 "88 88" 888 888
|
||||||
*/
|
*/
|
||||||
private static final String ADMINISTRATION = NOCHEATPLUS + ".admin";
|
private static final String ADMINISTRATION = NOCHEATPLUS + ".admin";
|
||||||
|
|
||||||
|
private static final String ADMINISTRATION_BUKKIT = ADMINISTRATION + ".bukkit";
|
||||||
|
public static final String ADMINISTRATION_BUKKIT_HELP = ADMINISTRATION_BUKKIT + ".help";
|
||||||
|
public static final String ADMINISTRATION_BUKKIT_PLUGINS = ADMINISTRATION_BUKKIT + ".plugins";
|
||||||
|
public static final String ADMINISTRATION_BUKKIT_VERSION = ADMINISTRATION_BUKKIT + ".version";
|
||||||
|
|
||||||
public static final String ADMINISTRATION_NOTIFY = ADMINISTRATION + ".notify";
|
public static final String ADMINISTRATION_NOTIFY = ADMINISTRATION + ".notify";
|
||||||
public static final String ADMINISTRATION_PLUGINS = ADMINISTRATION + ".plugins";
|
|
||||||
public static final String ADMINISTRATION_RELOAD = ADMINISTRATION + ".reload";
|
public static final String ADMINISTRATION_RELOAD = ADMINISTRATION + ".reload";
|
||||||
|
|
||||||
private static final String CHECKS = NOCHEATPLUS + ".checks";
|
private static final String CHECKS = NOCHEATPLUS + ".checks";
|
||||||
|
@ -88,7 +88,7 @@ public class LagMeasureTask implements Runnable {
|
|||||||
// If the previous second took to long, skip checks during this second.
|
// If the previous second took to long, skip checks during this second.
|
||||||
skipCheck = lastInGameSecondDuration > 2000;
|
skipCheck = lastInGameSecondDuration > 2000;
|
||||||
|
|
||||||
if (ConfigManager.getConfigFile().getBoolean(ConfPaths.LOGGING_DEBUGMESSAGES))
|
if (ConfigManager.getConfigFile().getBoolean(ConfPaths.LOGGING_DEBUG))
|
||||||
if (oldStatus != skipCheck && skipCheck)
|
if (oldStatus != skipCheck && skipCheck)
|
||||||
System.out.println("[NoCheatPlus] Detected server lag, some checks will not work.");
|
System.out.println("[NoCheatPlus] Detected server lag, some checks will not work.");
|
||||||
else if (oldStatus != skipCheck && !skipCheck)
|
else if (oldStatus != skipCheck && !skipCheck)
|
||||||
|
Loading…
Reference in New Issue
Block a user