mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2025-01-31 20:52:10 +01:00
Fix some issues with null world contexts in migration scripts
This commit is contained in:
parent
06f7900318
commit
dce792083b
@ -86,7 +86,7 @@ public class MigrationGroupManager extends SubCommand<Object> {
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
final boolean migrateAsGlobal = Boolean.parseBoolean(args.get(0));
|
||||
final Function<String, String> worldMappingFunc = s -> migrateAsGlobal ? null : s;
|
||||
final Function<String, String> worldMappingFunc = s -> migrateAsGlobal || s == null ? "global" : s;
|
||||
|
||||
if (!Bukkit.getPluginManager().isPluginEnabled("GroupManager")) {
|
||||
log.logError("Plugin not loaded.");
|
||||
@ -145,7 +145,7 @@ public class MigrationGroupManager extends SubCommand<Object> {
|
||||
}
|
||||
for (String s : group.getInherits()) {
|
||||
if (s.isEmpty()) continue;
|
||||
groups.get(groupName).add(Inheritance.builder(MigrationUtils.standardizeName(s)).value(true).withContext(DefaultContextKeys.SERVER_KEY, null).withContext(DefaultContextKeys.WORLD_KEY, worldMappingFunc.apply(world)).build());
|
||||
groups.get(groupName).add(Inheritance.builder(MigrationUtils.standardizeName(s)).value(true).withContext(DefaultContextKeys.WORLD_KEY, worldMappingFunc.apply(world)).build());
|
||||
}
|
||||
|
||||
String[] metaKeys = group.getVariables().getVarKeyList();
|
||||
|
@ -313,12 +313,9 @@ public class MigrationPermissionsEx extends SubCommand<Object> {
|
||||
}
|
||||
|
||||
private static String standardizeWorld(String world) {
|
||||
if (world != null && (world.isEmpty() || world.equals("*"))) {
|
||||
world = null;
|
||||
if (world == null || world.isEmpty() || world.equals("*")) {
|
||||
world = "global";
|
||||
}
|
||||
if (world != null) {
|
||||
world = world.toLowerCase();
|
||||
}
|
||||
return world;
|
||||
return world.toLowerCase();
|
||||
}
|
||||
}
|
||||
|
@ -309,7 +309,7 @@ public class MigrationPowerfulPerms extends SubCommand<Object> {
|
||||
server = "global";
|
||||
}
|
||||
|
||||
NodeBuilder nb = NodeBuilders.determineMostApplicable(node).value(value);
|
||||
NodeBuilder<?, ?> nb = NodeBuilders.determineMostApplicable(node).value(value);
|
||||
if (expireAt != 0) nb.expiry(expireAt);
|
||||
if (server != null) nb.withContext(DefaultContextKeys.SERVER_KEY, server);
|
||||
if (world != null) nb.withContext(DefaultContextKeys.WORLD_KEY, world);
|
||||
@ -325,7 +325,7 @@ public class MigrationPowerfulPerms extends SubCommand<Object> {
|
||||
expireAt = g.getExpirationDate().getTime() / 1000L;
|
||||
}
|
||||
|
||||
NodeBuilder nb = Inheritance.builder(MigrationUtils.standardizeName(group.getName()));
|
||||
NodeBuilder<?, ?> nb = Inheritance.builder(MigrationUtils.standardizeName(group.getName()));
|
||||
|
||||
if (expireAt != 0) {
|
||||
nb.expiry(expireAt);
|
||||
|
Loading…
Reference in New Issue
Block a user