PocketMine-MP 5.36.1 git-eaa7c4834c8fe2f379d24e7f0ee6cc63cfb18ccc
Loading...
Searching...
No Matches
pocketmine\command\CommandMap Interface Reference
+ Inheritance diagram for pocketmine\command\CommandMap:
+ Collaboration diagram for pocketmine\command\CommandMap:

Public Member Functions

 clearCommands ()
 
 dispatch (CommandSender $sender, string $cmdLine)
 
 getAliasMap ()
 
 getCommand (string $name, ?CommandAliasMap $senderAliasMap=null)
 
 register (Command $command, array $otherAliases=[])
 

Detailed Description

Definition at line 26 of file CommandMap.php.

Member Function Documentation

◆ getAliasMap()

pocketmine\command\CommandMap::getAliasMap ( )

Returns the global alias map for this command map. Aliases in this map will be used as a fallback when user-specific aliases don't give any results.

Implemented in pocketmine\command\SimpleCommandMap.

◆ getCommand()

pocketmine\command\CommandMap::getCommand ( string $name,
?CommandAliasMap $senderAliasMap = null )

Returns the command(s) bound to the given name or alias. This will return an array if the alias is conflicted (multiple commands bound to it).

Returns
Command|Command[]|null @phpstan-return Command|array<int, Command>|null

Implemented in pocketmine\command\SimpleCommandMap.

◆ register()

pocketmine\command\CommandMap::register ( Command $command,
array $otherAliases = [] )

Registering a command with (command(namespace="myplugin", name="mycommand"), otherAliases=["myc"]) will bind:

  • /myplugin:mycommand (always works, error thrown if not unique)
  • /mycommand (only works if not conflicted, not required to be unique)
  • /myc (only works if not conflicted, not required to be unique)

If two commands claim the same alias, it will become conflicted, and neither command will be usable with that alias unless the alias is explicitly rebound in the alias map. The user will be shown an error when trying to use it, listing all namespaced names (not aliases) of the commands bound to it. The user can then use one of the namespaced names to run the command they want.

Parameters
string[]$otherAliases

@phpstan-param list<string> $otherAliases

Implemented in pocketmine\command\SimpleCommandMap.


The documentation for this interface was generated from the following file: