mirror of
https://github.com/MilkBowl/Vault.git
synced 2024-11-14 14:45:37 +01:00
fix P3 player has permission check.
This commit is contained in:
parent
171c8c9ad3
commit
4e93a060e6
@ -80,7 +80,7 @@ public class Permission_Permissions3 extends Permission {
|
||||
}
|
||||
|
||||
public class PermissionServerListener implements Listener {
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPluginEnable(PluginEnableEvent event) {
|
||||
if (permission == null) {
|
||||
@ -122,38 +122,42 @@ public class Permission_Permissions3 extends Permission {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean has(Player player, String permission) {
|
||||
return has(player.getWorld().getName(), player.getName(), permission);
|
||||
}
|
||||
|
||||
public boolean playerAddGroup(String worldName, String playerName, String groupName) {
|
||||
if (worldName == null)
|
||||
worldName = "*";
|
||||
|
||||
Group g = perms.getGroupObject(worldName, groupName);
|
||||
if (g == null) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
perms.safeGetUser(worldName, playerName).addParent(g);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
if (worldName == null)
|
||||
worldName = "*";
|
||||
|
||||
Group g = perms.getGroupObject(worldName, groupName);
|
||||
if (g == null) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
perms.safeGetUser(worldName, playerName).addParent(g);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerRemoveGroup(String worldName, String playerName, String groupName) {
|
||||
if (worldName == null)
|
||||
worldName = "*";
|
||||
|
||||
Group g = perms.getGroupObject(worldName, groupName);
|
||||
if (g == null) {
|
||||
return false;
|
||||
}
|
||||
if (worldName == null)
|
||||
worldName = "*";
|
||||
|
||||
Group g = perms.getGroupObject(worldName, groupName);
|
||||
if (g == null) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
perms.safeGetUser(worldName, playerName).removeParent(g);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
perms.safeGetUser(worldName, playerName).removeParent(g);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -171,31 +175,31 @@ public class Permission_Permissions3 extends Permission {
|
||||
|
||||
@Override
|
||||
public boolean groupAdd(String worldName, String groupName, String permission) {
|
||||
if (worldName == null)
|
||||
worldName = "*";
|
||||
|
||||
perms.addGroupPermission(worldName, groupName, permission);
|
||||
if (worldName == null)
|
||||
worldName = "*";
|
||||
|
||||
perms.addGroupPermission(worldName, groupName, permission);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean groupRemove(String worldName, String groupName, String permission) {
|
||||
if (worldName == null)
|
||||
worldName = "*";
|
||||
perms.removeGroupPermission(worldName, groupName, permission);
|
||||
if (worldName == null)
|
||||
worldName = "*";
|
||||
perms.removeGroupPermission(worldName, groupName, permission);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean groupHas(String worldName, String groupName, String permission) {
|
||||
if (worldName == null)
|
||||
worldName = "*";
|
||||
try {
|
||||
return perms.safeGetGroup(worldName, groupName).hasPermission(permission);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
if (worldName == null)
|
||||
worldName = "*";
|
||||
try {
|
||||
return perms.safeGetGroup(worldName, groupName).hasPermission(permission);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -204,39 +208,39 @@ public class Permission_Permissions3 extends Permission {
|
||||
}
|
||||
|
||||
public String getPrimaryGroup(String world, String playerName) {
|
||||
return getPlayerGroups(world, playerName)[0];
|
||||
return getPlayerGroups(world, playerName)[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerHas(String worldName, String playerName, String permission) {
|
||||
Player p = plugin.getServer().getPlayer(playerName);
|
||||
if (p != null) {
|
||||
if (p.hasPermission(permission))
|
||||
return true;
|
||||
}
|
||||
Player p = plugin.getServer().getPlayer(playerName);
|
||||
if (p != null) {
|
||||
if (p.hasPermission(permission))
|
||||
return true;
|
||||
}
|
||||
return this.perms.has(worldName, playerName, permission);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean playerAddTransient(String player, String permission) {
|
||||
return playerAddTransient(null, player, permission);
|
||||
return playerAddTransient(null, player, permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerAddTransient(Player player, String permission) {
|
||||
return playerAddTransient(null, player.getName(), permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@Override
|
||||
public boolean playerAddTransient(Player player, String permission) {
|
||||
return playerAddTransient(null, player.getName(), permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerAddTransient(String worldName, Player player, String permission) {
|
||||
return playerAddTransient(worldName, player.getName(), permission);
|
||||
return playerAddTransient(worldName, player.getName(), permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@Override
|
||||
public boolean playerAddTransient(String worldName, String player, String permission) {
|
||||
if (worldName == null)
|
||||
worldName = "*";
|
||||
if (worldName == null)
|
||||
worldName = "*";
|
||||
try {
|
||||
perms.safeGetUser(worldName, player).addTransientPermission(permission);
|
||||
return true;
|
||||
@ -244,49 +248,49 @@ public class Permission_Permissions3 extends Permission {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerRemoveTransient(String player, String permission) {
|
||||
return playerRemoveTransient(null, player, permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerRemoveTransient(Player player, String permission) {
|
||||
return playerRemoveTransient(null, player.getName(), permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerRemoveTransient(String worldName, Player player, String permission) {
|
||||
return playerRemoveTransient(worldName, player.getName(), permission);
|
||||
@Override
|
||||
public boolean playerRemoveTransient(String player, String permission) {
|
||||
return playerRemoveTransient(null, player, permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerRemoveTransient(String worldName, String player, String permission) {
|
||||
if (worldName == null)
|
||||
worldName = "*";
|
||||
|
||||
try {
|
||||
perms.safeGetUser(worldName, player).removeTransientPermission(permission);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getGroups() {
|
||||
|
||||
Set<String> groupNames = new HashSet<String>();
|
||||
for (World world : Bukkit.getServer().getWorlds()) {
|
||||
for (Group group : perms.getGroups(world.getName())) {
|
||||
groupNames.add(group.getName());
|
||||
}
|
||||
}
|
||||
return groupNames.toArray(new String[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasSuperPermsCompat() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean playerRemoveTransient(Player player, String permission) {
|
||||
return playerRemoveTransient(null, player.getName(), permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerRemoveTransient(String worldName, Player player, String permission) {
|
||||
return playerRemoveTransient(worldName, player.getName(), permission);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean playerRemoveTransient(String worldName, String player, String permission) {
|
||||
if (worldName == null)
|
||||
worldName = "*";
|
||||
|
||||
try {
|
||||
perms.safeGetUser(worldName, player).removeTransientPermission(permission);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getGroups() {
|
||||
|
||||
Set<String> groupNames = new HashSet<String>();
|
||||
for (World world : Bukkit.getServer().getWorlds()) {
|
||||
for (Group group : perms.getGroups(world.getName())) {
|
||||
groupNames.add(group.getName());
|
||||
}
|
||||
}
|
||||
return groupNames.toArray(new String[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasSuperPermsCompat() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user