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 rcon #77

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
64 changes: 64 additions & 0 deletions patches/server/0094-Fix-rcon.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: skbeh <[email protected]>
Date: Mon, 2 Jan 2023 09:54:24 +0800
Subject: [PATCH] Fix rcon


diff --git a/src/main/java/net/minecraft/server/RemoteControlSession.java b/src/main/java/net/minecraft/server/RemoteControlSession.java
index 1b45f81b6a63662db999f7441c487bba24f19fea..23d86f061b3b32569fca3c0d0b9e539a43174b8b 100644
--- a/src/main/java/net/minecraft/server/RemoteControlSession.java
+++ b/src/main/java/net/minecraft/server/RemoteControlSession.java
@@ -33,6 +33,7 @@ public class RemoteControlSession extends RemoteConnectionThread {

public void run() {
while (true) {
+ boolean closeConnection = true; // PandaSpigot - Fix rcon
try {
if (!this.a) {
break;
@@ -66,10 +67,12 @@ public class RemoteControlSession extends RemoteConnectionThread {
} catch (Exception exception) {
this.a(l, "Error executing: " + s + " (" + exception.getMessage() + ")");
}
+ closeConnection = false; // PandaSpigot - Fix rcon
continue;
}

this.f();
+ closeConnection = false; // PandaSpigot - Fix rcon
continue;

case 3:
@@ -79,16 +82,18 @@ public class RemoteControlSession extends RemoteConnectionThread {
if (0 != s1.length() && s1.equals(this.l)) {
this.i = true;
this.a(l, 2, "");
+ closeConnection = false; // PandaSpigot - Fix rcon
continue;
}

this.i = false;
this.f();
+ closeConnection = false; // PandaSpigot - Fix rcon
continue;

default:
this.a(l, String.format("Unknown request %s", new Object[] { Integer.toHexString(i1)}));
- continue;
+ break; // PandaSpigot - Fix rcon
}
}
} catch (SocketTimeoutException sockettimeoutexception) {
@@ -99,7 +104,11 @@ public class RemoteControlSession extends RemoteConnectionThread {
RemoteControlSession.h.error("Exception whilst parsing RCON input", exception1);
break;
} finally {
- this.g();
+ // PandaSpigot start - Fix rcon
+ if (closeConnection) {
+ this.g();
+ }
+ // PandaSpigot end - Fix rcon
}

return;