Paper/patches/api/0363-API-for-creating-command-sender-which-forwards-feedb.patch
Nassim Jahnke 385f313a8b
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#8092)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
d41796de SPIGOT-7071: Add Player#stopSound(SoundCategory category)
61dae5b2 SPIGOT-7011, SPIGOT-7065: Overhaul of structures

CraftBukkit Changes:
991aeda12 SPIGOT-1729, SPIGOT-7090: Keep precision in teleportation between worlds
5c9a5f628 SPIGOT-7071: Add Player#stopSound(SoundCategory category)
68f888ded SPIGOT-7011, SPIGOT-7065: Overhaul of structures
0231a3746 Remove outdated build delay.

Spigot Changes:
475f6008 Rebuild patches
8ce1761f Rebuild patches
2022-07-04 16:38:06 +02:00

55 lines
2.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
Date: Tue, 1 Feb 2022 15:51:44 -0700
Subject: [PATCH] API for creating command sender which forwards feedback
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 23834c3bd3a5e008b1b05c99a7b2f491731d8459..ac7674fb1c9d7bd9572c678f57cab44233328bdc 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1412,6 +1412,20 @@ public final class Bukkit {
return server.getConsoleSender();
}
+ // Paper start
+ /**
+ * Creates a special {@link CommandSender} which redirects command feedback (in the form of chat messages) to the
+ * specified listener. The returned sender will have the same effective permissions as {@link #getConsoleSender()}.
+ *
+ * @param feedback feedback listener
+ * @return a command sender
+ */
+ @NotNull
+ public static CommandSender createCommandSender(final @NotNull java.util.function.Consumer<? super net.kyori.adventure.text.Component> feedback) {
+ return server.createCommandSender(feedback);
+ }
+ // Paper end
+
/**
* Gets the folder that contains all of the various {@link World}s.
*
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 515e1bc18e04cd94b5aa7b00434a72381277e678..871d80d0e0ce7cd80e34bfeebee8c543ea023d8e 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1178,6 +1178,18 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@NotNull
public ConsoleCommandSender getConsoleSender();
+ // Paper start
+ /**
+ * Creates a special {@link CommandSender} which redirects command feedback (in the form of chat messages) to the
+ * specified listener. The returned sender will have the same effective permissions as {@link #getConsoleSender()}.
+ *
+ * @param feedback feedback listener
+ * @return a command sender
+ */
+ @NotNull
+ public CommandSender createCommandSender(final @NotNull java.util.function.Consumer<? super net.kyori.adventure.text.Component> feedback);
+ // Paper end
+
/**
* Gets the folder that contains all of the various {@link World}s.
*