Added more settings/permissions on request.

This commit is contained in:
NeatMonster 2012-08-18 16:57:54 +02:00
parent 858f610e79
commit 811b1d4023
7 changed files with 104 additions and 94 deletions

View File

@ -70,14 +70,14 @@ public class LogAction extends ActionWithParameters {
if (configurationFile.getBoolean(ConfPaths.LOGGING_ACTIVE)
&& !violationData.player.hasPermission(violationData.actions.permissionSilent)) {
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())
if (otherPlayer.hasPermission(Permissions.ADMINISTRATION_NOTIFY))
otherPlayer.sendMessage(ChatColor.RED + "NCP: " + ChatColor.WHITE
+ CheckUtils.replaceColors(message));
if (toConsole && configurationFile.getBoolean(ConfPaths.LOGGING_LOGTOCONSOLE))
if (toConsole && configurationFile.getBoolean(ConfPaths.LOGGING_CONSOLE))
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));
}
return false;

View File

@ -89,10 +89,13 @@ public class ChatListener implements Listener {
final String command = event.getMessage().split(" ")[0].substring(1).toLowerCase();
// Protect some commands to prevent players for seeing which plugins are installed.
if (ChatConfig.getConfig(player).protectPlugins
&& (command.equals("?") || command.equals("about") || command.equals("help")
|| command.equals("plugins") || command.equals("pl"))
&& !player.hasPermission(Permissions.ADMINISTRATION_PLUGINS)) {
if (ChatConfig.getConfig(player).protectPlugins)
if ((command.equalsIgnoreCase("help") || command.equalsIgnoreCase("?"))
&& !player.hasPermission(Permissions.ADMINISTRATION_BUKKIT_HELP)
|| (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(
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.");

View File

@ -25,10 +25,11 @@ public abstract class ConfPaths {
*/
private static final String LOGGING = "logging.";
public static final String LOGGING_ACTIVE = LOGGING + "active";
public static final String LOGGING_LOGTOFILE = LOGGING + "file";
public static final String LOGGING_LOGTOCONSOLE = LOGGING + "console";
public static final String LOGGING_LOGTOINGAMECHAT = LOGGING + "ingamechat";
public static final String LOGGING_DEBUGMESSAGES = LOGGING + "debugmessages";
public static final String LOGGING_CONSOLE = LOGGING + "console";
public static final String LOGGING_DEBUG = LOGGING + "debug";
public static final String LOGGING_FILE = LOGGING + "file";
public static final String LOGGING_FILENAME = LOGGING + "filename";
public static final String LOGGING_INGAMECHAT = LOGGING + "ingamechat";
/*
* e e ,e, 888 888

View File

@ -166,7 +166,7 @@ public class ConfigManager {
fileHandler = null;
}
final File logFile = new File(folder, "nocheatplus.log");
final File logFile = new File(folder, global.getString(ConfPaths.LOGGING_FILENAME));
try {
try {
logFile.getParentFile().mkdirs();

View File

@ -36,10 +36,11 @@ public class DefaultConfig extends ConfigFile {
* "8",P" "8",P" "8",P"
*/
set(ConfPaths.LOGGING_ACTIVE, true);
set(ConfPaths.LOGGING_DEBUGMESSAGES, false);
set(ConfPaths.LOGGING_LOGTOFILE, true);
set(ConfPaths.LOGGING_LOGTOCONSOLE, true);
set(ConfPaths.LOGGING_LOGTOINGAMECHAT, true);
set(ConfPaths.LOGGING_DEBUG, false);
set(ConfPaths.LOGGING_CONSOLE, true);
set(ConfPaths.LOGGING_FILE, true);
set(ConfPaths.LOGGING_FILENAME, "nocheatplus.log");
set(ConfPaths.LOGGING_INGAMECHAT, true);
/*
* e e ,e, 888 888

View File

@ -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
*/
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_PLUGINS = ADMINISTRATION + ".plugins";
public static final String ADMINISTRATION_RELOAD = ADMINISTRATION + ".reload";
private static final String CHECKS = NOCHEATPLUS + ".checks";

View File

@ -88,7 +88,7 @@ public class LagMeasureTask implements Runnable {
// If the previous second took to long, skip checks during this second.
skipCheck = lastInGameSecondDuration > 2000;
if (ConfigManager.getConfigFile().getBoolean(ConfPaths.LOGGING_DEBUGMESSAGES))
if (ConfigManager.getConfigFile().getBoolean(ConfPaths.LOGGING_DEBUG))
if (oldStatus != skipCheck && skipCheck)
System.out.println("[NoCheatPlus] Detected server lag, some checks will not work.");
else if (oldStatus != skipCheck && !skipCheck)