Add debug output to TinyProtocol

This commit is contained in:
2026-05-19 18:41:15 +02:00
parent 6da180136e
commit 496cc3121c
3 changed files with 12 additions and 9 deletions
@@ -356,6 +356,8 @@ public class TinyProtocol {
// Lookup channel again
if (channel == null) {
System.out.println(((CraftPlayer) player).getHandle());
System.out.println(((CraftPlayer) player).getHandle().connection);
Channel playerChannel = ((CraftPlayer) player).getHandle().connection.connection.channel;
channelLookup.put(player.getName(), channel = playerChannel);
}
@@ -24,6 +24,7 @@ import de.steamwar.Reflection;
import de.steamwar.sql.internal.Statement;
import io.netty.channel.ChannelFuture;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.server.network.ServerConnectionListener;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.CraftWorld;
@@ -79,11 +80,14 @@ class CheckpointUtilsJ9 {
return;
}
e.printStackTrace();
Bukkit.shutdown();
if (!message.contains("Can't dump ghost file") && !message.contains("Can't create link remap")) // File/Jar has been updated
throw new SecurityException(e);
} finally {
if (true) return;
// Delete checkpoint
try (Stream<Path> stream = Files.walk(path)) {
stream.sorted(Comparator.reverseOrder()).map(Path::toFile).forEach(File::delete);
@@ -108,6 +112,7 @@ class CheckpointUtilsJ9 {
ServerConnectionListener serverConnection = MinecraftServer.getServer().getConnection();
List<?> channels = channelFutures.get(serverConnection);
for (Object future : channels) {
System.out.println(((ChannelFuture) future).channel() + ": " + ((ChannelFuture) future).channel().pipeline().names());
((ChannelFuture) future).channel().close().syncUninterruptibly();
}
channels.clear();
@@ -143,10 +148,15 @@ class CheckpointUtilsJ9 {
// Reopen socket
serverConnection.startTcpServerListener(InetAddress.getLoopbackAddress(), port);
for (Object future : channels) {
System.out.println(((ChannelFuture) future).channel() + ": " + ((ChannelFuture) future).channel().pipeline().names());
((ChannelFuture) future).channel().config().setAutoRead(true);
}
Bukkit.getPluginManager().callEvent(new CRIUWakeupEvent());
Core.getInstance().getLogger().log(Level.INFO, "Checkpoint restored");
for (ServerPlayer player : MinecraftServer.getServer().getPlayerList().players) {
System.out.println(player);
}
}
}