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

Solved Setblock error

Discussion in 'Development' started by xXNiceAssassinlo YT, May 13, 2018.

  1. xXNiceAssassinlo YT

    xXNiceAssassinlo YT Zombie Pigman

    Messages:
    499
    GitHub:
    xXNiceYT
    PHP:
        public function drawPlot($sender$faction$x$y$z$level$size) {
            
    $arm = ($size 1) / 2;
            
    $block = new Snow();
            if (
    $this->cornerIsInPlot($x $arm$z $arm$x $arm$z $arm)) {
                
    $claimedBy $this->factionFromPoint($x$z);
                
    $power_claimedBy $this->getFactionPower($claimedBy);
                
    $power_sender $this->getFactionPower($faction);

            if (
    $this->prefs->get("EnableOverClaim")) {
                    if (
    $power_sender $power_claimedBy) {
                        
    $sender->sendMessage($this->formatMessage("§cYou don't have enough power to overclaim this plot."));
                    } else {
                        
    $sender->sendMessage($this->formatMessage("§bYou have enough STR power to overclaim this plot! Now, Type §3/f overclaim to overclaim this plot if you want."));
                    }
                    return 
    false;
                } else {
                    
    $sender->sendMessage($this->formatMessage("§2Overclaiming is disabled."));
                    return 
    false;
            }
            }
            
    $level->setBlock(new Vector3($x $arm$y$z $arm), $block);
            
    $level->setBlock(new Vector3($x $arm$y$z $arm), $block);
            
    $this->newPlot($faction$x $arm$z $arm$x $arm$z $arm);
            return 
    true;
        }
    err
    PHP:
    Could not pass event 'pocketmine\event\player\PlayerMoveEvent' to 'FactionsPro v2.0.0-implement'Call to a member function setBlock() on string on FactionsPro\FactionListener
    [20:20:07] [Server thread/CRITICAL]: Error"Call to a member function setBlock() on string" (EXCEPTIONin "FactionsPro-master/src/FactionsPro/FactionMain" at line 369
     
  2. Miste

    Miste Baby Zombie

    Messages:
    109
    GitHub:
    Misteboss
    As the error told you, the $level var is a string so you should var_dump() it to check what it is.
    I assume that it's the level name so just get the Level instance to fix that
    PHP:
    $this->getServer()->getLevelByName($level)->setBlock();
     
  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.