mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-15 12:01:51 +01:00
Be able to run without onLoad being called.
This commit is contained in:
parent
6de0ea94bb
commit
d52dd4b158
@ -740,16 +740,30 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onLoad() {
|
public void onLoad() {
|
||||||
Bukkit.getLogger().info("[NoCheatPlus] Setting up static API, config, logging.");
|
Bukkit.getLogger().info("[NoCheatPlus] onLoad: Early set up of static API, configuration, logging.");
|
||||||
NCPAPIProvider.setNoCheatPlusAPI(this);
|
setupBasics();
|
||||||
BukkitVersion.init();
|
}
|
||||||
// Read the configuration files.
|
|
||||||
ConfigManager.init(this); // TODO: Only load the bootstrap config (not all).
|
/**
|
||||||
logManager = new BukkitLogManager(this);
|
* Lazy initialization of basics (static API, configuration, logging).
|
||||||
StaticLog.setStreamID(Streams.INIT);
|
*/
|
||||||
StaticLog.setUseLogManager(true);
|
private void setupBasics() {
|
||||||
logManager.info(Streams.INIT, "[NoCheatPlus] Logging system initialized.");
|
if (NCPAPIProvider.getNoCheatPlusAPI() == null) {
|
||||||
logManager.info(Streams.INIT, "[NoCheatPlus] Detected Minecraft version: " + ServerVersion.getMinecraftVersion());
|
NCPAPIProvider.setNoCheatPlusAPI(this);
|
||||||
|
}
|
||||||
|
if (ServerVersion.getMinecraftVersion() == ServerVersion.UNKNOWN_VERSION) {
|
||||||
|
BukkitVersion.init();
|
||||||
|
}
|
||||||
|
if (!ConfigManager.isInitialized()) {
|
||||||
|
ConfigManager.init(this);
|
||||||
|
}
|
||||||
|
if (logManager == null || logManager.getStreamID(Streams.STATUS.name) != Streams.STATUS) {
|
||||||
|
logManager = new BukkitLogManager(this);
|
||||||
|
StaticLog.setStreamID(Streams.INIT);
|
||||||
|
StaticLog.setUseLogManager(true);
|
||||||
|
logManager.info(Streams.INIT, "[NoCheatPlus] Logging system initialized.");
|
||||||
|
logManager.info(Streams.INIT, "[NoCheatPlus] Detected Minecraft version: " + ServerVersion.getMinecraftVersion());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
@ -764,23 +778,20 @@ public class NoCheatPlus extends JavaPlugin implements NoCheatPlusAPI {
|
|||||||
TickTask.cancel();
|
TickTask.cancel();
|
||||||
TickTask.reset();
|
TickTask.reset();
|
||||||
|
|
||||||
// Allow entries to TickTask (just in case).
|
// Allow entries to TickTask.
|
||||||
TickTask.setLocked(false);
|
TickTask.setLocked(false);
|
||||||
|
|
||||||
// Initialize configuration, if needed.
|
// Re-check basic setup (if onLoad gets skipped by some custom thing).
|
||||||
if (!ConfigManager.isInitialized()) {
|
setupBasics();
|
||||||
// Read the configuration files (should only happen on reloading).
|
|
||||||
ConfigManager.init(this);
|
// Start logger task(s).
|
||||||
}
|
logManager.startTasks();
|
||||||
|
|
||||||
final ConfigFile config = ConfigManager.getConfigFile();
|
final ConfigFile config = ConfigManager.getConfigFile();
|
||||||
|
|
||||||
useSubscriptions = config.getBoolean(ConfPaths.LOGGING_BACKEND_INGAMECHAT_SUBSCRIPTIONS);
|
useSubscriptions = config.getBoolean(ConfPaths.LOGGING_BACKEND_INGAMECHAT_SUBSCRIPTIONS);
|
||||||
|
|
||||||
// Start logger task(s).
|
// Listener manager.
|
||||||
logManager.startTasks();
|
|
||||||
|
|
||||||
|
|
||||||
manageListeners = config.getBoolean(ConfPaths.COMPATIBILITY_MANAGELISTENERS);
|
manageListeners = config.getBoolean(ConfPaths.COMPATIBILITY_MANAGELISTENERS);
|
||||||
if (manageListeners) {
|
if (manageListeners) {
|
||||||
listenerManager.setRegisterDirectly(true);
|
listenerManager.setRegisterDirectly(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user