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

How to get an area and move it 1 block ahead on player move event

Discussion in 'Development' started by rektpixel, Jan 13, 2018.

  1. rektpixel

    rektpixel Baby Zombie

    Messages:
    186
    I have this code:
    PHP:
      public function getPos1() {
          
    $this->pos1 = new Vector3($pos1["44"],$pos1["122"],$pos1["-896"]);
          return array(
    $this->pos1->getX(),$this->pos1->getY(),$this->pos1->getZ());
      }
     
      public function 
    getPos2() {
          
    $this->pos2 = new Vector3($pos2["44"],$pos2["125"],$pos2["-892"]);
          return array(
    $this->pos2->getX(),$this->pos2->getY(),$this->pos2->getZ());
      }
     
      public function 
    getBlocks(){
          
    $this->blocks = [];
          if((
    min($this->pos1->getX(),$this->pos2->getX()) <= $pos->getX()) && (max($this->pos1->getX(),$this->pos2->getX()) >= $pos->getX()) && (min($this->pos1->getY(),$this->pos2->getY()) <= $pos->getY()) && (max($this->pos1->getY(),$this->pos2->getY()) >= $pos->getY()) && (min($this->pos1->getZ(),$this->pos2->getZ()) <= $pos->getZ()) && (max($this->pos1->getZ(),$this->pos2->getZ()) >= $pos->getZ()) && ($this->level == $level)) {
              return array(
    $this->blocks());
          }
      }
     
      public function 
    checkVoid(PlayerMoveEvent $event){
          
    $level $this->getServer()->getDefaultLevel();
          if(
    $event->getTo()->getFloorY() > 122){;
            
    $b $this->blocks;
            
    $X $b->getX();
            
    $Y $b->getY();
            
    $Z $b->getZ();
            
    $pos = new Vector3($X-1$Y$Z);
            
    $level->setBlock($pos$bfalsefalse);
            return;
          }
      }
    }
    What I'm trying to do here is get an area and move it X-1 (1 block ahead of itself) when a player moves above the height of Y 122 I'm currently getting this error:
    Code:
    [23:07:53] [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\player\PlayerMoveEvent' to 'DeathView v0.0.2': Undefined property: TheDiamondYT\DeathView\Loader::$blocks on TheDiamondYT\DeathView\Loader
    [23:07:53] [Server thread/CRITICAL]: ErrorException: "Undefined property: TheDiamondYT\DeathView\Loader::$blocks" (EXCEPTION) in "DeathView-master/src/TheDiamondYT/DeathView/Loader" at line 157
    [23:07:53] [Server thread/DEBUG]: #0 DeathView-master/src/TheDiamondYT/DeathView/Loader(157): pocketmine\error_handler(integer 8, string Undefined property: TheDiamondYT\DeathView\Loader::$blocks, string C:\Users\Admin\Creative Cloud Files\Desktop\Lobby - DEV\plugins\DeathView-master\src\TheDiamondYT\DeathView\Loader.php, integer 157, array Array())
    [23:07:53] [Server thread/DEBUG]: #1 src/pocketmine/plugin/MethodEventExecutor(38): TheDiamondYT\DeathView\Loader->checkVoid(pocketmine\event\player\PlayerMoveEvent object)
    [23:07:53] [Server thread/DEBUG]: #2 src/pocketmine/plugin/RegisteredListener(98): pocketmine\plugin\MethodEventExecutor->execute(TheDiamondYT\DeathView\Loader object, pocketmine\event\player\PlayerMoveEvent object)
    [23:07:53] [Server thread/DEBUG]: #3 src/pocketmine/plugin/PluginManager(721): pocketmine\plugin\RegisteredListener->callEvent(pocketmine\event\player\PlayerMoveEvent object)
    [23:07:53] [Server thread/DEBUG]: #4 src/pocketmine/Player(1552): pocketmine\plugin\PluginManager->callEvent(pocketmine\event\player\PlayerMoveEvent object)
    [23:07:53] [Server thread/DEBUG]: #5 src/pocketmine/Player(1662): pocketmine\Player->processMovement(integer 1)
    [23:07:53] [Server thread/DEBUG]: #6 src/pocketmine/level/Level(751): pocketmine\Player->onUpdate(integer 1132)
    [23:07:53] [Server thread/DEBUG]: #7 src/pocketmine/Server(2377): pocketmine\level\Level->doTick(integer 1132)
    [23:07:53] [Server thread/DEBUG]: #8 src/pocketmine/Server(2534): pocketmine\Server->checkTickUpdates(integer 1132, double 1515847073.9604)
    [23:07:53] [Server thread/DEBUG]: #9 src/pocketmine/Server(2274): pocketmine\Server->tick()
    [23:07:53] [Server thread/DEBUG]: #10 src/pocketmine/Server(2149): pocketmine\Server->tickProcessor()
    [23:07:53] [Server thread/DEBUG]: #11 src/pocketmine/Server(1737): pocketmine\Server->start()
    [23:07:53] [Server thread/DEBUG]: #12 src/pocketmine/PocketMine(554): pocketmine\Server->__construct(BaseClassLoader object, pocketmine\utils\MainLogger object, string C:\Users\Admin\Creative Cloud Files\Desktop\Lobby - DEV\, string C:\Users\Admin\Creative Cloud Files\Desktop\Lobby - DEV\plugins\)
    [23:07:53] [Server thread/DEBUG]: #13 C:/Users/Admin/Creative Cloud Files/Desktop/Lobby - DEV/PocketMine-MP.phar(1): require(string phar://C:/Users/Admin/Creative Cloud Files/Desktop/Lobby - DEV/PocketMine-MP.phar/src/pocketmine/PocketMine.php)
    
    
    can someone help, there seems to be a problem with $blocks but I don't understand why when it's $this->blocks :(
     
  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.