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

Does this work?

Comments in 'Plugin Development' started by MCPEGamerJP, Sep 21, 2015.

  1. MCPEGamerJP
    Offline

    MCPEGamerJP New Member

    Joined:
    Mar 31, 2015
    Posts:
    17
    Minecraft User:
    MCPEGamerJP
    I'm working on a private plugin and I'm not sure if this function works, please help me.
    Code:
    public function onLoadMap($this, $map, $load){
    $this->loadMap("$map")->$sender->warning("Map .$map. has been loaded!")
    }
    
    
  2. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
  3. MCPEGamerJP
    Offline

    MCPEGamerJP New Member

    Joined:
    Mar 31, 2015
    Posts:
    17
    Minecraft User:
    MCPEGamerJP
    Oh. This proves I am a noob at PHP
  4. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    me too,lol
  5. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    use this
    PHP:
    public function onEnable (){
    $level "Type the map name here";
    if(!
    $this->getServer()->isLevelLoaded($level)) {
    $this->getServer()->loadLevel($level);
    $this->getLogger()->warning($level ' Loaded successfully!');
    }else{
    $this->getLogger()->critical("an unknown error occured while loading level " $level ':(');
                               }
                }
    }
    Last edited: Sep 25, 2015
    TheKofola12 and DunxandMinecraft like this.
  6. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    worked?
    TheKofola12 likes this.
  7. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    Plugins are loaded before worlds. :p Please don't provide invalid solutions.
  8. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    plugin.yml lets you to select to load plugins after world loading or before that (the `load` attribute).

    Note that plugins SHOULD NOT interact with the PocketMine API in the onLoad function.
    jojoe77777 likes this.
  9. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    It's POSTWORLD by default.
  10. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    So that means it is after worlds are loaded.
  11. AndrewBit
    Offline

    AndrewBit Notable Member

    Joined:
    Jun 18, 2015
    Posts:
    435
    Minecraft User:
    AndrewBit4
    A small thing...

    use
    PHP:
    $this->getLogger()->warning($level ' Loaded successfully!');
    and
    PHP:
    $this->getLogger()->critical("error happen while loading " $level ' :(');
    instead of
    PHP:
    $this->getLogger()->warning($level 'Loaded successfully!');
    and
    PHP:
    $this->getLogger()->critical("error happen while loading" $level ':(');
    xD
    Taha_The_Hacker likes this.
  12. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    oops, i am a beginner :oops:
    TheKofola12 likes this.

Share This Page

Advertisement