Code: [77] public function mode($cmd,$issuer){ [78] $world = $issuer->entity->level->getName(); [79] if($issuer instanceof Player){ [80] $output .= "Please run this command in-game.\n"; [81] break; [82] } Hello, 1st : When I run command from the console, it don't display the message and do as normal. 2nd : How to get issuer level name ? Because with this, it says " Error: array ( 'type' => 'E_ERROR', 'message' => 'Call to a member function getName() on a non-object'" Thank you.
Try accepting all the parameters of a commandHandler, also if you you want to see if $issuer isn't a player you need ! to check if it returns false. In addition to this, I don't think break; will have the effect you intend. PHP: public function mode ($cmd, $params, $issuer, $alias, $args, $issuer){$world = $issuer->entity->level->getName();if(!($issuer instanceof Player)){$output .= "Please run this command in-game.\n";break;}...