mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2025-01-07 16:28:13 +01:00
Change registration order in enable / disable.
This commit is contained in:
parent
c89e6c6957
commit
b262753f4f
@ -73,6 +73,7 @@ public class NoCheatPlus extends JavaPlugin implements Listener {
|
|||||||
* @param listener
|
* @param listener
|
||||||
*/
|
*/
|
||||||
private void addListener(final Listener listener){
|
private void addListener(final Listener listener){
|
||||||
|
Bukkit.getPluginManager().registerEvents(listener, this);
|
||||||
listeners.add(listener);
|
listeners.add(listener);
|
||||||
if (listener instanceof INotifyReload){
|
if (listener instanceof INotifyReload){
|
||||||
notifyReload.add((INotifyReload) listener);
|
notifyReload.add((INotifyReload) listener);
|
||||||
@ -92,6 +93,9 @@ public class NoCheatPlus extends JavaPlugin implements Listener {
|
|||||||
* |____/|_|___/\__,_|_.__/|_|\___|
|
* |____/|_|___/\__,_|_.__/|_|\___|
|
||||||
*/
|
*/
|
||||||
final PluginDescriptionFile pdfFile = getDescription();
|
final PluginDescriptionFile pdfFile = getDescription();
|
||||||
|
|
||||||
|
// Just to be sure nothing gets left out.
|
||||||
|
getServer().getScheduler().cancelTasks(this);
|
||||||
|
|
||||||
// Stop the lag measuring task.
|
// Stop the lag measuring task.
|
||||||
LagMeasureTask.cancel();
|
LagMeasureTask.cancel();
|
||||||
@ -105,9 +109,6 @@ public class NoCheatPlus extends JavaPlugin implements Listener {
|
|||||||
// Cleanup the configuration manager.
|
// Cleanup the configuration manager.
|
||||||
ConfigManager.cleanup();
|
ConfigManager.cleanup();
|
||||||
|
|
||||||
// Just to be sure nothing gets left out.
|
|
||||||
getServer().getScheduler().cancelTasks(this);
|
|
||||||
|
|
||||||
// Tell the server administrator the we finished unloading NoCheatPlus.
|
// Tell the server administrator the we finished unloading NoCheatPlus.
|
||||||
System.out.println("[NoCheatPlus] Version " + pdfFile.getVersion() + " is disabled.");
|
System.out.println("[NoCheatPlus] Version " + pdfFile.getVersion() + " is disabled.");
|
||||||
}
|
}
|
||||||
@ -124,11 +125,12 @@ public class NoCheatPlus extends JavaPlugin implements Listener {
|
|||||||
* | |___| | | | (_| | |_) | | __/
|
* | |___| | | | (_| | |_) | | __/
|
||||||
* |_____|_| |_|\__,_|_.__/|_|\___|
|
* |_____|_| |_|\__,_|_.__/|_|\___|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Read the configuration files.
|
// Read the configuration files.
|
||||||
ConfigManager.init(this);
|
ConfigManager.init(this);
|
||||||
|
|
||||||
// List the events listeners.
|
// List the events listeners and register.
|
||||||
listeners.clear();
|
Bukkit.getPluginManager().registerEvents(this, this);
|
||||||
for (final Listener listener : new Listener[]{
|
for (final Listener listener : new Listener[]{
|
||||||
new BlockBreakListener(),
|
new BlockBreakListener(),
|
||||||
new BlockInteractListener(),
|
new BlockInteractListener(),
|
||||||
@ -141,18 +143,13 @@ public class NoCheatPlus extends JavaPlugin implements Listener {
|
|||||||
}){
|
}){
|
||||||
addListener(listener);
|
addListener(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Register the commands handler.
|
||||||
|
getCommand("nocheatplus").setExecutor(new CommandHandler(this, notifyReload));
|
||||||
|
|
||||||
// Set up a task to monitor server lag.
|
// Set up a task to monitor server lag.
|
||||||
LagMeasureTask.start(this);
|
LagMeasureTask.start(this);
|
||||||
|
|
||||||
// Register all listeners.
|
|
||||||
for (final Listener listener : listeners)
|
|
||||||
Bukkit.getPluginManager().registerEvents(listener, this);
|
|
||||||
Bukkit.getPluginManager().registerEvents(this, this);
|
|
||||||
|
|
||||||
// Register the commands handler.
|
|
||||||
getCommand("nocheatplus").setExecutor(new CommandHandler(this, notifyReload));
|
|
||||||
|
|
||||||
ConfigFile config = ConfigManager.getConfigFile();
|
ConfigFile config = ConfigManager.getConfigFile();
|
||||||
|
|
||||||
// Setup the graphs, plotters and start Metrics.
|
// Setup the graphs, plotters and start Metrics.
|
||||||
|
Loading…
Reference in New Issue
Block a user