Help: Grabbing Multiverse World Aliases

Discussion in 'Plugin Development' started by tastybento, Nov 3, 2013.

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

    tastybento

    Hi,
    I'm only on my second plugin development and I'm banging my head on how to do this. One command in my plugin shows a player info on each of the worlds on the server and currently displays the standard names:
    • world
    • world_nether
    • world_the_end
    • creative
    • etc.
    As my server uses Multiverse-Core, I'd like to show the Alias of the world instead.
    I tried this to get a list of the world aliases on the server:
    Code:java
    1. if (getServer().getPluginManager().getPlugin("Multiverse-Core") != null) {
    2. getLogger().info("Multiverse Core found!");
    3. Plugin plugin = getServer().getPluginManager().getPlugin("Multiverse-Core");
    4. getLogger().info("Get plugin done!");
    5. // Get a list of worlds that MV apparently has
    6. WorldManager wm = new WorldManager((MultiverseCore) plugin);
    7. Collection<MultiverseWorld> wmList = wm.getMVWorlds();
    8. if (wmList != null) {
    9. getLogger().info("World list is " + wmList.size());
    10. for (MultiverseWorld w: wmList) {
    11. getLogger().info("World: " + w.getAlias());
    12. }
    13. }
    14. }

    The problem is that the list (wmList), while not null is zero length and no Aliases are shown. What am I doing wrong?
     
  2. Offline

    tastybento

    I found out how to do this by looking at MVInventories:

    Code:java
    1. MultiverseCore mvCore;
    2. mvCore = (MultiverseCore) this.getServer().getPluginManager().getPlugin("Multiverse-Core");
    3. Collection<MultiverseWorld> wmList = mvCore.getMVWorldManager().getMVWorlds();
    4. if (wmList != null) {
    5. getLogger().info("Number of worlds = " + wmList.size());
    6. for (MultiverseWorld w: wmList) {
    7. getLogger().info("World: " + w.getAlias());
    8. }
    9. }
    10.  
     
Thread Status:
Not open for further replies.

Share This Page