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

getPlayers() isn't working :(

Comments in 'Plugin Development' started by myst02, May 17, 2015.

  1. myst02
    Offline

    myst02 Active Member

    Joined:
    Mar 23, 2015
    Posts:
    97
    Minecraft User:
    myst02
    Hi,

    I have another problem with my first plugin: getPlayers() does not work for me!

    I am using this code
    Code:
     $count = count($this->getServer()->getLevelByName("PVP")->getPlayers()); 
    And every time I am using this my server crashes.

    Error: Call to a member function getPlayers() on null
    File: /TwinPVP/src/kjjnetwork/TwinPVP/Main
    Line: 35
    Type: E_ERROR

    Am I doing something wrong?

    Thanks at all for your patience with me ;)
    myst02
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Because there is no such level called "PVP".
    Andrey Nazarchuk likes this.
  3. myst02
    Offline

    myst02 Active Member

    Joined:
    Mar 23, 2015
    Posts:
    97
    Minecraft User:
    myst02
    I'm sure there is. Command "/mw tp PVP" does also work.
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Then it has not been loaded yet, and it only loads when you run /mv tp PVP.
    PHP:
    $this->getServer()->loadLevel("PVP");
  5. myst02
    Offline

    myst02 Active Member

    Joined:
    Mar 23, 2015
    Posts:
    97
    Minecraft User:
    myst02
    You are my lifesaver!!!!
    It finally WORKED!!!! Thank you very much!

Share This Page

Advertisement