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

setBlock() & getLevel()

Comments in 'Plugin Development' started by Cristalix, Apr 17, 2016.

  1. Cristalix
    Offline

    Cristalix New Member

    Joined:
    Sep 10, 2015
    Posts:
    38
    Minecraft User:
    Gistrec
    [​IMG]
    Could not pass event 'pocketmine\event\block\BlockBreakEvent' to 'NewPlugin v1': Missing argument 1 for pocketmine\Server::getLevel() on line 34 (setBlockIdAt()...)
  2. AndrewBit
    Offline

    AndrewBit Notable Member

    Joined:
    Jun 18, 2015
    Posts:
    435
    Minecraft User:
    AndrewBit4
    Missing argument 1 for pocketmine\Server::getLevel() on line 34
    PHP:
    /**
        * @param int $levelId
        *
        * @return Level
        */
        
    public function getLevel($levelId){
            if(isset(
    $this->levels[$levelId])){
                return 
    $this->levels[$levelId];
            }
            return 
    null;
        }
    https://github.com/PocketMine/PocketMine-MP/blob/master/src/pocketmine/Server.php

    If you're trying to get the default level, do getDefaultLevel method.
    If you want get a level by name, do getLevelByName method.
    Last edited: Apr 17, 2016
    Cristalix likes this.
  3. Vaivez66
    Offline

    Vaivez66 Notable Member Plugin Developer

    Joined:
    Jun 10, 2015
    Posts:
    402
    Plugins:
    2
  4. Cristalix
    Offline

    Cristalix New Member

    Joined:
    Sep 10, 2015
    Posts:
    38
    Minecraft User:
    Gistrec
    Last edited: Apr 17, 2016
  5. Nawaf_Craft1b
    Offline

    Nawaf_Craft1b Active Member Plugin Developer

    Joined:
    May 8, 2015
    Posts:
    232
    Plugins:
    1
    Minecraft User:
    Nawaf_Craft1b
    You Can Make
    PHP:
    $var->getPlayer()->getLevel();... # get Player Level
    # OR
    foreach($server->getLevels() as $l){ # get All Level
    # OR
    $server->getLevelByName($levelname); # get Level In $levelname World
  6. Nawaf_Craft1b
    Offline

    Nawaf_Craft1b Active Member Plugin Developer

    Joined:
    May 8, 2015
    Posts:
    232
    Plugins:
    1
    Minecraft User:
    Nawaf_Craft1b
    PHP:
    $level->setBlockIdAt($x$y$z$id);

Share This Page

Advertisement