diff --git a/src/main/java/fr/xephi/authme/DataManager.java b/src/main/java/fr/xephi/authme/DataManager.java index edc96eee7..3d74da41e 100644 --- a/src/main/java/fr/xephi/authme/DataManager.java +++ b/src/main/java/fr/xephi/authme/DataManager.java @@ -7,6 +7,7 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; +import fr.xephi.authme.permission.PermissionsManager; import org.bukkit.Bukkit; import org.bukkit.OfflinePlayer; import org.bukkit.entity.Player; @@ -172,13 +173,28 @@ public class DataManager { ConsoleLogger.info("AutoPurgeDatabase : Remove " + i + " EssentialsFiles"); } + // TODO: What is this method for? Is it correct? /** - * Method purgePermissions. - * @param cleared List - * @param permission Permission + * @param cleared Cleared players. */ - public synchronized void purgePermissions(List cleared, Permission permission) { + public synchronized void purgePermissions(List cleared) { + // Get the permissions manager, and make sure it's valid + PermissionsManager permsMan = this.plugin.getPermissionsManager(); + if(permsMan == null) + ConsoleLogger.showError("Unable to access permissions manager instance!"); + assert permsMan != null; + int i = 0; + for (String name : cleared) { + try { + permsMan.removeAllGroups(this.getOnlinePlayerLower(name.toLowerCase())); + i++; + } catch(Exception e) { + } + } + ConsoleLogger.info("AutoPurgeDatabase : Removed " + i + " permissions"); + + /*int i = 0; for (String name : cleared) { try { OfflinePlayer p = this.getOfflinePlayer(name); @@ -189,7 +205,7 @@ public class DataManager { } catch (Exception e) { } } - ConsoleLogger.info("AutoPurgeDatabase : Remove " + i + " Permissions"); + ConsoleLogger.info("AutoPurgeDatabase : Remove " + i + " Permissions");*/ } /**