mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 15:16:45 +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>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
<artifactId>PlotSquared</artifactId>
|
<artifactId>PlotSquared</artifactId>
|
||||||
<version>3.1.1</version>
|
<version>3.1.2</version>
|
||||||
<name>PlotSquared</name>
|
<name>PlotSquared</name>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<build>
|
<build>
|
||||||
|
@ -19,6 +19,7 @@ import com.intellectualcrafters.plot.object.Location;
|
|||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.util.EconHandler;
|
import com.intellectualcrafters.plot.util.EconHandler;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
|
import com.intellectualcrafters.plot.util.MathMan;
|
||||||
import com.intellectualcrafters.plot.util.PlotGamemode;
|
import com.intellectualcrafters.plot.util.PlotGamemode;
|
||||||
import com.intellectualcrafters.plot.util.PlotWeather;
|
import com.intellectualcrafters.plot.util.PlotWeather;
|
||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||||
@ -83,19 +84,18 @@ public class BukkitPlayer extends PlotPlayer {
|
|||||||
}
|
}
|
||||||
boolean value = this.player.hasPermission(node);
|
boolean value = this.player.hasPermission(node);
|
||||||
if (!value) {
|
if (!value) {
|
||||||
Permission perm = Bukkit.getServer().getPluginManager().getPermission(node);
|
final String[] nodes = node.split("\\.");
|
||||||
if (perm == null) {
|
if (!MathMan.isInteger(nodes[nodes.length - 1])) {
|
||||||
perm = new Permission(node, PermissionDefault.FALSE);
|
|
||||||
Map<String, Boolean> children = perm.getChildren();
|
|
||||||
|
|
||||||
final String[] nodes = node.split("\\.");
|
|
||||||
final StringBuilder n = new StringBuilder();
|
final StringBuilder n = new StringBuilder();
|
||||||
for (int i = 0; i < (nodes.length - 1); i++) {
|
for (int i = 0; i < (nodes.length - 1); i++) {
|
||||||
n.append(nodes[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);
|
value = this.player.hasPermission(node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user