Package org.geysermc.geyser.command
Class CommandRegistry
java.lang.Object
org.geysermc.geyser.command.CommandRegistry
- All Implemented Interfaces:
org.geysermc.geyser.api.event.EventRegistrar
Registers all built-in and extension commands to the given Cloud CommandManager.
Fires GeyserDefineCommandsEvent upon construction.
Subscribes to GeyserRegisterPermissionsEvent upon construction.
A new instance of this class (that registers the same permissions) shouldn't be created until the previous
instance is unsubscribed from the event.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final GeyserImplMap containing only permissions that have been registered with a default valuestatic final boolean -
Constructor Summary
ConstructorsConstructorDescriptionCommandRegistry(GeyserImpl geyser, org.incendo.cloud.CommandManager<GeyserCommandSource> cloud) Creates a new CommandRegistry.CommandRegistry(GeyserImpl geyser, org.incendo.cloud.CommandManager<GeyserCommandSource> cloud, boolean applyRootPermission) Creates a new CommandRegistry -
Method Summary
Modifier and TypeMethodDescription@NonNull Stringdescription(@NonNull String command, @NonNull String locale) Returns the description of the given commandvoidexport(GeyserSession session, List<org.cloudburstmc.protocol.bedrock.data.command.CommandData> bedrockCommands, Set<String> knownAliases) booleanhasPermission(GeyserCommandSource source, String permission) protected voidonRegisterPermissions(org.geysermc.geyser.api.event.lifecycle.GeyserRegisterPermissionsEvent event) protected voidregister(GeyserCommand command, Map<String, GeyserCommand> commands) @NonNull Collection<String>voidrunCommand(@NonNull GeyserCommandSource source, @NonNull String command) Dispatches a command into cloud and handles any thrown exceptions.org.incendo.cloud.suggestion.Suggestions<GeyserCommandSource,? extends org.incendo.cloud.suggestion.Suggestion> suggestionsFor(GeyserCommandSource source, String input)
-
Field Details
-
STANDALONE_COMMAND_MANAGER
public static final boolean STANDALONE_COMMAND_MANAGER -
geyser
-
permissionDefaults
Map containing only permissions that have been registered with a default value
-
-
Constructor Details
-
CommandRegistry
public CommandRegistry(GeyserImpl geyser, org.incendo.cloud.CommandManager<GeyserCommandSource> cloud) Creates a new CommandRegistry. Does apply a root permission. If undesired, use the other constructor. -
CommandRegistry
public CommandRegistry(GeyserImpl geyser, org.incendo.cloud.CommandManager<GeyserCommandSource> cloud, boolean applyRootPermission) Creates a new CommandRegistry- Parameters:
geyser- the Geyser instancecloud- the cloud command manager to register commands toapplyRootPermission- true if this registry should apply a permission to Geyser and Extension root commands. This currently exists because we want to retain the root command permission for Spigot, but don't want to add it yet to platforms like Velocity where we cannot natively specify a permission default. Doing so will break setups as players would suddenly not have the required permission to execute any Geyser commands.
-
-
Method Details
-
rootCommands
- Returns:
- an immutable view of the root commands registered to this command registry
-
register
-
onRegisterPermissions
protected void onRegisterPermissions(org.geysermc.geyser.api.event.lifecycle.GeyserRegisterPermissionsEvent event) -
hasPermission
-
description
Returns the description of the given command- Parameters:
command- the root command nodelocale- the ideal locale that the description should be in- Returns:
- a description if found, otherwise an empty string. The locale is not guaranteed.
-
runCommand
Dispatches a command into cloud and handles any thrown exceptions. This method may or may not be blocking, depending on theExecutionCoordinatorin use by cloud. -
suggestionsFor
public org.incendo.cloud.suggestion.Suggestions<GeyserCommandSource,? extends org.incendo.cloud.suggestion.Suggestion> suggestionsFor(GeyserCommandSource source, String input) -
export
public void export(GeyserSession session, List<org.cloudburstmc.protocol.bedrock.data.command.CommandData> bedrockCommands, Set<String> knownAliases)
-