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

Solved Hack for PM to stop players spawning in the default world

Comments in 'Plugin Development' started by minebuilder0110, Oct 26, 2015.

  1. minebuilder0110
    Offline

    minebuilder0110 Notable Member

    Joined:
    Dec 8, 2014
    Posts:
    485
    Minecraft User:
    Apparitional
    I have noticed a problem where people teleports to the default world spawn upon stopping the server, then joining back into it. This is really troubling me, because this makes LIAB (plugin by aliuly, multiworld inventory stuff) to load the inventory of the world in which the player was in upon stopping the server when they are in the main world. (ie lobby) So is it possible to create a hack to stop players to go to the default world? I thought about teleporting players upon joining, but PlayerQuitEvent cannot be detected on server stop because plugins unload first.
  2. UltimateMcraft
    Offline

    UltimateMcraft New Member

    Joined:
    Feb 17, 2014
    Posts:
    21
    Minecraft User:
    UltimateMcraft
    Hack? Maybe plugin :D
  3. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Plugins are not necessarily enabled when server starts and disabled when server stops. Plugins can be enabled or disabled at the middle of the server runtime. Therefore, always expect there to be players online and not kicked when plugin enables or disables. Just iterate over online players and handle them one by one on plugin disable.
  4. minebuilder0110
    Offline

    minebuilder0110 Notable Member

    Joined:
    Dec 8, 2014
    Posts:
    485
    Minecraft User:
    Apparitional
    But doesn't plugin disable means that the plugin will have no effect on the server because it is, well, disabled? Or is there an event or a way to detect when /stop is executed but right before plugin disables? If this is the way you mean, how should I handle crash?
  5. wolfdale
    Offline

    wolfdale Active Member Plugin Developer

    Joined:
    Dec 3, 2014
    Posts:
    276
    Plugins:
    1
    Minecraft User:
    ace
    Just load all the worlds where there are players at server start and this problem will be solved
    minebuilder0110 likes this.
  6. minebuilder0110
    Offline

    minebuilder0110 Notable Member

    Joined:
    Dec 8, 2014
    Posts:
    485
    Minecraft User:
    Apparitional
    Wait, the reason why people spawned in the default world was just because it wasn't loaded?!
    EDIT: TYTY IT NOW WORKS :D
    Last edited: Oct 27, 2015
  7. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    For crash: you can't handle it, the whole process crashed, and you are lucky you can still recover things like files and free the server port. Crash means termination of everything - you shouldn't be able to handle it, or you will have a high chance of "crashed while crashing".
    For disabling: you don't need to know when the plugin is disabled. Just always assume that the server doesn't stop when your plugin disables, and server has started for a long time and players are already on the server when your plugin enables. This is what plugins should do.

Share This Page

Advertisement