mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-12-28 17:38:01 +01:00
Fix permission checking
This commit is contained in:
parent
75f189aae8
commit
5f8505e698
2
pom.xml
2
pom.xml
@ -8,7 +8,7 @@
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<artifactId>PlotSquared</artifactId>
|
||||
<version>3.1.1</version>
|
||||
<version>3.1.2</version>
|
||||
<name>PlotSquared</name>
|
||||
<packaging>jar</packaging>
|
||||
<build>
|
||||
|
@ -19,6 +19,7 @@ import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.EconHandler;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.MathMan;
|
||||
import com.intellectualcrafters.plot.util.PlotGamemode;
|
||||
import com.intellectualcrafters.plot.util.PlotWeather;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
@ -83,19 +84,18 @@ public class BukkitPlayer extends PlotPlayer {
|
||||
}
|
||||
boolean value = this.player.hasPermission(node);
|
||||
if (!value) {
|
||||
Permission perm = Bukkit.getServer().getPluginManager().getPermission(node);
|
||||
if (perm == null) {
|
||||
perm = new Permission(node, PermissionDefault.FALSE);
|
||||
Map<String, Boolean> children = perm.getChildren();
|
||||
|
||||
final String[] nodes = node.split("\\.");
|
||||
if (!MathMan.isInteger(nodes[nodes.length - 1])) {
|
||||
final StringBuilder n = new StringBuilder();
|
||||
for (int i = 0; i < (nodes.length - 1); i++) {
|
||||
n.append(nodes[i] + ("."));
|
||||
children.put(n + C.PERMISSION_STAR.s(), true);
|
||||
if (!node.equals(n + C.PERMISSION_STAR.s())) {
|
||||
value = player.hasPermission(n + C.PERMISSION_STAR.s());
|
||||
if (value) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Bukkit.getServer().getPluginManager().addPermission(perm);
|
||||
Bukkit.getServer().getPluginManager().recalculatePermissionDefaults(perm);
|
||||
value = this.player.hasPermission(node);
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user