Solved Problem Loading World -> I am an Idiot

Discussion in 'Plugin Development' started by THEPADA, Apr 3, 2015.

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

    THEPADA

    Hey,

    I have a Problem with loading a specific world... :/

    i can't find my mistake :(

    Code:
    String worldName = "ZGameWorld";
    World gameWorld;
    
    public void LoadOrCreateWorld()
        {
            gameWorld = new WorldCreator(worldName).createWorld();
    
            if(!Bukkit.getServer().getWorlds().add(gameWorld));
            {
                Bukkit.getServer().broadcastMessage("World: "+worldName+ " could not be found :(");
                Bukkit.getServer().broadcastMessage("A World "+ worldName + " will be created");
             
                gameWorld = createWorld(worldName);
                Bukkit.getServer().broadcastMessage( ChatColor.GREEN + "World: "+worldName+ " was created");
            }     
        }
     
        public World createWorld(String parmworldName){ 
            WorldCreator dwc = new WorldCreator(parmworldName);
            dwc.environment(Environment.NORMAL);
            return Bukkit.getServer().createWorld(dwc); 
        }
    
    
    My Problem is:

    http://postimg.org/image/7903j6fg1/

    The World is there :(

    but i get the Messages :

    Bukkit.getServer().broadcastMessage("World: "+worldName+ " could not be found :(");
    Bukkit.getServer().broadcastMessage("A World "+ worldName + " will be created");

    Help woould be great :)
     
  2. Offline

    justin_393

    Try changing if(!Bukkit.getServer().getWorlds().add(gameWorld));
    to if(!Bukkit.getServer().getWorlds().contains(gameWorld);
     
    THEPADA likes this.
  3. Offline

    Skionz

  4. Offline

    THEPADA

    i am an idiot :'D
    @Skionz your comment is useless i am able to Programm it's just a simicolon it happens to be wrong placed :)

    @justin_393 thx but i think i have found my mistake...
    if(!Bukkit.getServer().getWorlds().add(gameWorld)); to if(!Bukkit.getServer().getWorlds().add(gameWorld)) // without Simicolon
     
  5. Offline

    justin_393

    oh, I didn't even notice that semicolon xD
     
    THEPADA likes this.
  6. Offline

    Code0

    THEPADA likes this.
  7. Offline

    Skionz

    Maybe, but it's impossible to help someone ride a bike when they don't know how walk correctly.
     
    nverdier likes this.
  8. Offline

    THEPADA

    @justin_393 me n'either :D
    @Code0 thanks :)
    @Skioz I completely agree with you but just because someone can ride a bike, it doesn't mean that he sometimes stumble :)
     
Thread Status:
Not open for further replies.

Share This Page