Hopperlib
Loading...
Searching...
No Matches
cc.mrcl.hopperlib.Command.HopperCommand< T extends JavaPlugin > Class Template Referenceabstract
Inheritance diagram for cc.mrcl.hopperlib.Command.HopperCommand< T extends JavaPlugin >:
cc.mrcl.hopperlib.Command.DebugCommands.DebugCommand cc.mrcl.hopperlib.Command.DebugCommands.DebugBaseCommand cc.mrcl.hopperlib.Command.DebugCommands.StatsCommand cc.mrcl.hopperlib.Command.DebugCommands.LibCommand cc.mrcl.hopperlib.Command.DebugCommands.RenderCommand

Public Member Functions

 HopperCommand (String name)
boolean onCommand (@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s, String[] strings)
HopperCommand< T > register ()
HopperCommand< T > register (T plugin)
void unregister ()
void setReflectCommand (ReflectCommand reflectCommand)
ReflectCommand getReflectCommand ()
void addSubcommand (HopperCommand< T > carthageCommand)
void findSubcommand (int index)
List< String > getPermissions ()
String getRootPermission ()
String getFullRootPermission ()
String[] getArgs ()
CommandSender getCommandSender ()
String getName ()
List< String > getAliases ()
String getDescription ()
List< HopperCommand< T > > getSubcommands ()
HopperCommand< T > getSuperCommand ()
Command getBukkitCommand ()
getPlugin ()
void checkPermission (CommandSender sender, boolean strict)
void checkPermission (boolean strict)
void checkPermission ()
String getArgumentDescription ()
String getUsage ()
List< String > onTabComplete (@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, String[] args)

Protected Member Functions

abstract void doCommand ()
void addAlias (String s)
void error (String message, String debugMessage) throws CommandException
void error (String message)
void permissionError (List< String > permissions)
void argumentError (String message)
void sendSuccess (String message)
void sendSuccess (CommandSender sender, String message)
void sendFailure (String message)
void sendFailure (CommandSender sender, String message)
void sendInfo (String message)
void sendInfo (CommandSender sender, String message)
void sendMessage (String message)
void sendMessage (CommandSender sender, String message)
void sendColoredComponent (String message, TextColor color)
void sendColoredComponent (CommandSender sender, String message, TextColor color)
void sendComponent (Component component)
void sendComponent (CommandSender sender, Component component)
abstract String getGlobalRootPermission ()
String getNamespace ()
void setDescription (String description)
void setArgumentDescription (String argumentDescription)
void setSuperCommand (HopperCommand< T > superCommand)
void checkPermission (CommandSender sender, String permission)
void checkPermission (String permission)
int checkArgLength (int min, int max)
int checkArgLength (int min)
int getArgsLength ()
Player tryGetPlayerOrSelf (int index)
Player tryGetPlayer ()
Player tryGetPlayer (int index)
Player tryGetPlayer (String str)
int tryGetInt (int index)
int tryGetInt (String str)
int tryGetInt (int index, int base)
int tryGetInt (String str, int base)
boolean tryGetBoolean (int index)
boolean tryGetBoolean (String str)
Material tryGetMaterial (int index)
String tryGetString (int index)
double tryGetDouble (int index)
double tryGetDouble (String str)
float tryGetFloat (int index)
float tryGetFloat (String str)
BlockFace tryGetOrientation (int index)
BlockFace tryGetOrientation (String str)
Location tryGetSenderLocation ()
Location tryGetLocation (int indexX, int indexY, int indexZ)
Location tryGetLocation (int indexWorld, int indexX, int indexY, int indexZ)
Location tryGetLocation (double x, double y, double z)
World tryGetSenderWorld ()
World tryGetWorld (int index)
World tryGetWorld (String string)
GameParameter<?> tryGetGameParameter (HopperConfigFile configManager, int index)
GameParameter<?> tryGetGameParameter (HopperConfigFile configManager, String string)
FeatureFlag tryGetFeatureFlag (HopperConfigFile configManager, int index)
FeatureFlag tryGetFeatureFlag (HopperConfigFile configManager, String string)
void setRootPermission (String rootPermission)
void setSkipPermissionCheck (boolean skipPermissionCheck)
void skipPermissionCheck ()
void setCompleterSubargumentIndex (int completerSubargumentIndex)
void addTabCompleterArguments (int index, String... arguments)
void addTabCompleterArguments (int index, @NotNull Supplier< List< String > > supplier)
void addTabCompleterArguments (int index, @NotNull Function< TabCompleterContext, List< String > > function)
List< String > autoCompletePlayerNames ()
List< String > autoCompleteWorlds ()
List< String > autoCompleteBoolean ()
List< String > autoCompleteYawOrientations ()
List< String > autoCompletePages (List<?> list)
List< String > autoCompleteRange (int initial, int bound)
Block getTabCompletedBlock (TabCompleterContext context)
List< String > autoCompleteLookX (TabCompleterContext context)
List< String > autoCompleteLookY (TabCompleterContext context)
List< String > autoCompleteLookZ (TabCompleterContext context)
List< String > autoCompleteGameParameters (HopperConfigFile configManager)
List< String > autoCompleteFeatureFlags (HopperConfigFile configManager)
SelectionListener tryRegisterSelectionListener (SelectionListener listener)
SelectionListener tryRegisterBlockSelectionListener (Consumer< Block > operation)
SelectionListener tryRegisterBlockSelectionListener (Player player, Consumer< Block > operation)
SelectionListener tryRegisterBlockSelectionListener (BiConsumer< Block, BlockFace > operation)
SelectionListener tryRegisterBlockSelectionListener (Player player, BiConsumer< Block, BlockFace > operation)
SelectionListener tryRegisterEntitySelectionListener (Consumer< Entity > operation)
SelectionListener tryRegisterEntitySelectionListener (Player player, Consumer< Entity > operation)

