mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-12-26 18:37:59 +01:00
Use postEnable for one time tasks, log start and end.
This commit is contained in:
parent
182bc81c8c
commit
ed0f08ed23
@ -810,7 +810,6 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
|
|||||||
|
|
||||||
// Set up consistency checking.
|
// Set up consistency checking.
|
||||||
scheduleConsistencyCheckers();
|
scheduleConsistencyCheckers();
|
||||||
|
|
||||||
|
|
||||||
// Setup the graphs, plotters and start Metrics.
|
// Setup the graphs, plotters and start Metrics.
|
||||||
setMetrics();
|
setMetrics();
|
||||||
@ -832,20 +831,11 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
|
|||||||
// Could use custom prefix from logging, however ncp should be mentioned then.
|
// Could use custom prefix from logging, however ncp should be mentioned then.
|
||||||
LogUtil.logWarning("[NoCheatPlus] " + configProblems);
|
LogUtil.logWarning("[NoCheatPlus] " + configProblems);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.getBoolean(ConfPaths.PROTECT_PLUGINS_HIDE_ACTIVE)) {
|
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
setupCommandProtection();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Care for already online players.
|
// Care for already online players.
|
||||||
final Player[] onlinePlayers = getServer().getOnlinePlayers();
|
final Player[] onlinePlayers = getServer().getOnlinePlayers();
|
||||||
// TODO: remap exemptionmanager !
|
// TODO: re-map ExemptionManager !
|
||||||
// TODO: Disable all checks for these players for one tick !
|
// TODO: Disable all checks for these players for one tick ?
|
||||||
// TODO: Prepare check data for players [problem: permissions]?
|
// TODO: Prepare check data for players [problem: permissions]?
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
|
Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
@ -857,6 +847,14 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
|
|||||||
// Set child permissions for commands for faster checking.
|
// Set child permissions for commands for faster checking.
|
||||||
PermissionUtil.addChildPermission(commandHandler.getAllSubCommandPermissions(), Permissions.FILTER_COMMAND_NOCHEATPLUS, PermissionDefault.OP);
|
PermissionUtil.addChildPermission(commandHandler.getAllSubCommandPermissions(), Permissions.FILTER_COMMAND_NOCHEATPLUS, PermissionDefault.OP);
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (ConfigManager.getConfigFile().getBoolean(ConfPaths.PROTECT_PLUGINS_HIDE_ACTIVE)) {
|
||||||
|
setupCommandProtection();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -866,6 +864,28 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
|
|||||||
LogUtil.logInfo("[NoCheatPlus] Version " + getDescription().getVersion() + " is enabled.");
|
LogUtil.logInfo("[NoCheatPlus] Version " + getDescription().getVersion() + " is enabled.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Actions to be done after enable of all plugins. This aims at reloading mainly.
|
||||||
|
*/
|
||||||
|
private void postEnable(final Player[] onlinePlayers, Runnable... runnables){
|
||||||
|
LogUtil.logInfo("[NoCheatPlus] Post-enable running...");
|
||||||
|
for (final Runnable runnable : runnables){
|
||||||
|
try{
|
||||||
|
runnable.run();
|
||||||
|
}
|
||||||
|
catch(Throwable t){
|
||||||
|
LogUtil.logSevere("[NoCheatPlus] Encountered a problem during post-enable: " + t.getClass().getSimpleName());
|
||||||
|
LogUtil.logSevere(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (final Player player : onlinePlayers){
|
||||||
|
updatePermStateReceivers(player);
|
||||||
|
NCPExemptionManager.registerPlayer(player);
|
||||||
|
}
|
||||||
|
// TODO: if (online.lenght > 0) LogUtils.logInfo("[NCP] Updated " + online.length + "players (post-enable).")
|
||||||
|
LogUtil.logInfo("[NoCheatPlus] Post-enable finished.");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start or cancel metrics according to settings.
|
* Start or cancel metrics according to settings.
|
||||||
*/
|
*/
|
||||||
@ -1031,26 +1051,6 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Actions to be done after enable of all plugins. This aims at reloading mainly.
|
|
||||||
*/
|
|
||||||
private void postEnable(final Player[] onlinePlayers, Runnable... runnables){
|
|
||||||
for (final Runnable runnable : runnables){
|
|
||||||
try{
|
|
||||||
runnable.run();
|
|
||||||
}
|
|
||||||
catch(Throwable t){
|
|
||||||
LogUtil.logSevere("[NoCheatPlus] Encountered a problem during post-enable: " + t.getClass().getSimpleName());
|
|
||||||
LogUtil.logSevere(t);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (final Player player : onlinePlayers){
|
|
||||||
updatePermStateReceivers(player);
|
|
||||||
NCPExemptionManager.registerPlayer(player);
|
|
||||||
}
|
|
||||||
// TODO: if (online.lenght > 0) LogUtils.logInfo("[NCP] Updated " + online.length + "players (post-enable).")
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Quick solution to hide the listener methods, expect refactoring.
|
* Quick solution to hide the listener methods, expect refactoring.
|
||||||
* @return
|
* @return
|
||||||
|
Loading…
Reference in New Issue
Block a user