mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2025-04-01 01:05:46 +02:00
Clean permission/group providers
This commit is contained in:
parent
dcc365c22f
commit
7e6abf0441
57
pom.xml
57
pom.xml
@ -439,10 +439,15 @@
|
||||
<!-- bPermissions plugin -->
|
||||
<dependency>
|
||||
<groupId>de.bananaco</groupId>
|
||||
<artifactId>bpermissions</artifactId>
|
||||
<version>1.12-DEV</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/lib/bPermissions-2.12-DEV.jar</systemPath>
|
||||
<artifactId>bPermissions</artifactId>
|
||||
<version>2.12-DEV</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- zPermissions plugin -->
|
||||
@ -450,17 +455,33 @@
|
||||
<groupId>org.tyrannyofheaven.bukkit</groupId>
|
||||
<artifactId>zPermissions</artifactId>
|
||||
<version>1.3-SNAPSHOT</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/lib/zPermissions-1.3beta1.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
<!-- Permissions plugin (obsolete) -->
|
||||
<dependency>
|
||||
<groupId>com.nijiko</groupId>
|
||||
<artifactId>permissions</artifactId>
|
||||
<version>3.1.6</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/lib/Permission-3.1.6.jar</systemPath>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>bukkit</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.sk89q</groupId>
|
||||
<artifactId>worldguard</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.sk89q</groupId>
|
||||
<artifactId>worldedit</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>VaultAPI</artifactId>
|
||||
<groupId>net.milkbowl.vault</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>uuidprovider</artifactId>
|
||||
<groupId>net.kaikk.mc</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>ToHPluginUtils</artifactId>
|
||||
<groupId>org.tyrannyofheaven.bukkit</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- Vault, http://dev.bukkit.org/bukkit-plugins/vault/ -->
|
||||
@ -692,6 +713,12 @@
|
||||
<scope>test</scope>
|
||||
<version>2.0.5-beta</version>
|
||||
<optional>true</optional>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>hamcrest-core</artifactId>
|
||||
<groupId>org.hamcrest</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- String comparison library. Used for dynamic help system. -->
|
||||
|
@ -4,7 +4,6 @@ import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||
import fr.xephi.authme.command.CommandParts;
|
||||
import fr.xephi.authme.command.ExecutableCommand;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -12,7 +12,6 @@ import fr.xephi.authme.settings.Settings;
|
||||
import fr.xephi.authme.task.MessageTask;
|
||||
import fr.xephi.authme.task.TimeoutTask;
|
||||
import fr.xephi.authme.util.Utils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
|
@ -6,7 +6,6 @@ import fr.xephi.authme.AuthMe;
|
||||
import fr.xephi.authme.ConsoleLogger;
|
||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||
import fr.xephi.authme.datasource.CacheDataSource;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.messaging.PluginMessageListener;
|
||||
|
||||
|
@ -1,8 +1,5 @@
|
||||
package fr.xephi.authme.permission;
|
||||
|
||||
import com.nijiko.permissions.Group;
|
||||
import com.nijiko.permissions.PermissionHandler;
|
||||
import com.nijikokun.bukkit.Permissions.Permissions;
|
||||
import de.bananaco.bpermissions.api.ApiLayer;
|
||||
import de.bananaco.bpermissions.api.CalculableType;
|
||||
import fr.xephi.authme.command.CommandDescription;
|
||||
@ -67,10 +64,6 @@ public class PermissionsManager implements PermissionsService {
|
||||
* Essentials group manager instance.
|
||||
*/
|
||||
private GroupManager groupManagerPerms;
|
||||
/**
|
||||
* Permissions manager instance for the legacy permissions system.
|
||||
*/
|
||||
private PermissionHandler defaultPerms;
|
||||
/**
|
||||
* zPermissions service instance.
|
||||
*/
|
||||
@ -213,20 +206,6 @@ public class PermissionsManager implements PermissionsService {
|
||||
System.out.println("[" + plugin.getName() + "] Error while hooking into Vault Permissions!");
|
||||
}
|
||||
|
||||
// Permissions, check if it's available
|
||||
try {
|
||||
Plugin testPerms = pm.getPlugin("Permissions");
|
||||
if (testPerms != null) {
|
||||
permsType = PermissionsSystemType.PERMISSIONS;
|
||||
this.defaultPerms = ((Permissions) testPerms).getHandler();
|
||||
System.out.println("[" + plugin.getName() + "] Hooked into Permissions!");
|
||||
return PermissionsSystemType.PERMISSIONS;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
// An error occurred, show a warning message
|
||||
System.out.println("[" + plugin.getName() + "] Error while hooking into Permissions!");
|
||||
}
|
||||
|
||||
// No recognized permissions system found
|
||||
permsType = PermissionsSystemType.NONE;
|
||||
System.out.println("[" + plugin.getName() + "] No supported permissions system found! Permissions disabled!");
|
||||
@ -398,10 +377,6 @@ public class PermissionsManager implements PermissionsService {
|
||||
// Vault
|
||||
return vaultPerms.has(player, permsNode);
|
||||
|
||||
case PERMISSIONS:
|
||||
// Permissions
|
||||
return this.defaultPerms.has(player, permsNode);
|
||||
|
||||
case NONE:
|
||||
// Not hooked into any permissions system, return default
|
||||
return def;
|
||||
@ -493,18 +468,6 @@ public class PermissionsManager implements PermissionsService {
|
||||
// Vault
|
||||
return Arrays.asList(vaultPerms.getPlayerGroups(player));
|
||||
|
||||
case PERMISSIONS:
|
||||
// Permissions
|
||||
// Create a list to put the groups in
|
||||
List<String> groups = new ArrayList<>();
|
||||
|
||||
// Get the groups and add each to the list
|
||||
for (Group group : this.defaultPerms.getGroups(player.getName()))
|
||||
groups.add(group.getName());
|
||||
|
||||
// Return the groups
|
||||
return groups;
|
||||
|
||||
case NONE:
|
||||
// Not hooked into any permissions system, return an empty list
|
||||
return new ArrayList<>();
|
||||
@ -612,10 +575,6 @@ public class PermissionsManager implements PermissionsService {
|
||||
// Vault
|
||||
return vaultPerms.playerInGroup(player, groupName);
|
||||
|
||||
case PERMISSIONS:
|
||||
// Permissions
|
||||
return this.defaultPerms.inGroup(player.getWorld().getName(), player.getName(), groupName);
|
||||
|
||||
case NONE:
|
||||
// Not hooked into any permissions system, return an empty list
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user