mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-30 14:13:35 +01:00
Combined Plugin and Server listener, removed plugin listener
This commit is contained in:
parent
bd1f868c6d
commit
5ff9b7550e
@ -364,7 +364,6 @@ public class AuthMe extends JavaPlugin {
|
|||||||
pm.registerEvents(new AuthMePlayerListener18(this), this);
|
pm.registerEvents(new AuthMePlayerListener18(this), this);
|
||||||
} catch (ClassNotFoundException ignore) {
|
} catch (ClassNotFoundException ignore) {
|
||||||
}
|
}
|
||||||
pm.registerEvents(new AuthMePluginListener(this), this);
|
|
||||||
pm.registerEvents(new AuthMeBlockListener(this), this);
|
pm.registerEvents(new AuthMeBlockListener(this), this);
|
||||||
pm.registerEvents(new AuthMeEntityListener(this), this);
|
pm.registerEvents(new AuthMeEntityListener(this), this);
|
||||||
pm.registerEvents(new AuthMeServerListener(this), this);
|
pm.registerEvents(new AuthMeServerListener(this), this);
|
||||||
|
@ -1,57 +0,0 @@
|
|||||||
package fr.xephi.authme.listener;
|
|
||||||
|
|
||||||
import fr.xephi.authme.AuthMe;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.server.PluginDisableEvent;
|
|
||||||
import org.bukkit.event.server.PluginEnableEvent;
|
|
||||||
import org.bukkit.plugin.Plugin;
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
public class AuthMePluginListener implements Listener {
|
|
||||||
|
|
||||||
/** Plugin instance. */
|
|
||||||
public AuthMe instance;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor.
|
|
||||||
*
|
|
||||||
* @param instance Main plugin instance.
|
|
||||||
*/
|
|
||||||
public AuthMePluginListener(AuthMe instance) {
|
|
||||||
this.instance = instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when a plugin is enabled.
|
|
||||||
*
|
|
||||||
* @param event Event reference.
|
|
||||||
*/
|
|
||||||
@EventHandler
|
|
||||||
public void onPluginEnable(PluginEnableEvent event) {
|
|
||||||
// Call the onPluginEnable method in the permissions manager
|
|
||||||
this.instance.getPermissionsManager().onPluginEnable(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Called when a plugin is disabled.
|
|
||||||
*
|
|
||||||
* @param event Event reference.
|
|
||||||
*/
|
|
||||||
@EventHandler
|
|
||||||
public void onPluginDisable(PluginDisableEvent event) {
|
|
||||||
// Get the plugin instance
|
|
||||||
Plugin plugin = event.getPlugin();
|
|
||||||
|
|
||||||
// Make sure the plugin instance isn't null
|
|
||||||
if(plugin == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Make sure it's not this plugin itself
|
|
||||||
if(plugin.equals(this.instance))
|
|
||||||
return;
|
|
||||||
|
|
||||||
// Call the onPluginDisable method in the permissions manager
|
|
||||||
this.instance.getPermissionsManager().onPluginDisable(event);
|
|
||||||
}
|
|
||||||
}
|
|
@ -12,6 +12,7 @@ import fr.xephi.authme.ConsoleLogger;
|
|||||||
import fr.xephi.authme.settings.Messages;
|
import fr.xephi.authme.settings.Messages;
|
||||||
import fr.xephi.authme.settings.Settings;
|
import fr.xephi.authme.settings.Settings;
|
||||||
import fr.xephi.authme.util.Utils;
|
import fr.xephi.authme.util.Utils;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
@ -55,7 +56,21 @@ public class AuthMeServerListener implements Listener {
|
|||||||
*/
|
*/
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onPluginDisable(PluginDisableEvent event) {
|
public void onPluginDisable(PluginDisableEvent event) {
|
||||||
String pluginName = event.getPlugin().getName();
|
// Get the plugin instance
|
||||||
|
Plugin pluginInstance = event.getPlugin();
|
||||||
|
|
||||||
|
// Make sure the plugin instance isn't null
|
||||||
|
if(pluginInstance == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Make sure it's not this plugin itself
|
||||||
|
if(pluginInstance.equals(this.plugin))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Call the onPluginDisable method in the permissions manager
|
||||||
|
this.plugin.getPermissionsManager().onPluginDisable(event);
|
||||||
|
|
||||||
|
String pluginName = pluginInstance.getName();
|
||||||
if (pluginName.equalsIgnoreCase("Essentials")) {
|
if (pluginName.equalsIgnoreCase("Essentials")) {
|
||||||
plugin.ess = null;
|
plugin.ess = null;
|
||||||
ConsoleLogger.info("Essentials has been disabled, unhook!");
|
ConsoleLogger.info("Essentials has been disabled, unhook!");
|
||||||
@ -91,6 +106,9 @@ public class AuthMeServerListener implements Listener {
|
|||||||
*/
|
*/
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void onPluginEnable(PluginEnableEvent event) {
|
public void onPluginEnable(PluginEnableEvent event) {
|
||||||
|
// Call the onPluginEnable method in the permissions manager
|
||||||
|
this.plugin.getPermissionsManager().onPluginEnable(event);
|
||||||
|
|
||||||
String pluginName = event.getPlugin().getName();
|
String pluginName = event.getPlugin().getName();
|
||||||
if (pluginName.equalsIgnoreCase("Essentials") || pluginName.equalsIgnoreCase("EssentialsSpawn"))
|
if (pluginName.equalsIgnoreCase("Essentials") || pluginName.equalsIgnoreCase("EssentialsSpawn"))
|
||||||
plugin.checkEssentials();
|
plugin.checkEssentials();
|
||||||
|
Loading…
Reference in New Issue
Block a user