mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-12-28 03:57:36 +01:00
Fix exporting users not in the default group
This commit is contained in:
parent
56df2477ca
commit
80d2246634
@ -127,14 +127,24 @@ public class ExportCommand extends SingleMainCommand {
|
|||||||
plugin.getDatastore().loadUser(uuid, "null");
|
plugin.getDatastore().loadUser(uuid, "null");
|
||||||
User user = plugin.getUserManager().get(uuid);
|
User user = plugin.getUserManager().get(uuid);
|
||||||
|
|
||||||
|
boolean inDefault = false;
|
||||||
for (Node node : user.getNodes()) {
|
for (Node node : user.getNodes()) {
|
||||||
if (node.isGroupNode() && node.getGroupName().equalsIgnoreCase("default")) {
|
if (node.isGroupNode() && node.getGroupName().equalsIgnoreCase("default")) {
|
||||||
|
inDefault = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
write(writer, nodeToString(node, user.getUuid().toString(), false));
|
write(writer, nodeToString(node, user.getUuid().toString(), false));
|
||||||
}
|
}
|
||||||
|
|
||||||
write(writer, "/luckperms user " + user.getUuid().toString() + " setprimarygroup " + user.getPrimaryGroup());
|
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);
|
plugin.getUserManager().cleanup(user);
|
||||||
}
|
}
|
||||||
log.info("Export: Exported " + userCount + " users.");
|
log.info("Export: Exported " + userCount + " users.");
|
||||||
|
@ -24,11 +24,13 @@ package me.lucko.luckperms.contexts;
|
|||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
|
@ToString
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class Contexts {
|
public class Contexts {
|
||||||
public static Contexts allowAll() {
|
public static Contexts allowAll() {
|
||||||
|
Loading…
Reference in New Issue
Block a user