Deprecate GroupManager handler

This commit is contained in:
Gabriele C 2016-09-04 13:29:01 +02:00
parent 0aaaa1dda9
commit 7deb75ab85
5 changed files with 6 additions and 112 deletions

22
pom.xml
View File

@ -515,11 +515,11 @@
<!-- Spigot API, http://www.spigotmc.org/ or http://bukkit.org/ -->
<!-- Moved in profiles! -->
<!-- ProtocolLib, http://dev.bukkit.org/bukkit-plugins/protocollib/ -->
<!-- ProtocolLib -->
<dependency>
<groupId>com.comphenix.protocol</groupId>
<artifactId>ProtocolLib</artifactId>
<version>3.6.5-SNAPSHOT</version>
<artifactId>ProtocolLib-API</artifactId>
<version>4.1.0-SNAPSHOT</version>
<scope>provided</scope>
<exclusions>
<exclusion>
@ -537,7 +537,7 @@
<dependency>
<groupId>ru.tehkode</groupId>
<artifactId>PermissionsEx</artifactId>
<version>1.23.1</version>
<version>1.23.4</version>
<scope>provided</scope>
<exclusions>
<exclusion>
@ -559,20 +559,6 @@
</exclusions>
</dependency>
<!-- GroupManager plugin -->
<dependency>
<groupId>org.anjocaido</groupId>
<artifactId>groupmanagerx</artifactId>
<version>2.2-SNAPSHOT</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- bPermissions plugin -->
<dependency>
<groupId>de.bananaco</groupId>

View File

@ -3,7 +3,6 @@ package fr.xephi.authme.permission;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.initialization.Reloadable;
import fr.xephi.authme.permission.handlers.BPermissionsHandler;
import fr.xephi.authme.permission.handlers.GroupManagerHandler;
import fr.xephi.authme.permission.handlers.PermissionHandler;
import fr.xephi.authme.permission.handlers.PermissionHandlerException;
import fr.xephi.authme.permission.handlers.PermissionsBukkitHandler;
@ -11,7 +10,6 @@ import fr.xephi.authme.permission.handlers.PermissionsExHandler;
import fr.xephi.authme.permission.handlers.VaultHandler;
import fr.xephi.authme.permission.handlers.ZPermissionsHandler;
import fr.xephi.authme.util.StringUtils;
import org.anjocaido.groupmanager.GroupManager;
import org.bukkit.OfflinePlayer;
import org.bukkit.Server;
import org.bukkit.command.CommandSender;
@ -110,8 +108,6 @@ public class PermissionsManager implements Reloadable {
switch (type) {
case PERMISSIONS_EX:
return new PermissionsExHandler();
case ESSENTIALS_GROUP_MANAGER:
return new GroupManagerHandler((GroupManager) plugin);
case Z_PERMISSIONS:
return new ZPermissionsHandler();
case VAULT:

View File

@ -20,11 +20,6 @@ public enum PermissionsSystemType {
*/
B_PERMISSIONS("bPermissions", "bPermissions"),
/**
* Essentials Group Manager.
*/
ESSENTIALS_GROUP_MANAGER("Essentials Group Manager", "GroupManager"),
/**
* zPermissions.
*/

View File

@ -1,84 +0,0 @@
package fr.xephi.authme.permission.handlers;
import fr.xephi.authme.permission.PermissionNode;
import fr.xephi.authme.permission.PermissionsSystemType;
import org.anjocaido.groupmanager.GroupManager;
import org.anjocaido.groupmanager.permissions.AnjoPermissionsHandler;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class GroupManagerHandler implements PermissionHandler {
private GroupManager groupManager;
public GroupManagerHandler(GroupManager groupManager) {
this.groupManager = groupManager;
}
@Override
public boolean addToGroup(Player player, String group) {
return Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "manuaddsub " + player.getName() + " " + group);
}
@Override
public boolean hasGroupSupport() {
return true;
}
@Override
public boolean hasPermissionOffline(String name, PermissionNode node) {
final AnjoPermissionsHandler handler = groupManager.getWorldsHolder().getWorldPermissionsByPlayerName(name);
if(handler == null) {
return false;
}
List<String> perms = handler.getAllPlayersPermissions(name);
return perms.contains(node.getNode());
}
@Override
public boolean isInGroup(Player player, String group) {
final AnjoPermissionsHandler handler = groupManager.getWorldsHolder().getWorldPermissions(player);
return handler != null && handler.inGroup(player.getName(), group);
}
@Override
public boolean removeFromGroup(Player player, String group) {
return Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "manudelsub " + player.getName() + " " + group);
}
@Override
public boolean setGroup(Player player, String group) {
final AnjoPermissionsHandler handler = groupManager.getWorldsHolder().getWorldPermissions(player);
for (String groupName : handler.getGroups(player.getName())) {
removeFromGroup(player, groupName);
}
return Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "manuadd " + player.getName() + " " + group);
}
@Override
public List<String> getGroups(Player player) {
final AnjoPermissionsHandler handler = groupManager.getWorldsHolder().getWorldPermissions(player);
if (handler == null)
return new ArrayList<>();
return Arrays.asList(handler.getGroups(player.getName()));
}
@Override
public String getPrimaryGroup(Player player) {
final AnjoPermissionsHandler handler = groupManager.getWorldsHolder().getWorldPermissions(player);
if (handler == null)
return null;
return handler.getGroup(player.getName());
}
@Override
public PermissionsSystemType getPermissionSystem() {
return PermissionsSystemType.ESSENTIALS_GROUP_MANAGER;
}
}

View File

@ -8,7 +8,8 @@ softdepend:
- Vault
- PermissionsBukkit
- PermissionsEX
- EssentialsGroupManager
- bPermissions
- zPermissions
- Multiverse-Core
- Essentials
- EssentialsSpawn