pocketmine\command\CommandReader::getLine PHP Method

getLine() public method

Reads a line from console, if available. Returns null if not available
public getLine ( ) : string | null
return string | null
    public function getLine()
    {
        if ($this->buffer->count() !== 0) {
            return $this->buffer->shift();
        }
        return null;
    }

Usage Example

Esempio n. 1
0
 public function checkConsole()
 {
     Timings::$serverCommandTimer->startTiming();
     if (($line = $this->console->getLine()) !== null) {
         $this->pluginManager->callEvent($ev = new ServerCommandEvent($this->consoleSender, $line));
         if (!$ev->isCancelled()) {
             $this->dispatchCommand($ev->getSender(), $ev->getCommand());
         }
     }
     Timings::$serverCommandTimer->stopTiming();
 }