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

Solved Get Level onBreak/onPlace

Comments in 'Plugin Development' started by MineBuilderFR, Dec 14, 2015.

  1. MineBuilderFR
    Offline

    MineBuilderFR Active Member

    Joined:
    Mar 14, 2015
    Posts:
    56
    Minecraft User:
    MineBuilderFR
    get Player Level on break?

    I have test this :

    =-=
    $pl = $player->getLevel()->getName();
    =-=

    D'ont work onbreak
  2. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    Read the docs
    PHP:
    $event->getBlock()->getLevel();
    Primus likes this.
  3. MineBuilderFR
    Offline

    MineBuilderFR Active Member

    Joined:
    Mar 14, 2015
    Posts:
    56
    Minecraft User:
    MineBuilderFR
    Ah , XD Thanks :)
  4. TutoGamerWalid
    Offline

    TutoGamerWalid Active Member

    Joined:
    Jun 11, 2015
    Posts:
    69
    Minecraft User:
    TutoGamerWalid
    PHP:
    $player $event->getPlayer();
    $pl $event->getBlock()->getLevel();
       
    //code here ......
    And read the doc lol
  5. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    $player->getLevel() should theoretically be identical to $block->getLevel().
    Primus likes this.
  6. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    And as a fact it always is identical.
  7. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    In theory we assert them identical. In practice we always note the possibility of bugs or your own bugs (e.g. if the player is teleported to another level when you run that code, e.g. from a portal plugin).
  8. MineBuilderFR
    Offline

    MineBuilderFR Active Member

    Joined:
    Mar 14, 2015
    Posts:
    56
    Minecraft User:
    MineBuilderFR

Share This Page

Advertisement