[20:07:57] [Server thread/CRITICAL]: TypeError: "Argument 2 passed to _64FF00\PureChat\PureChat::setPrefix() must be an instance of pocketmine\Player, string given, called in /root/prison1/plugins/PureChat_v1.4.11/src/_64FF00/PureChat/PureChat.php on line 205" (EXCEPTION) in "plugins/PureChat_v1.4.11/src/_64FF00/PureChat/PureChat" at line 703 case "setprefixs": if(!isset($args[0]) or !isset($args[1])) { $sender->sendMessage(TextFormat::GREEN . self::MAIN_PREFIX . " Usage: /setprefixs <Prefix> <ID>"); return true; } $prefix = str_replace("{BLANK}", ' ', implode('', $args)); $levelName = $this->config->get("enable-multiworld-chat") ? $sender->getLevel()->getName() : null; $this->setPrefix($prefix, $args[1], $levelName); $sender->sendMessage("successfull"); break; //703 code public function setPrefix($prefix, Player $player, $levelName = null) { if($levelName === null) { $this->purePerms->getUserDataMgr()->setNode($player, "prefix", $prefix); } else { $worldData = $this->purePerms->getUserDataMgr()->getWorldData($player, $levelName); $worldData["prefix"] = $prefix; $this->purePerms->getUserDataMgr()->setWorldData($player, $levelName, $worldData); } return true; }
PHP: $player = $this->getServer()->getPlayer($args[1]);if($player !== null) $this->setPrefix($prefix, $player, $levelName);