mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-30 14:43:29 +01:00
parent
232d17436c
commit
d8020e77fe
@ -44,6 +44,7 @@ import net.luckperms.api.model.data.DataType;
|
|||||||
import net.luckperms.api.node.Node;
|
import net.luckperms.api.node.Node;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -122,6 +123,14 @@ public class Importer implements Runnable {
|
|||||||
this.plugin.getUserManager().getHouseKeeper().cleanup(user.getUniqueId());
|
this.plugin.getUserManager().getHouseKeeper().cleanup(user.getUniqueId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Set<Map.Entry<String, JsonElement>> getDataSection(String id) {
|
||||||
|
if (this.data.has(id)) {
|
||||||
|
return this.data.get(id).getAsJsonObject().entrySet();
|
||||||
|
} else {
|
||||||
|
return Collections.emptySet();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
long startTime = System.currentTimeMillis();
|
long startTime = System.currentTimeMillis();
|
||||||
@ -136,16 +145,16 @@ public class Importer implements Runnable {
|
|||||||
Map<String, List<String>> tracks = new HashMap<>();
|
Map<String, List<String>> tracks = new HashMap<>();
|
||||||
Map<UUID, UserData> users = new HashMap<>();
|
Map<UUID, UserData> users = new HashMap<>();
|
||||||
|
|
||||||
for (Map.Entry<String, JsonElement> group : this.data.get("groups").getAsJsonObject().entrySet()) {
|
for (Map.Entry<String, JsonElement> group : getDataSection("groups")) {
|
||||||
groups.put(group.getKey(), NodeJsonSerializer.deserializeNodes(group.getValue().getAsJsonObject().get("nodes").getAsJsonArray()));
|
groups.put(group.getKey(), NodeJsonSerializer.deserializeNodes(group.getValue().getAsJsonObject().get("nodes").getAsJsonArray()));
|
||||||
}
|
}
|
||||||
for (Map.Entry<String, JsonElement> track : this.data.get("tracks").getAsJsonObject().entrySet()) {
|
for (Map.Entry<String, JsonElement> track : getDataSection("tracks")) {
|
||||||
JsonArray trackGroups = track.getValue().getAsJsonObject().get("groups").getAsJsonArray();
|
JsonArray trackGroups = track.getValue().getAsJsonObject().get("groups").getAsJsonArray();
|
||||||
List<String> trackGroupsList = new ArrayList<>();
|
List<String> trackGroupsList = new ArrayList<>();
|
||||||
trackGroups.forEach(g -> trackGroupsList.add(g.getAsString()));
|
trackGroups.forEach(g -> trackGroupsList.add(g.getAsString()));
|
||||||
tracks.put(track.getKey(), trackGroupsList);
|
tracks.put(track.getKey(), trackGroupsList);
|
||||||
}
|
}
|
||||||
for (Map.Entry<String, JsonElement> user : this.data.get("users").getAsJsonObject().entrySet()) {
|
for (Map.Entry<String, JsonElement> user : getDataSection("users")) {
|
||||||
JsonObject jsonData = user.getValue().getAsJsonObject();
|
JsonObject jsonData = user.getValue().getAsJsonObject();
|
||||||
|
|
||||||
UUID uuid = UUID.fromString(user.getKey());
|
UUID uuid = UUID.fromString(user.getKey());
|
||||||
|
Loading…
Reference in New Issue
Block a user