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;
|
int groupCount = 0;
|
||||||
|
|
||||||
for (PermissionGroup group : manager.getGroupList()) {
|
for (PermissionGroup group : manager.getGroupList()) {
|
||||||
|
int groupWeight = group.getWeight() * -1;
|
||||||
groupCount ++;
|
groupCount ++;
|
||||||
|
maxGroupWeight = Math.max(maxGroupWeight, groupWeight);
|
||||||
if (group.getWeight() > maxGroupWeight) {
|
|
||||||
maxGroupWeight = group.getWeight();
|
|
||||||
}
|
|
||||||
|
|
||||||
final String name = group.getName().toLowerCase();
|
final String name = group.getName().toLowerCase();
|
||||||
plugin.getDatastore().createAndLoadGroup(name);
|
plugin.getDatastore().createAndLoadGroup(name);
|
||||||
@ -232,10 +230,10 @@ public class MigrationPermissionsEx extends SubCommand<Object> {
|
|||||||
if (prefix != null && !prefix.equals("")) {
|
if (prefix != null && !prefix.equals("")) {
|
||||||
prefix = ArgumentChecker.escapeCharacters(prefix);
|
prefix = ArgumentChecker.escapeCharacters(prefix);
|
||||||
try {
|
try {
|
||||||
lpGroup.setPermission("prefix." + group.getWeight() + "." + prefix, true);
|
lpGroup.setPermission("prefix." + groupWeight + "." + prefix, true);
|
||||||
LogEntry.build()
|
LogEntry.build()
|
||||||
.actor(Constants.getConsoleUUID()).actorName(Constants.getConsoleName())
|
.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);
|
.build().submit(plugin);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
if (!(ex instanceof ObjectAlreadyHasException)) {
|
if (!(ex instanceof ObjectAlreadyHasException)) {
|
||||||
@ -247,10 +245,10 @@ public class MigrationPermissionsEx extends SubCommand<Object> {
|
|||||||
if (suffix != null && !suffix.equals("")) {
|
if (suffix != null && !suffix.equals("")) {
|
||||||
suffix = ArgumentChecker.escapeCharacters(suffix);
|
suffix = ArgumentChecker.escapeCharacters(suffix);
|
||||||
try {
|
try {
|
||||||
lpGroup.setPermission("suffix." + group.getWeight() + "." + suffix, true);
|
lpGroup.setPermission("suffix." + groupWeight + "." + suffix, true);
|
||||||
LogEntry.build()
|
LogEntry.build()
|
||||||
.actor(Constants.getConsoleUUID()).actorName(Constants.getConsoleName())
|
.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);
|
.build().submit(plugin);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
if (!(ex instanceof ObjectAlreadyHasException)) {
|
if (!(ex instanceof ObjectAlreadyHasException)) {
|
||||||
|
@ -38,8 +38,8 @@ import java.util.stream.Collectors;
|
|||||||
@ToString
|
@ToString
|
||||||
@EqualsAndHashCode
|
@EqualsAndHashCode
|
||||||
public class Node implements me.lucko.luckperms.api.Node {
|
public class Node implements me.lucko.luckperms.api.Node {
|
||||||
private static final Pattern PREFIX_PATTERN = Pattern.compile("(?i)prefix\\.\\d+\\..*");
|
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 SUFFIX_PATTERN = Pattern.compile("(?i)suffix\\.-?\\d+\\..*");
|
||||||
|
|
||||||
public static me.lucko.luckperms.api.Node fromSerialisedNode(String s, Boolean b) {
|
public static me.lucko.luckperms.api.Node fromSerialisedNode(String s, Boolean b) {
|
||||||
return builderFromSerialisedNode(s, b).build();
|
return builderFromSerialisedNode(s, b).build();
|
||||||
|
Loading…
Reference in New Issue
Block a user