Merge pull request #443 from hydrox/fixDroxPermsPrimaryGroupProblem

Fix DroxPerms interaction with primary group
This commit is contained in:
Nick Minkler 2013-07-23 06:33:45 -07:00
commit fe0d8b76cb
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