Change config path for protectplugins.

This commit is contained in:
asofold 2013-06-30 19:25:29 +02:00
parent 90783e290f
commit 3b337d968d
6 changed files with 31 additions and 20 deletions

View File

@ -227,7 +227,8 @@ public class ChatConfig extends AsyncCheckConfig {
opInConsoleOnly = config.getBoolean(ConfPaths.MISCELLANEOUS_OPINCONSOLEONLY);
protectPlugins = config.getBoolean(ConfPaths.MISCELLANEOUS_PROTECTPLUGINS);
// Get this one from the global config.
protectPlugins = ConfigManager.getConfigFile().getBoolean(ConfPaths.PROTECT_PLUGINS_HIDE_ACTIVE);
}
/* (non-Javadoc)

View File

@ -154,6 +154,7 @@ public class ChatListener extends CheckListener implements INotifyReload, JoinLe
// Protect some commands to prevent players for seeing which plugins are installed.
if (cc.protectPlugins) {
// TODO: Use a prefix map and generalize this.
// TODO: Configurable message.
if ((commandLabel.equals("plugins") || commandLabel.equals("version") || commandLabel.equals("icanhasbukkit")) && !player.hasPermission(Permissions.ADMINISTRATION_PLUGINS)) {
player.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.");
event.setCancelled(true);

View File

@ -160,7 +160,7 @@ public class NoCheatPlusCommand extends BaseCommand{
return false;
}
if (ConfigManager.getConfigFile().getBoolean(ConfPaths.MISCELLANEOUS_PROTECTPLUGINS)){
if (ConfigManager.getConfigFile().getBoolean(ConfPaths.PROTECT_PLUGINS_HIDE_ACTIVE)){
// Prevent the NCP usage printout:
sender.sendMessage("Unknown command. Type \"help\" for help.");
return true;

View File

@ -52,18 +52,6 @@ public abstract class ConfPaths {
public static final String LOGGING_BACKEND_INGAMECHAT_SUBSCRIPTIONS = LOGGING_BACKEND_INGAMECHAT + "subscriptions";
public static final String LOGGING_BACKEND_INGAMECHAT_PREFIX = LOGGING_BACKEND_INGAMECHAT + "prefix";
// Deprecated.
@Moved(newPath=LOGGING_BACKEND_CONSOLE_ACTIVE)
public static final String LOGGING_CONSOLE = LOGGING + "console";
@Moved(newPath=LOGGING_BACKEND_FILE_ACTIVE)
public static final String LOGGING_FILE = LOGGING + "file";
@Moved(newPath=LOGGING_BACKEND_FILE_FILENAME)
public static final String LOGGING_FILENAME = LOGGING + "filename";
@Moved(newPath=LOGGING_BACKEND_INGAMECHAT_ACTIVE)
public static final String LOGGING_INGAMECHAT = LOGGING + "ingamechat";
@Moved(newPath=LOGGING_BACKEND_INGAMECHAT_SUBSCRIPTIONS)
public static final String LOGGING_USESUBSCRIPTIONS = LOGGING + "usesubscriptions";
/*
* e e ,e, 888 888
* d8b d8b " dP"Y e88'888 ,e e, 888 888 ,"Y88b 888 8e ,e e, e88 88e 8888 8888 dP"Y
@ -75,7 +63,6 @@ public abstract class ConfPaths {
private static final String MISCELLANEOUS = "miscellaneous.";
public static final String MISCELLANEOUS_ALLOWCLIENTMODS = MISCELLANEOUS + "allowclientmods";
public static final String MISCELLANEOUS_OPINCONSOLEONLY = MISCELLANEOUS + "opinconsoleonly";
public static final String MISCELLANEOUS_PROTECTPLUGINS = MISCELLANEOUS + "protectplugins";
public static final String MISCELLANEOUS_CHECKFORUPDATES = MISCELLANEOUS + "checkforupdates";
public static final String MISCELLANEOUS_UPDATETIMEOUT = MISCELLANEOUS + "updatetimeout";
public static final String MISCELLANEOUS_REPORTTOMETRICS = MISCELLANEOUS + "reporttometrics";
@ -105,6 +92,13 @@ public abstract class ConfPaths {
*/
public static final String DATA_CONSISTENCYCHECKS_SUPPRESSWARNINGS = DATA_CONSISTENCYCHECKS + "suppresswarnings";
private static final String PROTECT = "protection.";
private static final String PROTECT_PLUGINS = PROTECT + "plugins.";
private static final String PROTECT_PLUGINS_HIDE = PROTECT_PLUGINS + "hide.";
public static final String PROTECT_PLUGINS_HIDE_ACTIVE = PROTECT_PLUGINS_HIDE + "active";
// HiddenCommandMessage + PermissionMessage
private static final String CHECKS = "checks.";
/** Debug flag to debug all checks (!), individual sections debug flags override this, if present. */
public static final String CHECKS_DEBUG = CHECKS + SUB_DEBUG;
@ -636,4 +630,19 @@ public abstract class ConfPaths {
public static final String COMPATIBILITY_BUKKITONLY = COMPATIBILITY + "bukkitapionly";
public static final String COMPATIBILITY_BLOCKS = COMPATIBILITY + "blocks.";
// Deprecated (don't use fields from above).
@Moved(newPath=LOGGING_BACKEND_CONSOLE_ACTIVE)
public static final String LOGGING_CONSOLE = "logging.console";
@Moved(newPath=LOGGING_BACKEND_FILE_ACTIVE)
public static final String LOGGING_FILE = "logging.file";
@Moved(newPath=LOGGING_BACKEND_FILE_FILENAME)
public static final String LOGGING_FILENAME = "logging.filename";
@Moved(newPath=LOGGING_BACKEND_INGAMECHAT_ACTIVE)
public static final String LOGGING_INGAMECHAT = "logging.ingamechat";
@Moved(newPath=LOGGING_BACKEND_INGAMECHAT_SUBSCRIPTIONS)
public static final String LOGGING_USESUBSCRIPTIONS = "logging.usesubscriptions";
@Moved(newPath=PROTECT_PLUGINS_HIDE_ACTIVE)
public static final String MISCELLANEOUS_PROTECTPLUGINS = "miscellaneous.protectplugins";
}

