1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Pchat Edit By I error ...

Discussion in 'Plugin Help' started by sdsd16, May 18, 2019.

  1. sdsd16

    sdsd16 Spider Jockey

    Messages:
    41
    GitHub:
    Danding1314
    [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;
    }
     
  2. wolfdale

    wolfdale Zombie Pigman

    Messages:
    535
    GitHub:
    diamond-gold
    PHP:
    $player $this->getServer()->getPlayer($args[1]);
    if(
    $player !== null$this->setPrefix($prefix$player$levelName);
     
    sdsd16 likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.