bukkit/paper/velocity: Add convenience methods for constructing command managers using native platform sender types
This commit is contained in:
parent
5d460e9f3a
commit
0722bf6ead
3 changed files with 71 additions and 3 deletions
|
|
@ -35,6 +35,7 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
|||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
import java.util.function.Function;
|
||||
import java.util.function.UnaryOperator;
|
||||
|
||||
/**
|
||||
* Paper command manager that extends {@link BukkitCommandManager}
|
||||
|
|
@ -88,6 +89,29 @@ public class PaperCommandManager<C> extends BukkitCommandManager<C> {
|
|||
super(owningPlugin, commandExecutionCoordinator, commandSenderMapper, backwardsCommandSenderMapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a command manager using Bukkit's {@link CommandSender} as the sender type.
|
||||
*
|
||||
* @param owningPlugin plugin owning the command manager
|
||||
* @param commandExecutionCoordinator execution coordinator instance
|
||||
* @return a new command manager
|
||||
* @throws Exception If the construction of the manager fails
|
||||
* @see #PaperCommandManager(Plugin, Function, Function, Function) for a more thorough explanation
|
||||
* @since 1.5.0
|
||||
*/
|
||||
public static @NonNull PaperCommandManager<@NonNull CommandSender> createNative(
|
||||
final @NonNull Plugin owningPlugin,
|
||||
final @NonNull Function<@NonNull CommandTree<@NonNull CommandSender>,
|
||||
@NonNull CommandExecutionCoordinator<@NonNull CommandSender>> commandExecutionCoordinator
|
||||
) throws Exception {
|
||||
return new PaperCommandManager<>(
|
||||
owningPlugin,
|
||||
commandExecutionCoordinator,
|
||||
UnaryOperator.identity(),
|
||||
UnaryOperator.identity()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register Brigadier mappings using the native paper events
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue