diff options
Diffstat (limited to 'patches/api/0341-API-for-creating-command-sender-which-forwards-feedb.patch')
-rw-r--r-- | patches/api/0341-API-for-creating-command-sender-which-forwards-feedb.patch | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/patches/api/0341-API-for-creating-command-sender-which-forwards-feedb.patch b/patches/api/0341-API-for-creating-command-sender-which-forwards-feedb.patch new file mode 100644 index 0000000000..5c1c336819 --- /dev/null +++ b/patches/api/0341-API-for-creating-command-sender-which-forwards-feedb.patch @@ -0,0 +1,54 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jason Penilla <[email protected]> +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 03a94d0b332f531832bfad9839ec60a2ad91222c..c64f6ccfcd08c851900e734a194b1de4c8e32b07 100644 +--- a/src/main/java/org/bukkit/Bukkit.java ++++ b/src/main/java/org/bukkit/Bukkit.java +@@ -1565,6 +1565,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 a1a9ed907eaa89e2915855eb2946d27ef3521b61..d6c3fefbd407ae3aa1be9e71d05b6370f09dd905 100644 +--- a/src/main/java/org/bukkit/Server.java ++++ b/src/main/java/org/bukkit/Server.java +@@ -1318,6 +1318,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. + * |