Protected Attributes

plugin

Member Function Documentation

◆ autoCompletePlayerNames()

List< String > cc.mrcl.hopperlib.Command.HopperCommand< T extends JavaPlugin >.autoCompletePlayerNames ( )
protected
Returns
A list of online player names

◆ checkPermission() [1/3]

void cc.mrcl.hopperlib.Command.HopperCommand< T extends JavaPlugin >.checkPermission ( )

Checks if the current commandsender has the permission from this command, ignoring subcommand permissions.

See also
checkPermission(CommandSender, boolean)

◆ checkPermission() [2/3]

void cc.mrcl.hopperlib.Command.HopperCommand< T extends JavaPlugin >.checkPermission ( boolean strict)

Checks if the current commandsender has permission to run this command.

Parameters
strictWhen strict, don't consider subcommand permissions.
See also
checkPermission(CommandSender, boolean)

◆ checkPermission() [3/3]

void cc.mrcl.hopperlib.Command.HopperCommand< T extends JavaPlugin >.checkPermission ( CommandSender sender,
boolean strict )

Checks if a given CommandSender has permission to run this command.

Parameters
sender
strictWhen strict, don't consider subcommand permissions.

◆ findSubcommand()

void cc.mrcl.hopperlib.Command.HopperCommand< T extends JavaPlugin >.findSubcommand ( int index)
Parameters
index0-based index to find the subcommand at

◆ getGlobalRootPermission()

abstract String cc.mrcl.hopperlib.Command.HopperCommand< T extends JavaPlugin >.getGlobalRootPermission ( )
abstractprotected
Returns
The global root permission for this plugin as a pure string (eg "ProjectCarthage")

Reimplemented in cc.mrcl.hopperlib.Command.DebugCommands.DebugCommand.

◆ getNamespace()

String cc.mrcl.hopperlib.Command.HopperCommand< T extends JavaPlugin >.getNamespace ( )
protected
Returns
The namespace of the command, usually the plugin name

Reimplemented in cc.mrcl.hopperlib.Command.DebugCommands.DebugCommand.

◆ getPermissions()

List< String > cc.mrcl.hopperlib.Command.HopperCommand< T extends JavaPlugin >.getPermissions ( )
Returns
this method will return all valid permissions for this command.

◆ setRootPermission()

