From 0b6cdcc0c4317577cdb5fe494b0e8e4a20820341 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Mon, 1 Aug 2022 22:07:48 +1000 Subject: [PATCH] SPIGOT-7127: /say doesn't work from console By: md_5 --- .../net/minecraft/server/MinecraftServer.patch | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/paper-server/nms-patches/net/minecraft/server/MinecraftServer.patch b/paper-server/nms-patches/net/minecraft/server/MinecraftServer.patch index ffdce54eb2..697d5d59d4 100644 --- a/paper-server/nms-patches/net/minecraft/server/MinecraftServer.patch +++ b/paper-server/nms-patches/net/minecraft/server/MinecraftServer.patch @@ -342,11 +342,11 @@ + this.connection.acceptConnections(); + } + // CraftBukkit end -+ -+ protected void forceDifficulty() {} - this.readScoreboard(worldpersistentdata); - this.commandStorage = new PersistentCommandStorage(worldpersistentdata); ++ protected void forceDifficulty() {} ++ + // CraftBukkit start + public void initWorld(WorldServer worldserver, IWorldDataServer iworlddataserver, SaveData saveData, GeneratorSettings generatorsettings) { + boolean flag = generatorsettings.isDebug(); @@ -712,7 +712,7 @@ private void startMetricsRecordingTick() { if (this.willStartRecordingMetrics) { this.metricsRecorder = ActiveMetricsRecorder.createStarted(new ServerMetricsSamplersProvider(SystemUtils.timeSource, this.isDedicatedServer()), SystemUtils.timeSource, SystemUtils.ioPool(), new MetricsPersister("server"), this.onMetricsRecordingStopped, (path) -> { -@@ -1912,8 +2223,25 @@ +@@ -1912,8 +2223,30 @@ } @@ -723,6 +723,11 @@ public ChatDecorator getChatDecorator() { - return ChatDecorator.PLAIN; + return (entityplayer, ichatbasecomponent) -> { ++ // SPIGOT-7127: Console /say and similar ++ if (entityplayer == null) { ++ return CompletableFuture.completedFuture(ichatbasecomponent); ++ } ++ + return CompletableFuture.supplyAsync(() -> { + AsyncPlayerChatPreviewEvent event = new AsyncPlayerChatPreviewEvent(true, entityplayer.getBukkitEntity(), CraftChatMessage.fromComponent(ichatbasecomponent), new LazyPlayerSet(this)); + String originalFormat = event.getFormat(), originalMessage = event.getMessage();