2022-02-03 03:44:57 +01:00
|
|
|
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
|
2023-05-15 02:23:57 +02:00
|
|
|
index 60b2f21195384d544a7e123ce19a09ee437a6538..b27260b03ed1e49a1ff50db2f00133f92cad37a9 100644
|
2022-02-03 03:44:57 +01:00
|
|
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
|
|
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
2023-05-15 02:23:57 +02:00
|
|
|
@@ -1411,6 +1411,20 @@ public final class Bukkit {
|
2022-02-03 03:44:57 +01:00
|
|
|
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
|
2023-05-15 02:23:57 +02:00
|
|
|
index 35ec012867c6d87b76fd60d1ff55302612f96b9e..bdf247e6a8622b2e8a3d2dcdd6a2a7ebd1c01603 100644
|
2022-02-03 03:44:57 +01:00
|
|
|
--- a/src/main/java/org/bukkit/Server.java
|
|
|
|
+++ b/src/main/java/org/bukkit/Server.java
|
2023-05-15 02:23:57 +02:00
|
|
|
@@ -1177,6 +1177,18 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
|
2022-02-03 03:44:57 +01:00
|
|
|
@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.
|
|
|
|
*
|