#421 Create PluginHooks
- PluginHooks manages third-party plugins and allows to perform actions and queries on them, instead of public fields on the AuthMe main class
This commit is contained in:
@@ -5,6 +5,7 @@ import fr.xephi.authme.cache.auth.PlayerCache;
|
||||
import fr.xephi.authme.command.help.HelpProvider;
|
||||
import fr.xephi.authme.datasource.DataSource;
|
||||
import fr.xephi.authme.cache.IpAddressManager;
|
||||
import fr.xephi.authme.hooks.PluginHooks;
|
||||
import fr.xephi.authme.output.MessageKey;
|
||||
import fr.xephi.authme.output.Messages;
|
||||
import fr.xephi.authme.permission.PermissionsManager;
|
||||
@@ -30,6 +31,7 @@ public class CommandService {
|
||||
private final PermissionsManager permissionsManager;
|
||||
private final NewSetting settings;
|
||||
private final IpAddressManager ipAddressManager;
|
||||
private final PluginHooks pluginHooks;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
@@ -45,7 +47,7 @@ public class CommandService {
|
||||
*/
|
||||
public CommandService(AuthMe authMe, CommandMapper commandMapper, HelpProvider helpProvider, Messages messages,
|
||||
PasswordSecurity passwordSecurity, PermissionsManager permissionsManager, NewSetting settings,
|
||||
IpAddressManager ipAddressManager) {
|
||||
IpAddressManager ipAddressManager, PluginHooks pluginHooks) {
|
||||
this.authMe = authMe;
|
||||
this.messages = messages;
|
||||
this.helpProvider = helpProvider;
|
||||
@@ -54,6 +56,7 @@ public class CommandService {
|
||||
this.permissionsManager = permissionsManager;
|
||||
this.settings = settings;
|
||||
this.ipAddressManager = ipAddressManager;
|
||||
this.pluginHooks = pluginHooks;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -195,4 +198,8 @@ public class CommandService {
|
||||
return PlayerCache.getInstance();
|
||||
}
|
||||
|
||||
public PluginHooks getPluginHooks() {
|
||||
return pluginHooks;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-1
@@ -25,7 +25,8 @@ public class PurgeBannedPlayersCommand implements ExecutableCommand {
|
||||
|
||||
// Purge the banned players
|
||||
plugin.getDataSource().purgeBanned(bannedPlayers);
|
||||
if (commandService.getProperty(PurgeSettings.REMOVE_ESSENTIALS_FILES) && plugin.ess != null)
|
||||
if (commandService.getProperty(PurgeSettings.REMOVE_ESSENTIALS_FILES)
|
||||
&& commandService.getPluginHooks().isEssentialsAvailable())
|
||||
plugin.dataManager.purgeEssentials(bannedPlayers);
|
||||
if (commandService.getProperty(PurgeSettings.REMOVE_PLAYER_DAT))
|
||||
plugin.dataManager.purgeDat(bannedPlayers);
|
||||
|
||||
@@ -47,7 +47,8 @@ public class PurgeCommand implements ExecutableCommand {
|
||||
sender.sendMessage(ChatColor.GOLD + "Deleted " + purged.size() + " user accounts");
|
||||
|
||||
// Purge other data
|
||||
if (commandService.getProperty(PurgeSettings.REMOVE_ESSENTIALS_FILES) && plugin.ess != null)
|
||||
if (commandService.getProperty(PurgeSettings.REMOVE_ESSENTIALS_FILES) &&
|
||||
commandService.getPluginHooks().isEssentialsAvailable())
|
||||
plugin.dataManager.purgeEssentials(purged);
|
||||
if (commandService.getProperty(PurgeSettings.REMOVE_PLAYER_DAT))
|
||||
plugin.dataManager.purgeDat(purged);
|
||||
|
||||
Reference in New Issue
Block a user