void cc.mrcl.hopperlib.Command.HopperCommand< T extends JavaPlugin >.setRootPermission ( String rootPermission)
protected
Parameters
rootPermissionthe pure name of the permission node, without '.' character.

◆ tryGetBoolean() [1/2]

boolean cc.mrcl.hopperlib.Command.HopperCommand< T extends JavaPlugin >.tryGetBoolean ( int index)
protected
Parameters
indexthe 0-based index of the argument you want to parse
Returns
the boolean, throws error if not a boolean

◆ tryGetBoolean() [2/2]

boolean cc.mrcl.hopperlib.Command.HopperCommand< T extends JavaPlugin >.tryGetBoolean ( String str)
protected
Parameters
strthe string you want to parse
Returns
the boolean, throws error if not a boolean

◆ tryGetDouble() [1/2]

double cc.mrcl.hopperlib.Command.HopperCommand< T extends JavaPlugin >.tryGetDouble ( int index)
protected
Parameters
indexthe 0-based index of the argument you want to parse
Returns
the double, throws error if not a number

◆ tryGetDouble() [2/2]

double cc.mrcl.hopperlib.Command.HopperCommand< T extends JavaPlugin >.tryGetDouble ( String str)
protected
Parameters
strthe string you want to parse
Returns
the double, throws error if not a number

◆ tryGetFloat() [1/2]

float cc.mrcl.hopperlib.Command.HopperCommand< T extends JavaPlugin >.tryGetFloat ( int index)
protected
Parameters
indexthe 0-based index of the argument you want to parse
Returns
the float, throws error if not a number

◆ tryGetFloat() [2/2]

float cc.mrcl.hopperlib.Command.HopperCommand< T extends JavaPlugin >.tryGetFloat ( String str)
protected
Parameters
strthe string you want to parse
Returns
the float, throws error if not a number

◆ tryGetInt() [1/4]

int cc.mrcl.hopperlib.Command.HopperCommand< T extends JavaPlugin >.tryGetInt ( int index)
protected
Parameters
indexthe 0-based index of the argument you want to parse
Returns
the int, throws error if not a number

◆ tryGetInt() [2/4]

int cc.mrcl.hopperlib.Command.HopperCommand< T extends JavaPlugin >.tryGetInt ( int index,
int base )
protected
Parameters
indexthe 0-based index of the argument you want to parse
basethe number base to parse the string in
Returns
the int, throws error if not a number

◆ tryGetInt() [3/4]

int cc.mrcl.hopperlib.Command.HopperCommand< T extends JavaPlugin >.tryGetInt ( String str)
protected
Parameters
strthe string you want to parse
Returns
the int, throws error if not a number

◆ tryGetInt() [4/4]

int cc.mrcl.hopperlib.Command.HopperCommand< T extends JavaPlugin >.tryGetInt ( String str,
int base )
protected
Parameters
strthe string you want to parse
basethe number base to parse the string in
Returns
the int, throws error if not a number

◆ tryGetMaterial()

Material cc.mrcl.hopperlib.Command.HopperCommand< T extends JavaPlugin >.tryGetMaterial ( int index)
protected
Parameters
indexthe 0-based index of the argument you want to parse
Returns
the material, throws error if not a material name

◆ tryGetOrientation() [1/2]

BlockFace cc.mrcl.hopperlib.Command.HopperCommand< T extends JavaPlugin >.tryGetOrientation ( int index)
protected
Parameters
indexthe 0-based index of the argument you want to parse
Returns
the blockface, throws error if not a number

◆ tryGetOrientation() [2/2]

BlockFace cc.mrcl.hopperlib.Command.HopperCommand< T extends JavaPlugin >.tryGetOrientation ( String str)
protected
Parameters
strthe string you want to parse
Returns
the blockface, throws error if not a number

◆ tryGetPlayer() [1/3]

Player cc.mrcl.hopperlib.Command.HopperCommand< T extends JavaPlugin >.tryGetPlayer ( )
protected
Returns
Player object cast from CommandSender. Throws error if not a player.

◆ tryGetPlayer() [2/3]

