Fix sponge PEX/PM migration issue with defaults

This commit is contained in:
Luck 2017-01-29 21:56:09 +00:00
parent ab9284b80f
commit a61d3b3fd4
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
3 changed files with 13 additions and 0 deletions

View File

@ -152,6 +152,13 @@ public class User extends PermissionHolder implements Identifiable<UserIdentifie
getPlugin().getUserManager().giveDefaultIfNeeded(this, false);
}
public void clearNodes(boolean giveDefault) {
super.clearNodes();
if (giveDefault) {
getPlugin().getUserManager().giveDefaultIfNeeded(this, false);
}
}
public void cleanup() {
UserCache cache = userData;
if (cache != null) {

View File

@ -127,6 +127,9 @@ public class MigrationPermissionManager extends SubCommand<Object> {
// Make a LuckPerms user for the one being migrated
plugin.getStorage().loadUser(uuid, "null").join();
User user = plugin.getUserManager().get(uuid);
if (user.getNodes().size() <= 1) {
user.clearNodes(false);
}
migrateSubject(pmUser, user);
plugin.getStorage().saveUser(user);
plugin.getUserManager().cleanup(user);

View File

@ -153,6 +153,9 @@ public class MigrationPermissionsEx extends SubCommand<Object> {
// Make a LuckPerms user for the one being migrated
plugin.getStorage().loadUser(uuid, "null").join();
User user = plugin.getUserManager().get(uuid);
if (user.getNodes().size() <= 1) {
user.clearNodes(false);
}
migrateSubject(pexUser, user);
plugin.getStorage().saveUser(user);
plugin.getUserManager().cleanup(user);