Paper/paper-server/patches/sources/net/minecraft/server/rcon/RconConsoleSource.java.patch
CraftBukkit/Spigot 30e4583dbe Remap CraftBukkit to Mojang+Yarn Mappings
By: Initial Source <noreply+automated@papermc.io>
2024-12-11 22:26:55 +01:00

50 lines
1.8 KiB
Diff

--- a/net/minecraft/server/rcon/RconConsoleSource.java
+++ b/net/minecraft/server/rcon/RconConsoleSource.java
@@ -8,16 +8,24 @@
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 server) {
- this.server = server;
+ public RconConsoleSource(MinecraftServer minecraftserver, SocketAddress socketAddress) {
+ this.socketAddress = socketAddress;
+ // CraftBukkit end
+ this.server = minecraftserver;
}
public void prepareForCommand() {
@@ -34,7 +42,18 @@
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 message) {
this.buffer.append(message.getString());
}