mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-02-06 14:51:23 +01:00
[BREAKING] Add option to remove players exemptions on join and leave.
The option is enabled by default, thus it might break something.
This commit is contained in:
parent
33cd10826d
commit
4e5dce0722
@ -613,6 +613,10 @@ public abstract class ConfPaths {
|
|||||||
// Compatibility section (possibly temporary).
|
// Compatibility section (possibly temporary).
|
||||||
@GlobalConfig
|
@GlobalConfig
|
||||||
public static final String COMPATIBILITY = "compatibility.";
|
public static final String COMPATIBILITY = "compatibility.";
|
||||||
|
public static final String COMPATIBILITY_EXEMPTIONS = COMPATIBILITY + "exemptions.";
|
||||||
|
public static final String COMPATIBILITY_EXEMPTIONS_REMOVE = COMPATIBILITY_EXEMPTIONS + "remove.";
|
||||||
|
public static final String COMPATIBILITY_EXEMPTIONS_REMOVE_JOIN = COMPATIBILITY_EXEMPTIONS_REMOVE + "join";
|
||||||
|
public static final String COMPATIBILITY_EXEMPTIONS_REMOVE_LEAVE = COMPATIBILITY_EXEMPTIONS_REMOVE + "leave";
|
||||||
public static final String COMPATIBILITY_MANAGELISTENERS = COMPATIBILITY + "managelisteners";
|
public static final String COMPATIBILITY_MANAGELISTENERS = COMPATIBILITY + "managelisteners";
|
||||||
public static final String COMPATIBILITY_BUKKITONLY = COMPATIBILITY + "bukkitapionly";
|
public static final String COMPATIBILITY_BUKKITONLY = COMPATIBILITY + "bukkitapionly";
|
||||||
public static final String COMPATIBILITY_BLOCKS = COMPATIBILITY + "blocks.";
|
public static final String COMPATIBILITY_BLOCKS = COMPATIBILITY + "blocks.";
|
||||||
|
@ -510,6 +510,8 @@ public class DefaultConfig extends ConfigFile {
|
|||||||
set(ConfPaths.STRINGS + ".tempkick5", "ncp tempkick [player] 5 You have five minutes to think about it!");
|
set(ConfPaths.STRINGS + ".tempkick5", "ncp tempkick [player] 5 You have five minutes to think about it!");
|
||||||
|
|
||||||
// Compatibility settings.
|
// Compatibility settings.
|
||||||
|
set(ConfPaths.COMPATIBILITY_EXEMPTIONS_REMOVE_JOIN, true);
|
||||||
|
set(ConfPaths.COMPATIBILITY_EXEMPTIONS_REMOVE_LEAVE, true);
|
||||||
set(ConfPaths.COMPATIBILITY_MANAGELISTENERS, false);
|
set(ConfPaths.COMPATIBILITY_MANAGELISTENERS, false);
|
||||||
set(ConfPaths.COMPATIBILITY_BUKKITONLY, false);
|
set(ConfPaths.COMPATIBILITY_BUKKITONLY, false);
|
||||||
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_IGNOREPASSABLE, Arrays.asList(
|
set(ConfPaths.COMPATIBILITY_BLOCKS + ConfPaths.SUB_IGNOREPASSABLE, Arrays.asList(
|
||||||
|
@ -216,6 +216,9 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
|
|||||||
/** Access point for thread safe message queuing. */
|
/** Access point for thread safe message queuing. */
|
||||||
private final PlayerMessageSender playerMessageSender = new PlayerMessageSender();
|
private final PlayerMessageSender playerMessageSender = new PlayerMessageSender();
|
||||||
|
|
||||||
|
private boolean clearExemptionsOnJoin = true;
|
||||||
|
private boolean clearExemptionsOnLeave = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove expired entries.
|
* Remove expired entries.
|
||||||
*/
|
*/
|
||||||
@ -789,7 +792,8 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
|
|||||||
|
|
||||||
final ConfigFile config = ConfigManager.getConfigFile();
|
final ConfigFile config = ConfigManager.getConfigFile();
|
||||||
|
|
||||||
useSubscriptions = config.getBoolean(ConfPaths.LOGGING_BACKEND_INGAMECHAT_SUBSCRIPTIONS);
|
// Set some instance members.
|
||||||
|
setInstanceMembers(config);
|
||||||
|
|
||||||
// Listener manager.
|
// Listener manager.
|
||||||
manageListeners = config.getBoolean(ConfPaths.COMPATIBILITY_MANAGELISTENERS);
|
manageListeners = config.getBoolean(ConfPaths.COMPATIBILITY_MANAGELISTENERS);
|
||||||
@ -896,7 +900,6 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
// Is the version the configuration was created with consistent with the current one?
|
// Is the version the configuration was created with consistent with the current one?
|
||||||
configProblems = Updates.isConfigUpToDate(config);
|
|
||||||
if (configProblems != null && config.getBoolean(ConfPaths.CONFIGVERSION_NOTIFY)){
|
if (configProblems != null && config.getBoolean(ConfPaths.CONFIGVERSION_NOTIFY)){
|
||||||
// Could use custom prefix from logging, however ncp should be mentioned then.
|
// Could use custom prefix from logging, however ncp should be mentioned then.
|
||||||
logManager.warning(Streams.INIT, "[NoCheatPlus] " + configProblems);
|
logManager.warning(Streams.INIT, "[NoCheatPlus] " + configProblems);
|
||||||
@ -966,7 +969,7 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
|
|||||||
*/
|
*/
|
||||||
protected void processReload(){
|
protected void processReload(){
|
||||||
final ConfigFile config = ConfigManager.getConfigFile();
|
final ConfigFile config = ConfigManager.getConfigFile();
|
||||||
configProblems = Updates.isConfigUpToDate(config);
|
setInstanceMembers(config);
|
||||||
// TODO: Process registered ComponentFactory instances.
|
// TODO: Process registered ComponentFactory instances.
|
||||||
// Set up MCAccess.
|
// Set up MCAccess.
|
||||||
initMCAccess(config);
|
initMCAccess(config);
|
||||||
@ -980,7 +983,19 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
|
|||||||
// (Re-) schedule consistency checking.
|
// (Re-) schedule consistency checking.
|
||||||
scheduleConsistencyCheckers();
|
scheduleConsistencyCheckers();
|
||||||
// Cache some things.
|
// Cache some things.
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set instance members based on the given configuration. This is meant to
|
||||||
|
* work after reloading the configuration too.
|
||||||
|
*
|
||||||
|
* @param config
|
||||||
|
*/
|
||||||
|
private void setInstanceMembers(final ConfigFile config) {
|
||||||
|
configProblems = Updates.isConfigUpToDate(config);
|
||||||
useSubscriptions = config.getBoolean(ConfPaths.LOGGING_BACKEND_INGAMECHAT_SUBSCRIPTIONS);
|
useSubscriptions = config.getBoolean(ConfPaths.LOGGING_BACKEND_INGAMECHAT_SUBSCRIPTIONS);
|
||||||
|
clearExemptionsOnJoin = config.getBoolean(ConfPaths.COMPATIBILITY_EXEMPTIONS_REMOVE_JOIN);
|
||||||
|
clearExemptionsOnLeave = config.getBoolean(ConfPaths.COMPATIBILITY_EXEMPTIONS_REMOVE_LEAVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -1085,6 +1100,9 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
|
|||||||
public void onPlayerJoinLowest(final PlayerJoinEvent event) {
|
public void onPlayerJoinLowest(final PlayerJoinEvent event) {
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
updatePermStateReceivers(player);
|
updatePermStateReceivers(player);
|
||||||
|
if (clearExemptionsOnJoin) {
|
||||||
|
NCPExemptionManager.unexempt(player);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOW)
|
@EventHandler(priority = EventPriority.LOW)
|
||||||
@ -1157,6 +1175,9 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
|
|||||||
logManager.severe(Streams.INIT, t);
|
logManager.severe(Streams.INIT, t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (clearExemptionsOnLeave) {
|
||||||
|
NCPExemptionManager.unexempt(player);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updatePermStateReceivers(final Player player) {
|
protected void updatePermStateReceivers(final Player player) {
|
||||||
|
Loading…
Reference in New Issue
Block a user