typos
This commit is contained in:
parent
4622f3fd0d
commit
8385044154
@ -90,7 +90,7 @@ public class ConfigPOJO implements ConfigData {
|
|||||||
public long maxAge = 0;
|
public long maxAge = 0;
|
||||||
|
|
||||||
@Comment("""
|
@Comment("""
|
||||||
\nMaximum size of backup folder in kilo bytes (1024).
|
\nMaximum size of backup folder in kibi bytes (1024).
|
||||||
If set to 0 then backups will not be deleted
|
If set to 0 then backups will not be deleted
|
||||||
""")
|
""")
|
||||||
@ConfigEntry.Gui.Tooltip()
|
@ConfigEntry.Gui.Tooltip()
|
||||||
|
@ -26,9 +26,7 @@ public enum ActionInitiator {
|
|||||||
ServerConsole("Server Console", "from"), //some/ting typed a command and it was not a player (command blocks and server console count)
|
ServerConsole("Server Console", "from"), //some/ting typed a command and it was not a player (command blocks and server console count)
|
||||||
Timer("Timer", "by"), //a.k.a scheduler
|
Timer("Timer", "by"), //a.k.a scheduler
|
||||||
Shutdown("Server Shutdown", "by"),
|
Shutdown("Server Shutdown", "by"),
|
||||||
Restore("Backup Restoration", "because of"),
|
Restore("Backup Restoration", "because of");
|
||||||
Null("Null (That shouldn't have happened)", "form");
|
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
private final String prefix;
|
private final String prefix;
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ public class RestoreableFile implements Comparable<RestoreableFile> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//removes repetition of the files stream thingy with awfully large lambdas
|
//removes repetition of the files stream thingy with awfully large lambdas
|
||||||
public static <T> T applyOnFiles(Path root, T def, Consumer<IOException> errorConsumer, Function<Stream<RestoreableFile>, T> streamConsumer) {
|
public static <T> T applyOnFiles(Path root, T def, Consumer<IOException> errorConsumer, Function<Stream<RestoreableFile>, T> streamConsumer) {
|
||||||
try (Stream<Path> stream = Files.list(root)) {
|
try (Stream<Path> stream = Files.list(root)) {
|
||||||
return streamConsumer.apply(stream.flatMap(f -> RestoreableFile.build(f).stream()));
|
return streamConsumer.apply(stream.flatMap(f -> RestoreableFile.build(f).stream()));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@ -18,13 +18,14 @@
|
|||||||
|
|
||||||
package net.szum123321.textile_backup.core.create;
|
package net.szum123321.textile_backup.core.create;
|
||||||
|
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.server.command.ServerCommandSource;
|
import net.minecraft.server.command.ServerCommandSource;
|
||||||
import net.szum123321.textile_backup.core.ActionInitiator;
|
import net.szum123321.textile_backup.core.ActionInitiator;
|
||||||
|
import net.szum123321.textile_backup.core.Utilities;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.NoSuchElementException;
|
||||||
|
|
||||||
public record BackupContext(@NotNull MinecraftServer server,
|
public record BackupContext(@NotNull MinecraftServer server,
|
||||||
ServerCommandSource commandSource,
|
ServerCommandSource commandSource,
|
||||||
@ -104,10 +105,8 @@ public record BackupContext(@NotNull MinecraftServer server,
|
|||||||
|
|
||||||
public BackupContext build() {
|
public BackupContext build() {
|
||||||
if (guessInitiator) {
|
if (guessInitiator) {
|
||||||
initiator = commandSource.getEntity() instanceof PlayerEntity ? ActionInitiator.Player : ActionInitiator.ServerConsole;
|
initiator = Utilities.wasSentByPlayer(commandSource) ? ActionInitiator.Player : ActionInitiator.ServerConsole;
|
||||||
} else if (initiator == null) {
|
} else if (initiator == null) throw new NoSuchElementException("No initiator provided!");
|
||||||
initiator = ActionInitiator.Null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (server == null) {
|
if (server == null) {
|
||||||
if (commandSource != null) setServer(commandSource.getServer());
|
if (commandSource != null) setServer(commandSource.getServer());
|
||||||
|
Loading…
Reference in New Issue
Block a user