Package org.geysermc.geyser.command
Class GeyserCommand
java.lang.Object
org.geysermc.geyser.command.GeyserCommand
- All Implemented Interfaces:
org.geysermc.geyser.api.command.Command
- Direct Known Subclasses:
AdvancedTooltipsCommand,AdvancementsCommand,ConnectionTestCommand,CustomOptionsCommand,DumpCommand,ExtensionsCommand,GeyserExtensionCommand,HelpCommand,ListCommand,OffhandCommand,PingCommand,QuickActionsCommand,ReloadCommand,SettingsCommand,StatisticsCommand,StopCommand,VersionCommand
public abstract class GeyserCommand
extends Object
implements org.geysermc.geyser.api.command.Command
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.geysermc.geyser.api.command.Command
org.geysermc.geyser.api.command.Command.Builder<T extends org.geysermc.geyser.api.command.CommandSource> -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionGeyserCommand(@NonNull String name, @NonNull String description, @NonNull String permission, @Nullable org.geysermc.geyser.api.util.TriState permissionDefault) GeyserCommand(@NonNull String name, @NonNull String description, @NonNull String permission, @Nullable org.geysermc.geyser.api.util.TriState permissionDefault, boolean playerOnly, boolean bedrockOnly) -
Method Summary
Modifier and TypeMethodDescriptionaliases()final org.incendo.cloud.Command.Builder<GeyserCommandSource> baseBuilder(org.incendo.cloud.CommandManager<GeyserCommandSource> manager) final GeyserPermissioncommandPermission(org.incendo.cloud.CommandManager<GeyserCommandSource> manager) final @NonNull Stringabstract voidexecute(org.incendo.cloud.context.CommandContext<GeyserCommandSource> context) Executes this commandfinal booleanfinal booleanprotected org.incendo.cloud.Command.Builder.Applicable<GeyserCommandSource> meta()final @NonNull Stringname()final @NonNull Stringfinal @Nullable org.geysermc.geyser.api.util.TriStatevoidregister(org.incendo.cloud.CommandManager<GeyserCommandSource> manager) Registers this command to the given command manager.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.geysermc.geyser.api.command.Command
isExecutableOnConsole, isSuggestedOpOnly, subCommands
-
Field Details
-
DEFAULT_ROOT_COMMAND
- See Also:
-
aliases
The aliases of the commandname. This should not be modified after construction.
-
-
Constructor Details
-
GeyserCommand
-
GeyserCommand
-
-
Method Details
-
name
- Specified by:
namein interfaceorg.geysermc.geyser.api.command.Command
-
description
- Specified by:
descriptionin interfaceorg.geysermc.geyser.api.command.Command
-
permission
- Specified by:
permissionin interfaceorg.geysermc.geyser.api.command.Command
-
permissionDefault
public final @Nullable org.geysermc.geyser.api.util.TriState permissionDefault() -
isPlayerOnly
public final boolean isPlayerOnly()- Specified by:
isPlayerOnlyin interfaceorg.geysermc.geyser.api.command.Command
-
isBedrockOnly
public final boolean isBedrockOnly()- Specified by:
isBedrockOnlyin interfaceorg.geysermc.geyser.api.command.Command
-
aliases
- Specified by:
aliasesin interfaceorg.geysermc.geyser.api.command.Command
-
rootCommand
- Returns:
- the first (literal) argument of this command, which comes before
name().
-
commandPermission
public final GeyserPermission commandPermission(org.incendo.cloud.CommandManager<GeyserCommandSource> manager) - Parameters:
manager- the manager to be used for permission node checking- Returns:
- a permission that will properly restrict usage of this command
-
baseBuilder
@Contract(value="_ -> new", pure=true) public final org.incendo.cloud.Command.Builder<GeyserCommandSource> baseBuilder(org.incendo.cloud.CommandManager<GeyserCommandSource> manager) Creates a new command builder withrootCommand(),name(), andaliases()built on it. A permission predicate that takes into accountpermission(),isBedrockOnly(), andisPlayerOnly()is applied. The Applicable frommeta()is also applied to the builder. -
meta
- Returns:
- an Applicable that applies this command's description
-
register
Registers this command to the given command manager. This method may be overridden to register more than one command.The default implementation is that
baseBuilder(CommandManager)withexecute(CommandContext)applied as the handler is registered to the manager. -
execute
Executes this command- Parameters:
context- the context with which this command should be executed
-