Help With Muli World Support

Discussion in 'Plugin Development' started by ACTruncale, Mar 27, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    ACTruncale

    I am trying to create multi-world support for the Slow Health Mod. Ultimately I'd like to have each world have it's own regen rate etc. I don't run multi-worlds on my server (haven't really tried) and would like anyone's help to make this happen. I will of course give full credit.

    I have a hashmap of all worlds on server. Lets use this as a starting point.

    Need help with:
    • Need help with finding what world the player is in. (Edward Hand)
    • An explanation of how to set up a multi-world server for testing (Drakia)
    • Is there a max amount of worlds someone can create on their server? (Drakia)
    • A way to have only one timer run for all worlds.
    Here is the thread:
    http://forums.bukkit.org/threads/inactive-mech-slowhealth-v2-3-auto-heal-hurt-432.1256/
     
  2. Offline

    Edward Hand

    I don't know much about setting up a multiworld server, but to find what world a player is in:
    Code:
    thePlayer.getLocation().getWorld();
     
  3. Offline

    ACTruncale

    This helps. What kind of data does it return? A String or and Int?

    Edit: It returns a World Obj.
     
  4. Offline

    Drakia

    To setup a multi-world server just grab MultiVerse and type:
    /mvcreate otherworld normal
    You now have two different worlds. You can teleport between them using:
    /mvtp {worldname} (So something like /mvtp otherworld)
    You can list your worlds using
    /mvlist

    There is no maximum amount of worlds available, a user can create as many as they want.
    The best method I can think of for something like Slow Health would be have a HashMap of <String, SHConf> objects, where SHConf is a class containing the configuration variables for that specific world, and the String is the world name. Store each worlds config in a different file (This is FAR easier than trying to store everything in a single file, though both are possible), and load only the active worlds into the hashmap (Go through getServer().getWorlds() on startup, and hook into WORLD_LOAD to get whatever is created after your plugin starts).

    At the moment, you can't depend on world.equals() or world == otherworld, as in 556 there is a bug where two instances of a world are created. This is why I say to go based on the worlds name instead of the world obejct.
     
  5. Offline

    ACTruncale

    Thanks! If I have any more questions I'll ask. I think this is all I need to get this configured.

    I am going to try to still keep this optimized using only one timer, i think having a different timer for every world might not be a good idea memory wise. Although I might not be able to.
     
Thread Status:
Not open for further replies.

Share This Page