fix DroxPerms interaction with primary group

This adds an option that tries to guess if the Main-group of a Player
should be changed. This feature is disabled by default to not break
backward-compatibility.
To activate this, the following needs to be added to the DroxPerms
config file:

Vault:
  useOnlySubgroups: false

remove unused DroxPerms jar
This commit is contained in:
Matthias Söhnholz 2013-07-16 12:15:28 +02:00
parent 2cb37ef0af
commit fc21c36c7e
3 changed files with 27 additions and 6 deletions

Binary file not shown.

10
pom.xml
View File

@ -57,6 +57,10 @@ Vault currently supports the following: Permissions 3, PEX, GroupManager, bPerms
<id>krinsoft</id>
<url>http://files.krinsoft.net:8085/nexus/content/groups/public</url>
</repository>
<repository>
<id>escapecraft-repo</id>
<url>http://dev.escapecraft.com/maven</url>
</repository>
</repositories>
<dependencies>
@ -73,11 +77,9 @@ Vault currently supports the following: Permissions 3, PEX, GroupManager, bPerms
<systemPath>${project.basedir}/lib/MiConomy.jar</systemPath>
</dependency>
<dependency>
<groupId>de.hydrox.bukkit.DroxPerms</groupId>
<groupId>de.hydrox.bukkit</groupId>
<artifactId>DroxPerms</artifactId>
<version>0.4.0-SNAPSHOT</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/DroxPerms-0.4.0-SNAPSHOT.jar</systemPath>
<version>0.5.0</version>
</dependency>
<dependency>
<groupId>net.krinsoft</groupId>

View File

@ -20,6 +20,7 @@ public class Permission_DroxPerms extends Permission {
private final String name = "DroxPerms";
private DroxPermsAPI API;
private boolean useOnlySubgroups;
public Permission_DroxPerms(Plugin plugin) {
this.plugin = plugin;
@ -30,6 +31,8 @@ public class Permission_DroxPerms extends Permission {
if (p != null) {
API = p.getAPI();
log.info(String.format("[%s][Permission] %s hooked.", plugin.getDescription().getName(), "DroxPerms"));
useOnlySubgroups = p.getConfig().getBoolean("Vault.useOnlySubgroups", true);
log.info(String.format("[%s][Permission] Vault.useOnlySubgroups: %s", plugin.getDescription().getName(), useOnlySubgroups));
}
}
@ -112,12 +115,28 @@ public class Permission_DroxPerms extends Permission {
@Override
public boolean playerAddGroup(String world, String player, String group) {
return API.addPlayerSubgroup(player, group);
if (useOnlySubgroups) {
return API.addPlayerSubgroup(player, group);
} else {
if ("default".equalsIgnoreCase(API.getPlayerGroup(player))) {
return API.setPlayerGroup(player, group);
} else {
return API.addPlayerSubgroup(player, group);
}
}
}
@Override
public boolean playerRemoveGroup(String world, String player, String group) {
return API.removePlayerSubgroup(player, group);
if (useOnlySubgroups) {
return API.removePlayerSubgroup(player, group);
} else {
if (group.equalsIgnoreCase(API.getPlayerGroup(player))) {
return API.setPlayerGroup(player, "default");
} else {
return API.removePlayerSubgroup(player, group);
}
}
}
@Override