diff --git a/fabric-networking-api-v1/src/testmod/java/net/fabricmc/fabric/test/networking/common/NetworkingCommonTest.java b/fabric-networking-api-v1/src/testmod/java/net/fabricmc/fabric/test/networking/common/NetworkingCommonTest.java index a312cd6cad..982c0edf80 100644 --- a/fabric-networking-api-v1/src/testmod/java/net/fabricmc/fabric/test/networking/common/NetworkingCommonTest.java +++ b/fabric-networking-api-v1/src/testmod/java/net/fabricmc/fabric/test/networking/common/NetworkingCommonTest.java @@ -19,6 +19,9 @@ import java.util.ArrayList; import java.util.List; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import net.minecraft.network.PacketByteBuf; import net.minecraft.network.codec.PacketCodec; import net.minecraft.network.codec.PacketCodecs; @@ -36,6 +39,7 @@ import net.fabricmc.fabric.test.networking.NetworkingTestmods; public class NetworkingCommonTest implements ModInitializer { + private static final Logger LOGGER = LoggerFactory.getLogger(NetworkingCommonTest.class); private boolean firstLoad = true; private List receivedPlay = new ArrayList<>(); private List receivedConfig = new ArrayList<>(); @@ -99,6 +103,11 @@ private static void executeIn(MinecraftServer server, int ticks, Runnable runnab server.execute(new Runnable() { @Override public void run() { + if (!server.isRunning()) { + LOGGER.warn("Server is no longer running, cannot execute task"); + return; + } + if (server.getTicks() >= targetTime) { runnable.run(); return;