mirror of
https://github.com/MilkBowl/Vault.git
synced 2024-11-23 19:16:31 +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 {
|
public class PermissionServerListener implements Listener {
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onPluginEnable(PluginEnableEvent event) {
|
public void onPluginEnable(PluginEnableEvent event) {
|
||||||
if (permission == null) {
|
if (permission == null) {
|
||||||
@ -122,38 +122,42 @@ public class Permission_Permissions3 extends Permission {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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) {
|
public boolean playerAddGroup(String worldName, String playerName, String groupName) {
|
||||||
if (worldName == null)
|
if (worldName == null)
|
||||||
worldName = "*";
|
worldName = "*";
|
||||||
|
|
||||||
Group g = perms.getGroupObject(worldName, groupName);
|
Group g = perms.getGroupObject(worldName, groupName);
|
||||||
if (g == null) {
|
if (g == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
perms.safeGetUser(worldName, playerName).addParent(g);
|
perms.safeGetUser(worldName, playerName).addParent(g);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean playerRemoveGroup(String worldName, String playerName, String groupName) {
|
public boolean playerRemoveGroup(String worldName, String playerName, String groupName) {
|
||||||
if (worldName == null)
|
if (worldName == null)
|
||||||
worldName = "*";
|
worldName = "*";
|
||||||
|
|
||||||
Group g = perms.getGroupObject(worldName, groupName);
|
Group g = perms.getGroupObject(worldName, groupName);
|
||||||
if (g == null) {
|
if (g == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
perms.safeGetUser(worldName, playerName).removeParent(g);
|
perms.safeGetUser(worldName, playerName).removeParent(g);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -171,31 +175,31 @@ public class Permission_Permissions3 extends Permission {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean groupAdd(String worldName, String groupName, String permission) {
|
public boolean groupAdd(String worldName, String groupName, String permission) {
|
||||||
if (worldName == null)
|
if (worldName == null)
|
||||||
worldName = "*";
|
worldName = "*";
|
||||||
|
|
||||||
perms.addGroupPermission(worldName, groupName, permission);
|
perms.addGroupPermission(worldName, groupName, permission);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean groupRemove(String worldName, String groupName, String permission) {
|
public boolean groupRemove(String worldName, String groupName, String permission) {
|
||||||
if (worldName == null)
|
if (worldName == null)
|
||||||
worldName = "*";
|
worldName = "*";
|
||||||
perms.removeGroupPermission(worldName, groupName, permission);
|
perms.removeGroupPermission(worldName, groupName, permission);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean groupHas(String worldName, String groupName, String permission) {
|
public boolean groupHas(String worldName, String groupName, String permission) {
|
||||||
if (worldName == null)
|
if (worldName == null)
|
||||||
worldName = "*";
|
worldName = "*";
|
||||||
try {
|
try {
|
||||||
return perms.safeGetGroup(worldName, groupName).hasPermission(permission);
|
return perms.safeGetGroup(worldName, groupName).hasPermission(permission);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -204,39 +208,39 @@ public class Permission_Permissions3 extends Permission {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String getPrimaryGroup(String world, String playerName) {
|
public String getPrimaryGroup(String world, String playerName) {
|
||||||
return getPlayerGroups(world, playerName)[0];
|
return getPlayerGroups(world, playerName)[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean playerHas(String worldName, String playerName, String permission) {
|
public boolean playerHas(String worldName, String playerName, String permission) {
|
||||||
Player p = plugin.getServer().getPlayer(playerName);
|
Player p = plugin.getServer().getPlayer(playerName);
|
||||||
if (p != null) {
|
if (p != null) {
|
||||||
if (p.hasPermission(permission))
|
if (p.hasPermission(permission))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return this.perms.has(worldName, playerName, permission);
|
return this.perms.has(worldName, playerName, permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean playerAddTransient(String player, String permission) {
|
public boolean playerAddTransient(String player, String permission) {
|
||||||
return playerAddTransient(null, player, permission);
|
return playerAddTransient(null, player, permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean playerAddTransient(Player player, String permission) {
|
public boolean playerAddTransient(Player player, String permission) {
|
||||||
return playerAddTransient(null, player.getName(), permission);
|
return playerAddTransient(null, player.getName(), permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean playerAddTransient(String worldName, Player player, String permission) {
|
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) {
|
public boolean playerAddTransient(String worldName, String player, String permission) {
|
||||||
if (worldName == null)
|
if (worldName == null)
|
||||||
worldName = "*";
|
worldName = "*";
|
||||||
try {
|
try {
|
||||||
perms.safeGetUser(worldName, player).addTransientPermission(permission);
|
perms.safeGetUser(worldName, player).addTransientPermission(permission);
|
||||||
return true;
|
return true;
|
||||||
@ -244,49 +248,49 @@ public class Permission_Permissions3 extends Permission {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean playerRemoveTransient(String player, String permission) {
|
|
||||||
return playerRemoveTransient(null, player, permission);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean playerRemoveTransient(Player player, String permission) {
|
public boolean playerRemoveTransient(String player, String permission) {
|
||||||
return playerRemoveTransient(null, player.getName(), permission);
|
return playerRemoveTransient(null, player, 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
|
@Override
|
||||||
public boolean hasSuperPermsCompat() {
|
public boolean playerRemoveTransient(Player player, String permission) {
|
||||||
return false;
|
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