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

Plugin Error

Discussion in 'Facepalm' started by Teamblocket, Apr 29, 2017.

  1. Teamblocket

    Teamblocket Zombie

    Messages:
    301
    GitHub:
    teamblocket
    Code:
    28.04 19:56:06 [Server] CRITICAL ParseError: "syntax error, unexpected 'onInventory' (T_STRING)" (EXCEPTION) in "/Menus/src/TB/Main" at line 57
    this is my error

    PHP:
    public function sendChestInventory(Player $player){
               
    $nbt = new CompoundTag('', [
                new 
    StringTag('id'Tile::CHEST),
                new 
    IntTag('Chest'1),
                new 
    IntTag('x'floor($player->x)),
                new 
    IntTag('y'floor($player->y) - 4),
                new 
    IntTag('z'floor($player->z))
            ]);
            
    /** @var Chest $tile */
            
    $tile Tile::createTile('Chest'$player->getLevel(), $nbt);
            
    $block Block::get(Block::CHEST);
            
    $block->floor($tile->x);
            
    $block->floor($tile->y);
            
    $block->floor($tile->z);
            
    $block->level $tile->getLevel();
            
    $block->level->sendBlocks([$player], [$block]);
                    
    $test Item::get(27901);
                    
    $test->setCustomName("TEST");
                    
    $tile->getInventory()->setItem(0$test);
            
    $player->addWindow($tile);
      }
    }
    line 57 right here
    public function onInventory(InventoryTransactionEvent $event) {
     
  2. RoyalMCPE

    RoyalMCPE Slime

    Messages:
    87
    Remove one of the } at the end
     
  3. Teamblocket

    Teamblocket Zombie

    Messages:
    301
    GitHub:
    teamblocket
    Code:
    28.04 20:14:24 [Server] CRITICAL ParseError: "syntax error, unexpected 'public function' (T_STRING), expecting function (T_FUNCTION)" (EXCEPTION) in "/Menus/src/TB/Main" at line 56
     
  4. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    Please note this is a PMMP API forum not PHP syntax help forum
    we will still welcome you at face palm section
     
    XdmingXD likes this.
  5. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
    The only think that I can think of may be a misplaced }
    PHP:
    public function sendChestInventory(Player $player){
        
    $nbt = new CompoundTag('', [
            new 
    StringTag('id'Tile::CHEST),
            new 
    IntTag('Chest'1),
            new 
    IntTag('x'floor($player->x)),
            new 
    IntTag('y'floor($player->y) - 4),
            new 
    IntTag('z'floor($player->z))
        ]);
        
    /** @var Chest $tile */
        
    $tile Tile::createTile('Chest'$player->getLevel(), $nbt);

        
    $block Block::get(Block::CHEST);
        
    $block->floor($tile->x);
        
    $block->floor($tile->y);
        
    $block->floor($tile->z);
        
    $block->level $tile->getLevel();
        
    $block->level->sendBlocks([$player], [$block]);

        
    $test Item::get(27901);
        
    $test->setCustomName("TEST");
        
    $tile->getInventory()->setItem(0$test);

        
    $player->addWindow($tile);
    }
    public function 
    onInventory(InventoryTransactionEvent $event) {
     
  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.