API for creating command sender which forwards feedback

This commit is contained in:
Jason Penilla 2022-02-01 15:51:44 -07:00
parent 5ac3ad3792
commit 23d50f8134
2 changed files with 26 additions and 0 deletions

View File

@ -1595,6 +1595,20 @@ public final class Bukkit {
return server.getConsoleSender(); 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. * Gets the folder that contains all of the various {@link World}s.
* *

View File

@ -1349,6 +1349,18 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@NotNull @NotNull
public ConsoleCommandSender getConsoleSender(); 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. * Gets the folder that contains all of the various {@link World}s.
* *