Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Error: syntax error, unexpected '||' (T_BOOLEAN_OR)

Comments in 'Plugin Development' started by Jelly9912, Nov 17, 2015.

  1. Jelly9912
    Offline

    Jelly9912 Active Member

    Joined:
    Aug 8, 2015
    Posts:
    118
    Minecraft User:
    Jelly9912
    Code:
    PocketMine-Mechanic Crash Dump Tue Nov 17 11:17:25 UTC 2015
    
    Error: syntax error, unexpected '||' (T_BOOLEAN_OR)
    File: /StoneDrop/src/jelly9912/StoneDrop/Main
    Line: 211
    Type: E_PARSE
    
    THIS CRASH WAS CAUSED BY A PLUGIN
    
    Code:
    [202]          $player->getLevel()->setBlock($block, new Block(Block::AIR), false, true);
    [203]          $player->getLevel()->dropItem($block, new Item(4, 0, 1));
    [204]          break;
    [205]      case 45:
    [206]          $player->getLevel()->setBlock($block, new Block(Block::AIR), false, true);
    [207]          $player->getLevel()->dropItem($block, new Item(4, 0, 1));
    [208]          break;
    [209]     
    [210]          }
    [211]       }elseif($block->getId() === Block::COAL_ORE) || ($block->getId() === Block::IRON_ORE) || ($block->getId() === Block::REDSTONE_ORE) || ($block->getId() === Block::GOLD_ORE) || ($block->getId() === Block::DIAMOND_ORE){
    [212]          $player->getLevel()->setBlock($block, new Block(Block::AIR), false, true);
    [213]          $player->getLevel()->dropItem($block, new Item(4, 0, 1));
    [214]       }
    [215]    }
    [216] }
    
    Backtrace:
    #0 (): pocketmine\Server->crashDump(boolean)
    
    PocketMine-MP version: 1.6dev #0 [Protocol 34; API 1.13.0]
    Git commit: 0000000000000000000000000000000000000000
    uname -a: Linux localhost 3.4.0-4760392 #1 SMP PREEMPT Fri May 15 17:47:47 KST 2015 armv7l
    PHP Version: 5.6.2
    Zend version: 2.6.0
    OS : Linux, android
  2. Lambo
    Offline

    Lambo Notable Member Plugin Developer

    Joined:
    Sep 14, 2013
    Posts:
    431
    Plugins:
    4
    Minecraft User:
    Lambo
    Use
    PHP:
    $id $block->getId();
    ... 
    elseif(
    $id === Block::COAL_ORE || $id === Block::IRON_ORE || $id === Block::REDSTONE_ORE || $id === Block::GOLD_ORE || $id === Block::DIAMOND_ORE){
    Jelly9912 likes this.
  3. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    You forgot to add a bracket after opening the elseif() statement and when closing it. Means:
    PHP:
    elseif(($block->getId() === Block::COAL_ORE) || ($block->getId() === Block::IRON_ORE) || ($block->getId() === Block::REDSTONE_ORE) || ($block->getId() === Block::GOLD_ORE) || ($block->getId() === Block::DIAMOND_ORE)){
    Jelly9912 likes this.
  4. Jelly9912
    Offline

    Jelly9912 Active Member

    Joined:
    Aug 8, 2015
    Posts:
    118
    Minecraft User:
    Jelly9912
    Thanks guys, it's work
    Legoboy0215 likes this.
  5. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    Next time, check before you post. BTW, your IDE should pick up the mistake :)
    Gamecrafter and Jelly9912 like this.
  6. Jelly9912
    Offline

    Jelly9912 Active Member

    Joined:
    Aug 8, 2015
    Posts:
    118
    Minecraft User:
    Jelly9912
    Lol I didn't know about the IDE, thanks :rolleyes:

Share This Page

Advertisement