Merge pull request #579 from Spyboticsguy/master

Latest DroxPerms Updates
This commit is contained in:
Nick Minkler 2014-11-30 10:33:48 -08:00
commit c3e4a56b79
3 changed files with 43 additions and 25 deletions

View File

@ -92,7 +92,7 @@ Vault currently supports the following: Permissions 3, PEX, GroupManager, bPerms
<dependency>
<groupId>de.hydrox.bukkit</groupId>
<artifactId>DroxPerms</artifactId>
<version>0.5.0</version>
<version>1.0.0-SNAPSHOT</version>
<optional>true</optional>
</dependency>
<dependency>

View File

@ -14,6 +14,7 @@ import org.bukkit.plugin.Plugin;
import de.hydrox.bukkit.DroxPerms.DroxPerms;
import de.hydrox.bukkit.DroxPerms.DroxPermsAPI;
import java.util.UUID;
public class Chat_DroxPerms extends Chat {
private static final Logger log = Logger.getLogger("Minecraft");
@ -62,9 +63,10 @@ public class Chat_DroxPerms extends Chat {
@Override
public String getPlayerPrefix(String world, String player) {
String prefix = API.getPlayerInfo(player, "prefix");
UUID uuid = API.getUUIDFromName(player);
String prefix = API.getPlayerInfo(uuid, "prefix");
if (prefix == null) {
String prigroup = API.getPlayerGroup(player);
String prigroup = API.getPlayerGroup(uuid);
prefix = API.getGroupInfo(prigroup, "prefix");
}
return prefix;
@ -72,17 +74,20 @@ public class Chat_DroxPerms extends Chat {
@Override
public void setPlayerPrefix(String world, String player, String prefix) {
API.setPlayerInfo(player, "prefix", prefix);
UUID uuid = API.getUUIDFromName(player);
API.setPlayerInfo(uuid, "prefix", prefix);
}
@Override
public String getPlayerSuffix(String world, String player) {
return API.getPlayerInfo(player, "suffix");
UUID uuid = API.getUUIDFromName(player);
return API.getPlayerInfo(uuid, "suffix");
}
@Override
public void setPlayerSuffix(String world, String player, String suffix) {
API.setPlayerInfo(player, "suffix", suffix);
UUID uuid = API.getUUIDFromName(player);
API.setPlayerInfo(uuid, "suffix", suffix);
}
@Override
@ -121,7 +126,8 @@ public class Chat_DroxPerms extends Chat {
@Override
public void setPlayerInfoInteger(String world, String player, String node, int value) {
API.setPlayerInfo(player, node, String.valueOf(value));
UUID uuid = API.getUUIDFromName(player);
API.setPlayerInfo(uuid, node, String.valueOf(value));
}
@Override
@ -159,7 +165,8 @@ public class Chat_DroxPerms extends Chat {
@Override
public void setPlayerInfoDouble(String world, String player, String node, double value) {
API.setPlayerInfo(player, node, String.valueOf(value));
UUID uuid = API.getUUIDFromName(player);
API.setPlayerInfo(uuid, node, String.valueOf(value));
}
@Override
@ -194,7 +201,8 @@ public class Chat_DroxPerms extends Chat {
@Override
public void setPlayerInfoBoolean(String world, String player, String node, boolean value) {
API.setPlayerInfo(player, node, String.valueOf(value));
UUID uuid = API.getUUIDFromName(player);
API.setPlayerInfo(uuid, node, String.valueOf(value));
}
@Override
@ -215,13 +223,15 @@ public class Chat_DroxPerms extends Chat {
@Override
public String getPlayerInfoString(String world, String player, String node, String defaultValue) {
String val = API.getPlayerInfo(player, node);
UUID uuid = API.getUUIDFromName(player);
String val = API.getPlayerInfo(uuid, node);
return val != null ? val : defaultValue;
}
@Override
public void setPlayerInfoString(String world, String player, String node, String value) {
API.setPlayerInfo(player, node, value);
UUID uuid = API.getUUIDFromName(player);
API.setPlayerInfo(uuid, node, value);
}
@Override

View File

@ -15,6 +15,7 @@ import org.bukkit.plugin.Plugin;
import de.hydrox.bukkit.DroxPerms.DroxPerms;
import de.hydrox.bukkit.DroxPerms.DroxPermsAPI;
import java.util.UUID;
public class Permission_DroxPerms extends Permission {
@ -85,12 +86,14 @@ public class Permission_DroxPerms extends Permission {
@Override
public boolean playerAdd(String world, String player, String permission) {
return API.addPlayerPermission(player, world, permission);
UUID uuid = plugin.getServer().getPlayer(player).getUniqueId();
return API.addPlayerPermission(uuid, world, permission);
}
@Override
public boolean playerRemove(String world, String player, String permission) {
return API.removePlayerPermission(player, world, permission);
UUID uuid = plugin.getServer().getPlayer(player).getUniqueId();
return API.removePlayerPermission(uuid, world, permission);
}
@Override
@ -110,45 +113,50 @@ public class Permission_DroxPerms extends Permission {
@Override
public boolean playerInGroup(String world, String player, String group) {
return API.getPlayerGroup(player).equalsIgnoreCase(group) || API.getPlayerSubgroups(player).contains(group);
UUID uuid = API.getUUIDFromName(name);
return API.getPlayerGroup(uuid).equalsIgnoreCase(group) || API.getPlayerSubgroups(uuid).contains(group);
}
@Override
public boolean playerAddGroup(String world, String player, String group) {
UUID uuid = API.getUUIDFromName(name);
if (useOnlySubgroups) {
return API.addPlayerSubgroup(player, group);
return API.addPlayerSubgroup(uuid, group);
} else {
if ("default".equalsIgnoreCase(API.getPlayerGroup(player))) {
return API.setPlayerGroup(player, group);
if ("default".equalsIgnoreCase(API.getPlayerGroup(uuid))) {
return API.setPlayerGroup(uuid, group);
} else {
return API.addPlayerSubgroup(player, group);
return API.addPlayerSubgroup(uuid, group);
}
}
}
@Override
public boolean playerRemoveGroup(String world, String player, String group) {
UUID uuid = API.getUUIDFromName(name);
if (useOnlySubgroups) {
return API.removePlayerSubgroup(player, group);
return API.removePlayerSubgroup(uuid, group);
} else {
if (group.equalsIgnoreCase(API.getPlayerGroup(player))) {
return API.setPlayerGroup(player, "default");
if (group.equalsIgnoreCase(API.getPlayerGroup(uuid))) {
return API.setPlayerGroup(uuid, "default");
} else {
return API.removePlayerSubgroup(player, group);
return API.removePlayerSubgroup(uuid, group);
}
}
}
@Override
public String[] getPlayerGroups(String world, String player) {
ArrayList<String> array = API.getPlayerSubgroups(player);
array.add(API.getPlayerGroup(player));
UUID uuid = plugin.getServer().getPlayer(player).getUniqueId();
ArrayList<String> array = API.getPlayerSubgroups(uuid);
array.add(API.getPlayerGroup(uuid));
return array.toArray(new String[0]);
}
@Override
public String getPrimaryGroup(String world, String player) {
return API.getPlayerGroup(player);
UUID uuid = plugin.getServer().getPlayer(player).getUniqueId();
return API.getPlayerGroup(uuid);
}
@Override