Throw exception when Server::dispatchCommand() is called with an invalid CommandSender

This commit is contained in:
Shoghi Cervantes 2014-09-19 10:30:35 +02:00
parent ae54426836
commit 5404ba77d0

View File

@ -1714,8 +1714,14 @@ class Server{
* @param string $commandLine
*
* @return bool
*
* @throws \Exception
*/
public function dispatchCommand(CommandSender $sender, $commandLine){
if(!($sender instanceof CommandSender)){
throw new \Exception("CommandSender is not valid");
}
if($this->commandMap->dispatch($sender, $commandLine)){
return true;
}