Fix sponge PEX/PM migration issue with defaults
This commit is contained in:
parent
ab9284b80f
commit
a61d3b3fd4
@ -152,6 +152,13 @@ public class User extends PermissionHolder implements Identifiable<UserIdentifie
|
|||||||
getPlugin().getUserManager().giveDefaultIfNeeded(this, false);
|
getPlugin().getUserManager().giveDefaultIfNeeded(this, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void clearNodes(boolean giveDefault) {
|
||||||
|
super.clearNodes();
|
||||||
|
if (giveDefault) {
|
||||||
|
getPlugin().getUserManager().giveDefaultIfNeeded(this, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void cleanup() {
|
public void cleanup() {
|
||||||
UserCache cache = userData;
|
UserCache cache = userData;
|
||||||
if (cache != null) {
|
if (cache != null) {
|
||||||
|
@ -127,6 +127,9 @@ public class MigrationPermissionManager extends SubCommand<Object> {
|
|||||||
// Make a LuckPerms user for the one being migrated
|
// Make a LuckPerms user for the one being migrated
|
||||||
plugin.getStorage().loadUser(uuid, "null").join();
|
plugin.getStorage().loadUser(uuid, "null").join();
|
||||||
User user = plugin.getUserManager().get(uuid);
|
User user = plugin.getUserManager().get(uuid);
|
||||||
|
if (user.getNodes().size() <= 1) {
|
||||||
|
user.clearNodes(false);
|
||||||
|
}
|
||||||
migrateSubject(pmUser, user);
|
migrateSubject(pmUser, user);
|
||||||
plugin.getStorage().saveUser(user);
|
plugin.getStorage().saveUser(user);
|
||||||
plugin.getUserManager().cleanup(user);
|
plugin.getUserManager().cleanup(user);
|
||||||
|
@ -153,6 +153,9 @@ public class MigrationPermissionsEx extends SubCommand<Object> {
|
|||||||
// Make a LuckPerms user for the one being migrated
|
// Make a LuckPerms user for the one being migrated
|
||||||
plugin.getStorage().loadUser(uuid, "null").join();
|
plugin.getStorage().loadUser(uuid, "null").join();
|
||||||
User user = plugin.getUserManager().get(uuid);
|
User user = plugin.getUserManager().get(uuid);
|
||||||
|
if (user.getNodes().size() <= 1) {
|
||||||
|
user.clearNodes(false);
|
||||||
|
}
|
||||||
migrateSubject(pexUser, user);
|
migrateSubject(pexUser, user);
|
||||||
plugin.getStorage().saveUser(user);
|
plugin.getStorage().saveUser(user);
|
||||||
plugin.getUserManager().cleanup(user);
|
plugin.getUserManager().cleanup(user);
|
||||||
|
Loading…
Reference in New Issue
Block a user