Paper/patches/api/0361-API-for-creating-command-sender-which-forwards-feedb.patch
Nassim Jahnke 928bcc8d3a
Updated Upstream (Bukkit/CraftBukkit) (#8430)
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:
09943450 Update SnakeYAML version
5515734f SPIGOT-7162: Incorrect description for Entity#getVehicle javadoc
6f82b381 PR-788: Add getHand() to all relevant events

CraftBukkit Changes:
aaf484f6f SPIGOT-7163: CraftMerchantRecipe doesn't copy demand and specialPrice from BukkitMerchantRecipe
5329dd6fd PR-1107: Add getHand() to all relevant events
93061706e SPIGOT-7045: Ocelots never spawn with babies with spawn reason OCELOT_BABY
2022-10-02 09:56:36 +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 77e824f6071782def8865fc178e2f064f109cebb..1b52cb7d8b894ee73be5754ed44236de01d7d0c6 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -1413,6 +1413,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 a7e1d81a8a5e14f556d6b462dfba7f2e49f06f5f..6d056cee2fb727db9fbcc0ee98a7c800a8981ad6 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1179,6 +1179,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.
*