mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-28 05:35:26 +01:00
Match negative priorities and fix PEX weight migration
This commit is contained in:
parent
ba10b1c06e
commit
a217727bb4
@ -128,11 +128,9 @@ public class MigrationPermissionsEx extends SubCommand<Object> {
|
||||
int groupCount = 0;
|
||||
|
||||
for (PermissionGroup group : manager.getGroupList()) {
|
||||
int groupWeight = group.getWeight() * -1;
|
||||
groupCount ++;
|
||||
|
||||
if (group.getWeight() > maxGroupWeight) {
|
||||
maxGroupWeight = group.getWeight();
|
||||
}
|
||||
maxGroupWeight = Math.max(maxGroupWeight, groupWeight);
|
||||
|
||||
final String name = group.getName().toLowerCase();
|
||||
plugin.getDatastore().createAndLoadGroup(name);
|
||||
@ -232,10 +230,10 @@ public class MigrationPermissionsEx extends SubCommand<Object> {
|
||||
if (prefix != null && !prefix.equals("")) {
|
||||
prefix = ArgumentChecker.escapeCharacters(prefix);
|
||||
try {
|
||||
lpGroup.setPermission("prefix." + group.getWeight() + "." + prefix, true);
|
||||
lpGroup.setPermission("prefix." + groupWeight + "." + prefix, true);
|
||||
LogEntry.build()
|
||||
.actor(Constants.getConsoleUUID()).actorName(Constants.getConsoleName())
|
||||
.acted(lpGroup).action("set prefix." + group.getWeight() + "." + prefix + " true")
|
||||
.acted(lpGroup).action("set prefix." + groupWeight + "." + prefix + " true")
|
||||
.build().submit(plugin);
|
||||
} catch (Exception ex) {
|
||||
if (!(ex instanceof ObjectAlreadyHasException)) {
|
||||
@ -247,10 +245,10 @@ public class MigrationPermissionsEx extends SubCommand<Object> {
|
||||
if (suffix != null && !suffix.equals("")) {
|
||||
suffix = ArgumentChecker.escapeCharacters(suffix);
|
||||
try {
|
||||
lpGroup.setPermission("suffix." + group.getWeight() + "." + suffix, true);
|
||||
lpGroup.setPermission("suffix." + groupWeight + "." + suffix, true);
|
||||
LogEntry.build()
|
||||
.actor(Constants.getConsoleUUID()).actorName(Constants.getConsoleName())
|
||||
.acted(lpGroup).action("set suffix." + group.getWeight() + "." + suffix + " true")
|
||||
.acted(lpGroup).action("set suffix." + groupWeight + "." + suffix + " true")
|
||||
.build().submit(plugin);
|
||||
} catch (Exception ex) {
|
||||
if (!(ex instanceof ObjectAlreadyHasException)) {
|
||||
|
@ -38,8 +38,8 @@ import java.util.stream.Collectors;
|
||||
@ToString
|
||||
@EqualsAndHashCode
|
||||
public class Node implements me.lucko.luckperms.api.Node {
|
||||
private static final Pattern PREFIX_PATTERN = Pattern.compile("(?i)prefix\\.\\d+\\..*");
|
||||
private static final Pattern SUFFIX_PATTERN = Pattern.compile("(?i)suffix\\.\\d+\\..*");
|
||||
private static final Pattern PREFIX_PATTERN = Pattern.compile("(?i)prefix\\.-?\\d+\\..*");
|
||||
private static final Pattern SUFFIX_PATTERN = Pattern.compile("(?i)suffix\\.-?\\d+\\..*");
|
||||
|
||||
public static me.lucko.luckperms.api.Node fromSerialisedNode(String s, Boolean b) {
|
||||
return builderFromSerialisedNode(s, b).build();
|
||||
|
Loading…
Reference in New Issue
Block a user