From 10a945ce9340e88da609aeeb9bfc8adc3427009c Mon Sep 17 00:00:00 2001 From: Lyfts <127234178+Lyfts@users.noreply.github.com> Date: Tue, 6 Feb 2024 16:41:56 +0100 Subject: [PATCH] Fix /backup start counting as auto when ran from console --- src/main/java/serverutils/backups/Backups.java | 5 ++--- .../handlers/ServerUtilitiesServerEventHandler.java | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/serverutils/backups/Backups.java b/src/main/java/serverutils/backups/Backups.java index 13eedc72a..30d1c9fa6 100644 --- a/src/main/java/serverutils/backups/Backups.java +++ b/src/main/java/serverutils/backups/Backups.java @@ -7,7 +7,6 @@ import net.minecraft.client.Minecraft; import net.minecraft.command.ICommandSender; -import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.server.MinecraftServer; import net.minecraft.world.WorldServer; @@ -36,7 +35,7 @@ public static void init() { public static boolean run(ICommandSender ics, String customName) { if (thread != null) return false; - boolean auto = !(ics instanceof EntityPlayerMP); + boolean auto = ics == null; if (auto && !ServerUtilitiesConfig.backups.enable_backups) return false; @@ -47,7 +46,7 @@ public static boolean run(ICommandSender ics, String customName) { if (!hasOnlinePlayers() && !hadPlayer) return true; hadPlayer = false; } - ServerUtilitiesNotifications.backupNotification(BACKUP_START, "cmd.backup_start", ics.getCommandSenderName()); + ServerUtilitiesNotifications.backupNotification(BACKUP_START, "cmd.backup_start"); try { for (int i = 0; i < server.worldServers.length; ++i) { diff --git a/src/main/java/serverutils/handlers/ServerUtilitiesServerEventHandler.java b/src/main/java/serverutils/handlers/ServerUtilitiesServerEventHandler.java index 966b31968..7e0338b36 100644 --- a/src/main/java/serverutils/handlers/ServerUtilitiesServerEventHandler.java +++ b/src/main/java/serverutils/handlers/ServerUtilitiesServerEventHandler.java @@ -233,7 +233,7 @@ public void onServerTick(TickEvent.ServerTickEvent event) { } if (Backups.nextBackup > 0L && Backups.nextBackup <= now) { - Backups.run(universe.server, ""); + Backups.run(null, ""); } if (Backups.thread != null && Backups.thread.isDone) {