mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-26 21:03:45 +00:00
Don't allow registering the same command instance twice
This commit is contained in:
parent
579aecfad7
commit
084774e56c
@ -150,6 +150,9 @@ class SimpleCommandMap implements CommandMap{
|
||||
if(count($command->getPermissions()) === 0){
|
||||
throw new \InvalidArgumentException("Commands must have a permission set");
|
||||
}
|
||||
if(isset($this->uniqueCommands[spl_object_id($command)])){
|
||||
throw new \InvalidArgumentException("This Command object has already been registered");
|
||||
}
|
||||
|
||||
$preferredAlias = trim($preferredAlias);
|
||||
$fallbackPrefix = strtolower(trim($fallbackPrefix));
|
||||
|
Loading…
x
Reference in New Issue
Block a user