Skip to content

Commit

Permalink
Fix a small inconsistency between different versions
Browse files Browse the repository at this point in the history
  • Loading branch information
keuin committed Jan 22, 2021
1 parent 57a2fb9 commit 781c826
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/java/com/keuin/kbackupfabric/KBPluginEvents.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
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;
Expand Down Expand Up @@ -37,6 +38,9 @@ public void onInitialize() {
@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());

Expand All @@ -45,7 +49,7 @@ public void onStartServer(MinecraftServer server) {

// 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.
Expand Down

0 comments on commit 781c826

Please sign in to comment.