View File

@ -58,8 +58,6 @@ public class DefaultConfig extends ConfigFile {
set(ConfPaths.LOGGING_BACKEND_FILE_FILENAME, "nocheatplus.log");
set(ConfPaths.LOGGING_BACKEND_INGAMECHAT_ACTIVE, true);
set(ConfPaths.LOGGING_BACKEND_INGAMECHAT_PREFIX, "&cNCP: &f");
// Notifications settings.
set(ConfPaths.LOGGING_BACKEND_INGAMECHAT_SUBSCRIPTIONS, false);
/*
@ -71,7 +69,6 @@ public class DefaultConfig extends ConfigFile {
*/
set(ConfPaths.MISCELLANEOUS_ALLOWCLIENTMODS, false);
set(ConfPaths.MISCELLANEOUS_OPINCONSOLEONLY, false);
set(ConfPaths.MISCELLANEOUS_PROTECTPLUGINS, true);
set(ConfPaths.MISCELLANEOUS_MANAGELISTENERS, false);
// set(ConfPaths.MISCELLANEOUS_CHECKFORUPDATES, true);
set(ConfPaths.MISCELLANEOUS_REPORTTOMETRICS, true);
@ -89,6 +86,9 @@ public class DefaultConfig extends ConfigFile {
set(ConfPaths.DATA_CONSISTENCYCHECKS_INTERVAL, 10);
set(ConfPaths.DATA_CONSISTENCYCHECKS_MAXTIME, 2);
set(ConfPaths.DATA_CONSISTENCYCHECKS_SUPPRESSWARNINGS, false);
// Protection features.
set(ConfPaths.PROTECT_PLUGINS_HIDE_ACTIVE, true);
/*
* 888 88b, 888 888 888 88b, 888

View File

@ -830,7 +830,7 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
// Is the configuration outdated?
configOutdated = Updates.isConfigOutdated(DefaultConfig.buildNumber, config);
if (config.getBoolean(ConfPaths.MISCELLANEOUS_PROTECTPLUGINS)) {
if (config.getBoolean(ConfPaths.PROTECT_PLUGINS_HIDE_ACTIVE)) {
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
@Override
public void run() {
@ -889,7 +889,7 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
initBlockProperties(config);
// Reset Command protection.
undoCommandChanges();
if (config.getBoolean(ConfPaths.MISCELLANEOUS_PROTECTPLUGINS)) setupCommandProtection();
if (config.getBoolean(ConfPaths.PROTECT_PLUGINS_HIDE_ACTIVE)) setupCommandProtection();
// (Re-) schedule consistency checking.
scheduleConsistencyCheckers();
// Cache some things.