I have a problem with this. I am making a plugin that uses /hello [player] [message] I made the message $args[1], but if the message has spaces it treats it as $args[2], $args[3] etc... How do I fix this?
it remove args[0] and return $args[0] so you can get reciever using PHP: $this->getServer()->getPlayer(array_shift($args)); and message PHP: implode(' ', $args);
Now it is sendMessage() on null. Why? I checked if the player is online or not with PHP: if($this->getServer()->getPlayer($args[0])->isOnline())
Use PHP: if($args[0] instanceof Player){//Online} else{// Offline}// or$player = $args[0];if($player = $this->getServer()->getPlayer($args[0]){// Online} else{// Offline}
it should be $server->getPlayer($args[0]) instanceof Player. We are already sure that $args[n] must be a string.