summaryrefslogtreecommitdiff
path: root/src/main/java/com
diff options
context:
space:
mode:
authorKeuin <[email protected]>2021-01-22 21:10:56 +0800
committerkeuin <[email protected]>2021-01-22 21:10:56 +0800
commit781c8268e53a75c6d54b5305ed7a6b94c58a9c0d (patch)
treec8ae53e722331e5eb6a46e044e6582234daaab66 /src/main/java/com
parent57a2fb9fd87609f86759d437e2945b1e7d4790a1 (diff)
Fix a small inconsistency between different versions
Diffstat (limited to 'src/main/java/com')
-rw-r--r--src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java b/src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java
index 1d90864..e1d5cbd 100644
--- a/src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java
+++ b/src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java
@@ -9,6 +9,7 @@ import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.event.server.ServerStartCallback;
import net.fabricmc.fabric.api.registry.CommandRegistry;
import net.minecraft.server.MinecraftServer;
+import net.minecraft.server.dedicated.MinecraftDedicatedServer;
import java.io.File;
import java.io.FileInputStream;
@@ -37,6 +38,9 @@ public final class KBPluginEvents implements ModInitializer, ServerStartCallback
@Override
public void onStartServer(MinecraftServer server) {
+ if (!(server instanceof MinecraftDedicatedServer))
+ throw new RuntimeException("KBackup is a server-side-only plugin. Please do not use it in Minecraft client.");
+
// Initialize player manager reference
PrintUtil.setPlayerManager(server.getPlayerManager());
@@ -45,7 +49,7 @@ public final class KBPluginEvents implements ModInitializer, ServerStartCallback
// Check if we have just recovered from a previous backup. If so, print message.
try {
- File levelDirectory = new File(server.getRunDirectory(), server.getLevelName());
+ File levelDirectory = new File(server.getRunDirectory(), ((MinecraftDedicatedServer) server).getLevelName());
File metadataFile = new File(levelDirectory, BackupMetadata.metadataFileName);
if (metadataFile.exists()) {
// Metadata exists. Deserialize.