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 -
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- Parameters:
geyser- the Geyser instancecloud- the cloud command manager to register commands to
-
-
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)
-