Player cc.mrcl.hopperlib.Command.HopperCommand< T extends JavaPlugin >.tryGetPlayer ( int index)
protected
Parameters
indexthe 0-based index of the argument you want to parse
Returns
the Player, throws error if not a Player

◆ tryGetPlayer() [3/3]

Player cc.mrcl.hopperlib.Command.HopperCommand< T extends JavaPlugin >.tryGetPlayer ( String str)
protected
Parameters
strthe name of the Player you want to parse
Returns
the Player, throws error if not a Player

◆ tryGetPlayerOrSelf()

Player cc.mrcl.hopperlib.Command.HopperCommand< T extends JavaPlugin >.tryGetPlayerOrSelf ( int index)
protected
Returns
Player object from the argument or self if the command sender is a player and there's no argument.

◆ tryGetSenderLocation()

Location cc.mrcl.hopperlib.Command.HopperCommand< T extends JavaPlugin >.tryGetSenderLocation ( )
protected
Returns
the CommandSender location, throws error if not a Player or a CMD Block

◆ tryGetString()

String cc.mrcl.hopperlib.Command.HopperCommand< T extends JavaPlugin >.tryGetString ( int index)
protected
Parameters
indexthe 0-based index of the argument you want to parse
Returns
the String, throws error if out of bounds

◆ tryRegisterBlockSelectionListener() [1/4]

SelectionListener cc.mrcl.hopperlib.Command.HopperCommand< T extends JavaPlugin >.tryRegisterBlockSelectionListener ( BiConsumer< Block, BlockFace > operation)
protected

It registers a SelectionListener that targets right-clicking a block, along with a clicked face

Parameters
operationthe operation to perform once a block is right-clicked

◆ tryRegisterBlockSelectionListener() [2/4]

SelectionListener cc.mrcl.hopperlib.Command.HopperCommand< T extends JavaPlugin >.tryRegisterBlockSelectionListener ( Consumer< Block > operation)
protected

It registers a SelectionListener that targets right-clicking a block

Parameters
operationthe operation to perform once a block is right-clicked

◆ tryRegisterBlockSelectionListener() [3/4]

SelectionListener cc.mrcl.hopperlib.Command.HopperCommand< T extends JavaPlugin >.tryRegisterBlockSelectionListener ( Player player,
BiConsumer< Block, BlockFace > operation )
protected

It registers a SelectionListener that targets right-clicking a block, along with a clicked face

Parameters
operationthe operation to perform once a block is right-clicked
playerthe player who should be targeted in this SelectionListener

◆ tryRegisterBlockSelectionListener() [4/4]

SelectionListener cc.mrcl.hopperlib.Command.HopperCommand< T extends JavaPlugin >.tryRegisterBlockSelectionListener ( Player player,
Consumer< Block > operation )
protected

It registers a SelectionListener that targets right-clicking a block

Parameters
operationthe operation to perform once a block is right-clicked
playerthe player who should be targeted in this SelectionListener

◆ tryRegisterEntitySelectionListener() [1/2]

SelectionListener cc.mrcl.hopperlib.Command.HopperCommand< T extends JavaPlugin >.tryRegisterEntitySelectionListener ( Consumer< Entity > operation)
protected

It registers a SelectionListener that targets right-clicking an entity

Parameters
operationthe operation to perform once an entity is right-clicked

◆ tryRegisterEntitySelectionListener() [2/2]

SelectionListener cc.mrcl.hopperlib.Command.HopperCommand< T extends JavaPlugin >.tryRegisterEntitySelectionListener ( Player player,
Consumer< Entity > operation )
protected

It registers a SelectionListener that targets right-clicking an entity

Parameters
playerthe player who should be targeted in this SelectionListener
operationthe operation to perform once an entity is right-clicked

◆ tryRegisterSelectionListener()

SelectionListener cc.mrcl.hopperlib.Command.HopperCommand< T extends JavaPlugin >.tryRegisterSelectionListener ( SelectionListener listener)
protected

It registers a new SelectionListener for this command

Parameters
listeneran already-created SelectionListener

The documentation for this class was generated from the following file:
  • src/main/java/cc/mrcl/hopperlib/Command/HopperCommand.java