aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower/net/minecraft/server/rcon/RconConsoleSource.java.patch
blob: 98a621e9cc3461f6610416ff89785497dd33a2ef (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
--- a/net/minecraft/server/rcon/RconConsoleSource.java
+++ b/net/minecraft/server/rcon/RconConsoleSource.java
@@ -8,15 +8,23 @@
 import net.minecraft.world.entity.Entity;
 import net.minecraft.world.phys.Vec2;
 import net.minecraft.world.phys.Vec3;
-
+// CraftBukkit start
+import java.net.SocketAddress;
+import org.bukkit.craftbukkit.command.CraftRemoteConsoleCommandSender;
+// CraftBukkit end
 public class RconConsoleSource implements CommandSource {
 
     private static final String RCON = "Rcon";
     private static final Component RCON_COMPONENT = Component.literal("Rcon");
     private final StringBuffer buffer = new StringBuffer();
     private final MinecraftServer server;
+    // CraftBukkit start
+    public final SocketAddress socketAddress;
+    private final CraftRemoteConsoleCommandSender remoteConsole = new CraftRemoteConsoleCommandSender(this);
 
-    public RconConsoleSource(MinecraftServer minecraftserver) {
+    public RconConsoleSource(MinecraftServer minecraftserver, SocketAddress socketAddress) {
+        this.socketAddress = socketAddress;
+        // CraftBukkit end
         this.server = minecraftserver;
     }
 
@@ -29,31 +37,38 @@
     }
 
     public CommandSourceStack createCommandSourceStack() {
-        ServerLevel serverlevel = this.server.overworld();
+        ServerLevel worldserver = this.server.overworld();
 
-        return new CommandSourceStack(this, Vec3.atLowerCornerOf(serverlevel.getSharedSpawnPos()), Vec2.ZERO, serverlevel, 4, "Rcon", RconConsoleSource.RCON_COMPONENT, this.server, (Entity) null);
+        return new CommandSourceStack(this, Vec3.atLowerCornerOf(worldserver.getSharedSpawnPos()), Vec2.ZERO, worldserver, 4, "Rcon", RconConsoleSource.RCON_COMPONENT, this.server, (Entity) null);
     }
 
+    // CraftBukkit start - Send a String
+    public void sendMessage(String message) {
+        this.buffer.append(message);
+    }
+
     @Override
+    public org.bukkit.command.CommandSender getBukkitSender(CommandSourceStack wrapper) {
+        return this.remoteConsole;
+    }
+    // CraftBukkit end
+
     @Override
     public void sendSystemMessage(Component component) {
         this.buffer.append(component.getString());
     }
 
     @Override
-    @Override
     public boolean acceptsSuccess() {
         return true;
     }
 
     @Override
-    @Override
     public boolean acceptsFailure() {
         return true;
     }
 
     @Override
-    @Override
     public boolean shouldInformAdmins() {
         return this.server.shouldRconBroadcast();
     }