GetWorlds()

Discussion in 'Plugin Development' started by alexgeek, Feb 8, 2011.

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

    alexgeek

    This is giving me a headache. I can't use GetWorld as its deprecated due to the Nether updates coming (which will probably mean I'll have to add another column to my list of coordinates to specify which world).

    I'm trying to load in the blocks that have had their position saved,
    I basically want to add all the blocks like this:

    Code:
    list.add( <currentworld>.getBlockAt(res.getInt("x"), res.getInt("y"), res.getInt("z")) );
    
    But getting the world seems an impossible task,

    if I try:
    Code:
    World[] worlds = this.getServer().getWorlds();
    
    I get "Cannot convert from List<World> to World[]"

    Recursively if I try:
    Code:
    List<World> worlds = this.getServer().getWorlds();
    
    I get "Cannot convert from World[] to List<World>"

    Is there another way to get the world?

    Thanks!
     
  2. Offline

    Redecouverte

    thats odd, the List<World> one should work
     
  3. Offline

    alexgeek

    I think it might be that they've recently changed it and somewhere in my code it's saying its a list and somewhere else an array.

    I've redownloaded the bukkit jar and right clicked told maven to update dependencies but still no.

    Frustrating :/
    --- merged: Feb 8, 2011 3:36 PM ---
    Just checked Server.java and it still refers to an array:

    Code:
        /**
         * Gets a list of all worlds on this server
         *
         * @return An array of worlds
         */
        public World[] getWorlds();
    
    I've pressed like every update/download buttons I can see in Eclipse but it's not chaning.
     
  4. Offline

    Redecouverte

    i just checked, the latest bukkit uses
    List<World>

    you could try to "Clean & Build"
    --- merged: Feb 8, 2011 3:40 PM ---
    this is Server.java of latest bukkit:

    Code:
    package org.bukkit;
    
    import java.util.List;
    import org.bukkit.entity.Player;
    import org.bukkit.plugin.PluginManager;
    import org.bukkit.scheduler.BukkitScheduler;
    
    public abstract interface Server
    {
      public abstract String getName();
    
      public abstract String getVersion();
    
      public abstract Player[] getOnlinePlayers();
    
      public abstract int getMaxPlayers();
    
      public abstract int broadcastMessage(String paramString);
    
      public abstract Player getPlayer(String paramString);
    
      public abstract List<Player> matchPlayer(String paramString);
    
      public abstract PluginManager getPluginManager();
    
      public abstract BukkitScheduler getScheduler();
    
      public abstract List<World> getWorlds();
    
      public abstract World createWorld(String paramString, World.Environment paramEnvironment);
    
      public abstract World getWorld(String paramString);
    
      public abstract void reload();
    }
    --- merged: Feb 8, 2011 3:41 PM ---
    http://bamboo.lukegb.com/browse/BUKKIT-BUKKITMAIN/latest
     
  5. Offline

    alexgeek

    Ah finally found the right button, Pull.
    Thanks for the help, should be able to get my plugin to work with a database finally.
     
Thread Status:
Not open for further replies.

Share This Page