mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-12-29 12:37:40 +01:00
Add default file name for export command (#3248)
This commit is contained in:
parent
664cad21a9
commit
ae93c9768b
@ -241,6 +241,7 @@ watch-files: true
|
||||
# below.
|
||||
# => rabbitmq Uses RabbitMQ pub-sub to push changes. Your server connection info must be
|
||||
# configured below.
|
||||
# => custom Uses a messaging service provided using the LuckPerms API.
|
||||
# => auto Attempts to automatically setup a messaging service using redis or sql.
|
||||
messaging-service: auto
|
||||
|
||||
|
@ -239,6 +239,7 @@ watch-files: true
|
||||
# the RedisBungee plugin installed.
|
||||
# => rabbitmq Uses RabbitMQ pub-sub to push changes. Your server connection info must be
|
||||
# configured below.
|
||||
# => custom Uses a messaging service provided using the LuckPerms API.
|
||||
# => auto Attempts to automatically setup a messaging service using redis or sql.
|
||||
messaging-service: auto
|
||||
|
||||
|
@ -38,13 +38,19 @@ import me.lucko.luckperms.common.util.Predicates;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.time.Instant;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
public class ExportCommand extends SingleCommand {
|
||||
private static final DateTimeFormatter DATE_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd-HH-mm")
|
||||
.withZone(ZoneId.systemDefault());
|
||||
|
||||
private final AtomicBoolean running = new AtomicBoolean(false);
|
||||
|
||||
public ExportCommand() {
|
||||
super(CommandSpec.EXPORT, "Export", CommandPermission.EXPORT, Predicates.notInRange(1, 2));
|
||||
super(CommandSpec.EXPORT, "Export", CommandPermission.EXPORT, Predicates.alwaysFalse());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -68,7 +74,12 @@ public class ExportCommand extends SingleCommand {
|
||||
exporter = new Exporter.WebUpload(plugin, sender, includeUsers, includeGroups, label);
|
||||
} else {
|
||||
Path dataDirectory = plugin.getBootstrap().getDataDirectory();
|
||||
Path path = dataDirectory.resolve(args.get(0) + ".json.gz");
|
||||
Path path;
|
||||
if (args.isEmpty()) {
|
||||
path = dataDirectory.resolve("luckperms-" + DATE_FORMAT.format(Instant.now()) + ".json.gz");
|
||||
} else {
|
||||
path = dataDirectory.resolve(args.get(0) + ".json.gz");
|
||||
}
|
||||
|
||||
if (!path.getParent().equals(dataDirectory)) {
|
||||
Message.FILE_NOT_WITHIN_DIRECTORY.send(sender, path.toString());
|
||||
|
@ -244,6 +244,7 @@ watch-files = true
|
||||
# below.
|
||||
# => rabbitmq Uses RabbitMQ pub-sub to push changes. Your server connection info must be
|
||||
# configured below.
|
||||
# => custom Uses a messaging service provided using the LuckPerms API.
|
||||
# => auto Attempts to automatically setup a messaging service using redis or sql.
|
||||
messaging-service = "auto"
|
||||
|
||||
|
@ -236,6 +236,7 @@ watch-files: true
|
||||
# below.
|
||||
# => rabbitmq Uses RabbitMQ pub-sub to push changes. Your server connection info must be
|
||||
# configured below.
|
||||
# => custom Uses a messaging service provided using the LuckPerms API.
|
||||
# => auto Attempts to automatically setup a messaging service using redis or sql.
|
||||
messaging-service: auto
|
||||
|
||||
|
@ -244,6 +244,7 @@ watch-files = true
|
||||
# below.
|
||||
# => rabbitmq Uses RabbitMQ pub-sub to push changes. Your server connection info must be
|
||||
# configured below.
|
||||
# => custom Uses a messaging service provided using the LuckPerms API.
|
||||
# => auto Attempts to automatically setup a messaging service using redis or sql.
|
||||
messaging-service = "auto"
|
||||
|
||||
|
@ -230,6 +230,7 @@ watch-files: true
|
||||
# configured below.
|
||||
# => rabbitmq Uses RabbitMQ pub-sub to push changes. Your server connection info must be
|
||||
# configured below.
|
||||
# => custom Uses a messaging service provided using the LuckPerms API.
|
||||
# => auto Attempts to automatically setup a messaging service using redis or sql.
|
||||
messaging-service: auto
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user