Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NetworkingCommonTest causing a stackoverflow when the server is sopped before 50 ticks. #4325

Merged
merged 1 commit into from
Dec 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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