mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-05 01:16:15 +00:00
Added Help command
This commit is contained in:
@ -26,6 +26,7 @@
|
||||
namespace PocketMine;
|
||||
|
||||
use PocketMine\Block\Block;
|
||||
use PocketMine\Command\CommandSender;
|
||||
use PocketMine\Command\ConsoleCommandSender;
|
||||
use PocketMine\Command\SimpleCommandMap;
|
||||
use PocketMine\Entity\Entity;
|
||||
@ -281,6 +282,13 @@ class Server{
|
||||
return $this->interface;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return SimpleCommandMap
|
||||
*/
|
||||
public function getCommandMap(){
|
||||
return $this->commandMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $variable
|
||||
* @param string $defaultValue
|
||||
@ -497,10 +505,32 @@ class Server{
|
||||
|
||||
public function checkConsole(){
|
||||
if(($line = $this->console->getLine()) !== null){
|
||||
$this->commandMap->dispatch($this->consoleSender, $line);
|
||||
$this->dispatchCommand($this->consoleSender, $line);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a command from a CommandSender
|
||||
*
|
||||
* @param CommandSender $sender
|
||||
* @param string $commandLine
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function dispatchCommand(CommandSender $sender, $commandLine){
|
||||
if($this->commandMap->dispatch($sender, $commandLine)){
|
||||
return true;
|
||||
}
|
||||
|
||||
if($sender instanceof Player){
|
||||
$sender->sendMessage("Unknown command. Type \"/help\" for help.");
|
||||
}else{
|
||||
$sender->sendMessage("Unknown command. Type \"help\" for help.");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts the PocketMine-MP server and starts processing ticks and packets
|
||||
*/
|
||||
|
Reference in New Issue
Block a user