Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 04:20:04 +01:00
55 Zeilen
2.3 KiB
Diff
55 Zeilen
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 be68351555bde59a4e55bf1bad261e9f6bc9f704..e2d3e42b403dce454988c3ae3e44bcd89337b1cf 100644
|
|
--- a/src/main/java/org/bukkit/Bukkit.java
|
|
+++ b/src/main/java/org/bukkit/Bukkit.java
|
|
@@ -1595,6 +1595,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 45693e6c02eac37eb609cd3c59253a949a6ca4c0..5dd7ce5c008c852dbeb0474a70e9357230406318 100644
|
|
--- a/src/main/java/org/bukkit/Server.java
|
|
+++ b/src/main/java/org/bukkit/Server.java
|
|
@@ -1349,6 +1349,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.
|
|
*
|