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

Public Member Functions

 __construct (private Server $server)
 
 clearCommands ()
 
 dispatch (CommandSender $sender, string $commandLine)
 
 getAliasMap ()
 
 getCommand (string $name, ?CommandAliasMap $senderAliasMap=null)
 
 getUniqueCommands ()
 
 register (Command $command, array $otherAliases=[])
 
 registerServerAliases ()
 
 unregister (Command $command)
 

Static Public Member Functions

static handleConflicted (CommandSender $sender, string $alias, array $conflictedEntries, CommandAliasMap $fallbackAliasMap)
 

Detailed Description

Definition at line 87 of file SimpleCommandMap.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\command\SimpleCommandMap::__construct ( private Server $server)

Definition at line 97 of file SimpleCommandMap.php.

Member Function Documentation

◆ clearCommands()

pocketmine\command\SimpleCommandMap::clearCommands ( )

Implements pocketmine\command\CommandMap.

Definition at line 236 of file SimpleCommandMap.php.

◆ dispatch()

pocketmine\command\SimpleCommandMap::dispatch ( CommandSender $sender,
string $commandLine )

Implements pocketmine\command\CommandMap.

Definition at line 174 of file SimpleCommandMap.php.

◆ getAliasMap()

pocketmine\command\SimpleCommandMap::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.

Implements pocketmine\command\CommandMap.

Definition at line 322 of file SimpleCommandMap.php.

◆ getCommand()

pocketmine\command\SimpleCommandMap::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

Implements pocketmine\command\CommandMap.

Definition at line 242 of file SimpleCommandMap.php.

◆ getUniqueCommands()

pocketmine\command\SimpleCommandMap::getUniqueCommands ( )
Returns
Command[] @phpstan-return array<string, Command>

Definition at line 268 of file SimpleCommandMap.php.

◆ handleConflicted()

static pocketmine\command\SimpleCommandMap::handleConflicted ( CommandSender $sender,
string $alias,
array $conflictedEntries,
CommandAliasMap $fallbackAliasMap )
static

TODO: probably need to find a better place to put this

Definition at line 213 of file SimpleCommandMap.php.

Referenced by pocketmine\command\defaults\HelpCommand\execute().

+ Here is the caller graph for this function:

◆ register()

pocketmine\command\SimpleCommandMap::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

Implements pocketmine\command\CommandMap.

Definition at line 148 of file SimpleCommandMap.php.

◆ registerServerAliases()

pocketmine\command\SimpleCommandMap::registerServerAliases ( )

Definition at line 272 of file SimpleCommandMap.php.

◆ unregister()

pocketmine\command\SimpleCommandMap::unregister ( Command $command)

Definition at line 167 of file SimpleCommandMap.php.


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