mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-27 21:29:47 +01:00
Add /lp export --without-groups (#2498)
This commit is contained in:
parent
ac9706b83f
commit
e1bac438aa
@ -83,15 +83,17 @@ public class Exporter implements Runnable {
|
||||
private final Sender executor;
|
||||
private final Path filePath;
|
||||
private final boolean includeUsers;
|
||||
private final boolean includeGroups;
|
||||
private final boolean saveFile;
|
||||
private final String label;
|
||||
private final ProgressLogger log;
|
||||
|
||||
public Exporter(LuckPermsPlugin plugin, Sender executor, Path filePath, boolean includeUsers, boolean saveFile) {
|
||||
public Exporter(LuckPermsPlugin plugin, Sender executor, Path filePath, boolean includeUsers, boolean includeGroups, boolean saveFile) {
|
||||
this.plugin = plugin;
|
||||
this.executor = executor;
|
||||
this.filePath = filePath;
|
||||
this.includeUsers = includeUsers;
|
||||
this.includeGroups = includeGroups;
|
||||
this.saveFile = saveFile;
|
||||
this.label = null;
|
||||
|
||||
@ -100,11 +102,12 @@ public class Exporter implements Runnable {
|
||||
this.log.addListener(executor);
|
||||
}
|
||||
|
||||
public Exporter(LuckPermsPlugin plugin, Sender executor, boolean includeUsers, boolean saveFile, String label) {
|
||||
public Exporter(LuckPermsPlugin plugin, Sender executor, boolean includeUsers, boolean includeGroups, boolean saveFile, String label) {
|
||||
this.plugin = plugin;
|
||||
this.executor = executor;
|
||||
this.filePath = null;
|
||||
this.includeUsers = includeUsers;
|
||||
this.includeGroups = includeGroups;
|
||||
this.saveFile = saveFile;
|
||||
this.label = label;
|
||||
|
||||
@ -121,11 +124,13 @@ public class Exporter implements Runnable {
|
||||
.add("generatedAt", DATE_FORMAT.format(new Date(System.currentTimeMillis())))
|
||||
.toJson());
|
||||
|
||||
if (this.includeGroups) {
|
||||
this.log.log("Gathering group data...");
|
||||
json.add("groups", exportGroups());
|
||||
|
||||
this.log.log("Gathering track data...");
|
||||
json.add("tracks", exportTracks());
|
||||
}
|
||||
|
||||
if (this.includeUsers) {
|
||||
this.log.log("Gathering user data...");
|
||||
|
@ -57,6 +57,7 @@ public class ExportCommand extends SingleCommand {
|
||||
}
|
||||
|
||||
boolean includeUsers = !args.remove("--without-users");
|
||||
boolean includeGroups = !args.remove("--without-groups");
|
||||
boolean saveFile = !args.remove("--upload");
|
||||
|
||||
Exporter exporter;
|
||||
@ -92,14 +93,14 @@ public class ExportCommand extends SingleCommand {
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
|
||||
exporter = new Exporter(plugin, sender, path, includeUsers, saveFile);
|
||||
exporter = new Exporter(plugin, sender, path, includeUsers, includeGroups, saveFile);
|
||||
} else {
|
||||
if (!this.running.compareAndSet(false, true)) {
|
||||
Message.EXPORT_ALREADY_RUNNING.send(sender);
|
||||
return CommandResult.STATE_ERROR;
|
||||
}
|
||||
|
||||
exporter = new Exporter(plugin, sender, includeUsers, saveFile, label);
|
||||
exporter = new Exporter(plugin, sender, includeUsers, includeGroups, saveFile, label);
|
||||
}
|
||||
|
||||
// Run the exporter in its own thread.
|
||||
|
Loading…
Reference in New Issue
Block a user