Fix exporting users not in the default group

This commit is contained in:
Luck 2016-10-04 20:48:58 +01:00
parent 56df2477ca
commit 80d2246634
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
2 changed files with 13 additions and 1 deletions

View File

@ -127,14 +127,24 @@ public class ExportCommand extends SingleMainCommand {
plugin.getDatastore().loadUser(uuid, "null");
User user = plugin.getUserManager().get(uuid);
boolean inDefault = false;
for (Node node : user.getNodes()) {
if (node.isGroupNode() && node.getGroupName().equalsIgnoreCase("default")) {
inDefault = true;
continue;
}
write(writer, nodeToString(node, user.getUuid().toString(), false));
}
if (!user.getPrimaryGroup().equalsIgnoreCase("default")) {
write(writer, "/luckperms user " + user.getUuid().toString() + " setprimarygroup " + user.getPrimaryGroup());
}
if (!inDefault) {
write(writer, "/luckperms user " + user.getUuid().toString() + " removegroup default");
}
plugin.getUserManager().cleanup(user);
}
log.info("Export: Exported " + userCount + " users.");

View File

@ -24,11 +24,13 @@ package me.lucko.luckperms.contexts;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.ToString;
import java.util.Collections;
import java.util.Map;
@Getter
@ToString
@AllArgsConstructor
public class Contexts {
public static Contexts allowAll() {