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

Unload Level without Saving

Comments in 'Resources' started by korado531m7, Mar 24, 2016.

  1. korado531m7
    Offline

    korado531m7 Active Member

    Joined:
    Apr 4, 2015
    Posts:
    158
    Minecraft User:
    korado531m7
    MiniGames plugin need restoring world.
    Here's the restoring code (not using copy() ).

    PHP:
    //Unload

    //Please Place World Name in $name
    $this->getServer()->getLevelByName($name)->setAutoSave(false);
    $this->getServer()->unloadLevel($this->getServer()->getLevelByName($name),true);

    to Load,
    PHP:
    $this->getServer()->loadLevel($name);
    I hope to help you.
    Last edited: Mar 24, 2016
    AndrewBit likes this.
  2. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Use setAutoSave(false) instead. It accepts a boolean. It is not right to pass an int to a method expecting a boolean.
    applqpak likes this.
  3. korado531m7
    Offline

    korado531m7 Active Member

    Joined:
    Apr 4, 2015
    Posts:
    158
    Minecraft User:
    korado531m7
    Thank you. But, I tested 0, and it worked..
  4. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Yes I know it works. But it is incorrect. Why do you pass an integer and let it be casted into a boolean when you can simply directly pass a boolean?
    applqpak likes this.
  5. korado531m7
    Offline

    korado531m7 Active Member

    Joined:
    Apr 4, 2015
    Posts:
    158
    Minecraft User:
    korado531m7
    setAutoSave can use true ,false,1and0.
    But 1 and 0 are incorrect...right?
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    applqpak likes this.
  7. Tim // robske Büba
    Offline

    Tim // robske Büba Notable Member

    Joined:
    Feb 26, 2014
    Posts:
    606
    Minecraft User:
    robske_110
    Last edited: Sep 26, 2016
    applqpak likes this.

Share This Page

Advertisement