mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-03 09:10:01 +01:00
parent
9b5009eb8c
commit
c3d07cb9a4
@ -55,10 +55,11 @@ public class AuthMeServerListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call the onPluginDisable method in the permissions manager
|
|
||||||
permissionsManager.onPluginDisable(event);
|
|
||||||
|
|
||||||
final String pluginName = event.getPlugin().getName();
|
final String pluginName = event.getPlugin().getName();
|
||||||
|
|
||||||
|
// Call the onPluginDisable method in the permissions manager
|
||||||
|
permissionsManager.onPluginDisable(pluginName);
|
||||||
|
|
||||||
if ("Essentials".equalsIgnoreCase(pluginName)) {
|
if ("Essentials".equalsIgnoreCase(pluginName)) {
|
||||||
pluginHooks.unhookEssentials();
|
pluginHooks.unhookEssentials();
|
||||||
ConsoleLogger.info("Essentials has been disabled: unhooking");
|
ConsoleLogger.info("Essentials has been disabled: unhooking");
|
||||||
@ -88,10 +89,11 @@ public class AuthMeServerListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call the onPluginEnable method in the permissions manager
|
|
||||||
permissionsManager.onPluginEnable(event);
|
|
||||||
|
|
||||||
final String pluginName = event.getPlugin().getName();
|
final String pluginName = event.getPlugin().getName();
|
||||||
|
|
||||||
|
// Call the onPluginEnable method in the permissions manager
|
||||||
|
permissionsManager.onPluginEnable(pluginName);
|
||||||
|
|
||||||
if ("Essentials".equalsIgnoreCase(pluginName)) {
|
if ("Essentials".equalsIgnoreCase(pluginName)) {
|
||||||
pluginHooks.tryHookToEssentials();
|
pluginHooks.tryHookToEssentials();
|
||||||
} else if ("Multiverse-Core".equalsIgnoreCase(pluginName)) {
|
} else if ("Multiverse-Core".equalsIgnoreCase(pluginName)) {
|
||||||
|
@ -47,11 +47,7 @@ public class PermissionsManager {
|
|||||||
*/
|
*/
|
||||||
private final Server server;
|
private final Server server;
|
||||||
private final PluginManager pluginManager;
|
private final PluginManager pluginManager;
|
||||||
/**
|
|
||||||
* Type of permissions system that is currently used.
|
|
||||||
* Null if no permissions system is hooked and/or used.
|
|
||||||
*/
|
|
||||||
private PermissionsSystemType permsType = null;
|
|
||||||
/**
|
/**
|
||||||
* The permission handler that is currently in use.
|
* The permission handler that is currently in use.
|
||||||
* Null if no permission system is hooked.
|
* Null if no permission system is hooked.
|
||||||
@ -79,15 +75,6 @@ public class PermissionsManager {
|
|||||||
return handler != null;
|
return handler != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the permissions system where the permissions manager is currently hooked into.
|
|
||||||
*
|
|
||||||
* @return The name of the permissions system used.
|
|
||||||
*/
|
|
||||||
public PermissionsSystemType getSystem() {
|
|
||||||
return permsType;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setup and hook into the permissions systems.
|
* Setup and hook into the permissions systems.
|
||||||
*/
|
*/
|
||||||
@ -96,9 +83,6 @@ public class PermissionsManager {
|
|||||||
// Force-unhook from current hooked permissions systems
|
// Force-unhook from current hooked permissions systems
|
||||||
unhook();
|
unhook();
|
||||||
|
|
||||||
// Reset used permissions system type flag
|
|
||||||
permsType = null;
|
|
||||||
|
|
||||||
// Loop through all the available permissions system types
|
// Loop through all the available permissions system types
|
||||||
for (PermissionsSystemType type : PermissionsSystemType.values()) {
|
for (PermissionsSystemType type : PermissionsSystemType.values()) {
|
||||||
// Try to find and hook the current plugin if available, print an error if failed
|
// Try to find and hook the current plugin if available, print an error if failed
|
||||||
@ -173,9 +157,6 @@ public class PermissionsManager {
|
|||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the hooked permissions system type
|
|
||||||
this.permsType = type;
|
|
||||||
|
|
||||||
// Show a success message
|
// Show a success message
|
||||||
ConsoleLogger.info("Hooked into " + type.getName() + "!");
|
ConsoleLogger.info("Hooked into " + type.getName() + "!");
|
||||||
|
|
||||||
@ -197,7 +178,6 @@ public class PermissionsManager {
|
|||||||
*/
|
*/
|
||||||
public void unhook() {
|
public void unhook() {
|
||||||
// Reset the current used permissions system
|
// Reset the current used permissions system
|
||||||
this.permsType = null;
|
|
||||||
this.handler = null;
|
this.handler = null;
|
||||||
|
|
||||||
// Print a status message to the console
|
// Print a status message to the console
|
||||||
@ -209,25 +189,20 @@ public class PermissionsManager {
|
|||||||
*
|
*
|
||||||
* @return True on success, false on failure.
|
* @return True on success, false on failure.
|
||||||
*/
|
*/
|
||||||
public boolean reload() {
|
public void reload() {
|
||||||
// Unhook all permission plugins
|
// Unhook all permission plugins
|
||||||
unhook();
|
unhook();
|
||||||
|
|
||||||
// Set up the permissions manager again, return the result
|
// Set up the permissions manager again, return the result
|
||||||
setup();
|
setup();
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method called when a plugin is being enabled.
|
* Method called when a plugin is being enabled.
|
||||||
*
|
*
|
||||||
* @param event Event instance.
|
* @param pluginName The name of the plugin being enabled.
|
||||||
*/
|
*/
|
||||||
public void onPluginEnable(PluginEnableEvent event) {
|
public void onPluginEnable(String pluginName) {
|
||||||
// Get the plugin and its name
|
|
||||||
Plugin plugin = event.getPlugin();
|
|
||||||
String pluginName = plugin.getName();
|
|
||||||
|
|
||||||
// Check if any known permissions system is enabling
|
// Check if any known permissions system is enabling
|
||||||
for (PermissionsSystemType permissionsSystemType : PermissionsSystemType.values()) {
|
for (PermissionsSystemType permissionsSystemType : PermissionsSystemType.values()) {
|
||||||
if (permissionsSystemType.isPermissionSystem(pluginName)) {
|
if (permissionsSystemType.isPermissionSystem(pluginName)) {
|
||||||
@ -241,14 +216,10 @@ public class PermissionsManager {
|
|||||||
/**
|
/**
|
||||||
* Method called when a plugin is being disabled.
|
* Method called when a plugin is being disabled.
|
||||||
*
|
*
|
||||||
* @param event Event instance.
|
* @param pluginName The name of the plugin being disabled.
|
||||||
*/
|
*/
|
||||||
public void onPluginDisable(PluginDisableEvent event) {
|
public void onPluginDisable(String pluginName) {
|
||||||
// Get the plugin instance and name
|
// Check if any known permission system is being disabled
|
||||||
Plugin plugin = event.getPlugin();
|
|
||||||
String pluginName = plugin.getName();
|
|
||||||
|
|
||||||
// Is the WorldGuard plugin disabled
|
|
||||||
for (PermissionsSystemType permissionsSystemType : PermissionsSystemType.values()) {
|
for (PermissionsSystemType permissionsSystemType : PermissionsSystemType.values()) {
|
||||||
if (permissionsSystemType.isPermissionSystem(pluginName)) {
|
if (permissionsSystemType.isPermissionSystem(pluginName)) {
|
||||||
ConsoleLogger.info(pluginName + " plugin disabled, updating hooks!");
|
ConsoleLogger.info(pluginName + " plugin disabled, updating hooks!");
|
||||||
|
Loading…
Reference in New Issue
Block a user