aboutsummaryrefslogtreecommitdiffhomepage
path: root/paper-server/patches/unapplied/net/minecraft/server/rcon/thread/RconClient.java.patch
blob: 1aa09ff9d737a357e1833934d571d4b2e6183a9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
--- a/net/minecraft/server/rcon/thread/RconClient.java
+++ b/net/minecraft/server/rcon/thread/RconClient.java
@@ -8,9 +8,12 @@
 import java.net.Socket;
 import java.nio.charset.StandardCharsets;
 import java.util.Locale;
+import org.slf4j.Logger;
 import net.minecraft.server.ServerInterface;
+// CraftBukkit start
+import net.minecraft.server.dedicated.DedicatedServer;
 import net.minecraft.server.rcon.PktUtils;
-import org.slf4j.Logger;
+import net.minecraft.server.rcon.RconConsoleSource;
 
 public class RconClient extends GenericThread {
 
@@ -24,11 +27,14 @@
     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 server, String password, Socket socket) {
         super("RCON Client " + String.valueOf(socket.getInetAddress()));
-        this.serverInterface = server;
+        this.serverInterface = (DedicatedServer) server; // CraftBukkit
         this.client = socket;
 
         try {
@@ -38,11 +44,14 @@
         }
 
         this.rconPassword = password;
+        this.rconConsoleSource = new net.minecraft.server.rcon.RconConsoleSource(this.serverInterface, socket.getRemoteSocketAddress()); // CraftBukkit
     }
 
     public void run() {
-        while (true) {
-            try {
+        // CraftBukkit start - decompile error: switch try / while statement
+        try {
+            while (true) {
+                // CraftBukkit end
                 if (!this.running) {
                     return;
                 }
@@ -71,7 +80,7 @@
                                 String s = PktUtils.stringFromByteArray(this.buf, j, 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() + ")");
                                 }
@@ -98,6 +107,7 @@
                             continue;
                     }
                 }
+        } // CraftBukkit - decompile error: switch try / while statement
             } catch (IOException ioexception) {
                 return;
             } catch (Exception exception1) {
@@ -109,8 +119,10 @@
                 this.running = false;
             }
 
-            return;
-        }
+            // CraftBukkit start - decompile error: switch try / while statement
+            // return;
+        // }
+        // CraftBukkit end
     }
 
     private void send(int sessionToken, int responseType, String message) throws IOException {