Paper/patches/api/0345-API-for-creating-command-sender-which-forwards-feedb.patch
Jake Potrebic 2f92d4e00e
Updated Upstream (Bukkit/CraftBukkit)
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:
01bb6ba7 PR-936: Add new PersistentDataContainer methods and clean up docs
bc145b90 PR-940: Create registry for banner pattern and cat type

CraftBukkit Changes:
cb2ea54de SPIGOT-7440, PR-1292: Fire EntityTeleportEvent for end gateways
4fea66e44 PR-1299: Add new PersistentDataContainer methods and clean up docs
b483a20db PR-1303: Create registry for banner pattern and cat type
4642dd526 SPIGOT-7535: Fix maps not having an ID and also call MapInitializeEvent in more places
2023-12-08 11:00:39 -08: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 6d09d22a2d488e3fdd0584a4361210f0060114e8..5e8518372a30595f5f8f254e31a130645e75772e 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1535,6 +1535,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 cea13dcd6b9e6cbc5af42f38296c9ab8db7e7855..204e68a63cf32d3b58a9fadabde5780608f47421 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1294,6 +1294,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.
*