Skip to content

Commit

Permalink
Fix NetworkingCommonTest causing a stackoverflow when the server is s…
Browse files Browse the repository at this point in the history
…topped before 50 ticks.
  • Loading branch information
modmuss50 committed Dec 24, 2024
1 parent c6322ff commit b90547a
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<String> receivedPlay = new ArrayList<>();
private List<String> receivedConfig = new ArrayList<>();
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit b90547a

Please sign in to comment.