mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-23 15:00:30 +01:00
54 lines
2.3 KiB
Diff
54 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 e75da4494582594dfa8f21e6abd36fb345558127..43f93aa0efc35488fab44cb55081cfc486c319f5 100644
|
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
|
@@ -1432,6 +1432,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 b6e8dd95cc58f53e3e6ca64dd796ed6633630cf4..693e07b7e4aeef2ebc7fba5d20d6c6071762896c 100644
|
|
--- a/src/main/java/org/bukkit/Server.java
|
|
+++ b/src/main/java/org/bukkit/Server.java
|
|
@@ -1202,6 +1202,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.
|
|
*
|