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

Solved Player::setLevel()

Comments in 'Plugin Development' started by TryoneLegendZzz, Jan 27, 2016.

  1. TryoneLegendZzz
    Offline

    TryoneLegendZzz Active Member

    Joined:
    May 31, 2015
    Posts:
    201
    Minecraft User:
    SavionLegendZzz
    When i do Player::setLevel(/*level*/); it wont allow players to pvp and it dosent throw a error in console. Any help?
  2. Andrey Nazarchuk
    Offline

    Andrey Nazarchuk Active Member

    Joined:
    Dec 30, 2013
    Posts:
    332
    Minecraft User:
    digita1eclipse
    Why don't you just teleport instead?
    Use "->" instead of "::"
  3. AndrewBit
    Offline

    AndrewBit Notable Member

    Joined:
    Jun 18, 2015
    Posts:
    435
    Minecraft User:
    AndrewBit4
    I suppose that it's only an example. The best method in anyway is:
    PHP:
    /**
    * @param Player $player
    * @param Level $level
    */
    $player->setLevel($level);
  4. MyNameIsTriXz
    Offline

    MyNameIsTriXz Notable Member

    Joined:
    Aug 17, 2015
    Posts:
    538
    Minecraft User:
    MyNameIsTriXz

    How do you expect that your post helps?
  5. TryoneLegendZzz
    Offline

    TryoneLegendZzz Active Member

    Joined:
    May 31, 2015
    Posts:
    201
    Minecraft User:
    SavionLegendZzz
    Player:: is the class use of pocketmine\Player;
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    And Player::setLevel() is a non-static method, and `Player::setLevel()` is a static method of calling it, which is wrong. We are saying "Player::setLevel()" when talking on forums because we are referring to that function, not to tell you to write that code as-is.

Share This Page

Advertisement