This commit is contained in:
Dylan K. Taylor 2017-07-14 11:00:59 +01:00
parent c3b8be3f60
commit 9390866a13
2 changed files with 19 additions and 4 deletions

View File

@ -37,9 +37,9 @@ interface CommandMap{
* @param Command $command
* @param string|null $label
*
* @return
* @return bool
*/
public function register(string $fallbackPrefix, Command $command, string $label = null);
public function register(string $fallbackPrefix, Command $command, string $label = null) : bool;
/**
* @param CommandSender $sender

View File

@ -137,7 +137,14 @@ class SimpleCommandMap implements CommandMap{
}
}
public function register(string $fallbackPrefix, Command $command, string $label = null){
/**
* @param string $fallbackPrefix
* @param Command $command
* @param string|null $label
*
* @return bool
*/
public function register(string $fallbackPrefix, Command $command, string $label = null) : bool{
if($label === null){
$label = $command->getName();
}
@ -163,7 +170,15 @@ class SimpleCommandMap implements CommandMap{
return $registered;
}
private function registerAlias(Command $command, $isAlias, $fallbackPrefix, $label){
/**
* @param Command $command
* @param bool $isAlias
* @param string $fallbackPrefix
* @param string $label
*
* @return bool
*/
private function registerAlias(Command $command, bool $isAlias, string $fallbackPrefix, string $label) : bool{
$this->knownCommands[$fallbackPrefix . ":" . $label] = $command;
if(($command instanceof VanillaCommand or $isAlias) and isset($this->knownCommands[$label])){
return false;