Paper/patch-remap/mache-spigotflower-stripped/net/minecraft/server/rcon/thread/RconClient.java.patch

75 lines
2.8 KiB
Diff

--- a/net/minecraft/server/rcon/thread/RconClient.java
+++ b/net/minecraft/server/rcon/thread/RconClient.java
@@ -9,6 +10,8 @@
import java.nio.charset.StandardCharsets;
import java.util.Locale;
import net.minecraft.server.ServerInterface;
+// CraftBukkit start
+import net.minecraft.server.dedicated.DedicatedServer;
import net.minecraft.server.rcon.PktUtils;
import org.slf4j.Logger;
@@ -24,12 +27,15 @@
private final Socket client;
private final byte[] buf = new byte[1460];
private final String rconPassword;
- private final ServerInterface serverInterface;
+ // CraftBukkit start
+ private final DedicatedServer serverInterface;
+ private final RconConsoleSource rconConsoleSource;
+ // CraftBukkit end
- RconClient(ServerInterface serverinterface, String s, Socket socket) {
- super("RCON Client " + socket.getInetAddress());
- this.serverInterface = serverinterface;
- this.client = socket;
+ RconClient(ServerInterface serverInterface, String rconPassword, Socket client) {
+ super("RCON Client " + client.getInetAddress());
+ this.serverInterface = (DedicatedServer) serverInterface; // CraftBukkit
+ this.client = client;
try {
this.client.setSoTimeout(0);
@@ -37,13 +43,16 @@
this.running = false;
}
- this.rconPassword = s;
+ this.rconPassword = rconPassword;
+ this.rconConsoleSource = new net.minecraft.server.rcon.RconConsoleSource(this.serverInterface, client.getRemoteSocketAddress()); // CraftBukkit
}
@Override
public void run() {
- while (true) {
- try {
+ // CraftBukkit start - decompile error: switch try / while statement
+ try {
+ while (true) {
+ // CraftBukkit end
if (!this.running) {
return;
}
@@ -72,7 +80,7 @@
String s = PktUtils.stringFromByteArray(this.buf, k, i);
try {
- this.sendCmdResponse(l, this.serverInterface.runCommand(s));
+ this.sendCmdResponse(l, this.serverInterface.runCommand(this.rconConsoleSource, s)); // CraftBukkit
} catch (Exception exception) {
this.sendCmdResponse(l, "Error executing: " + s + " (" + exception.getMessage() + ")");
}
@@ -110,8 +119,10 @@
this.running = false;
}
- return;
- }
+ // CraftBukkit start - decompile error: switch try / while statement
+ // return;
+ // }
+ // CraftBukkit end
}
private void send(int i, int j, String s) throws IOException {