Help with config and arenas

Discussion in 'Plugin Development' started by Hoyken12, Nov 30, 2015.

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

    Hoyken12

    i have a error on this code
    Code:
     public Arena(int id){
                 id = id;
                 ConfigurationSection s = SettingManager.getManager().get("arenas."+id+".spawn.world.x.y.z");
                   spawn= new Location(Bukkit.getServer().getWorld(s.getString("world")),
                        s.getDouble("x"),
                        s.getDouble("y"),
                        s.getDouble("z"));
    
            }
    at com.hoyken.Main.Manage.Arena.<init>(Arena.java:23) ~[?:?]
    what can i do??
     
  2. Offline

    ChipDev

    First, learn java.
    Second- This is a common error? What is line 23?
     
    Zombie_Striker likes this.
  3. Offline

    mcdorli

    First, id = id only sets the local id to itself, use this.id
     
  4. Offline

    adam753

    I strongly doubt you have a configuration that goes

    Code:
    arenas:
      [id]:
        world:
          x:
            y:
              z:
                x: [double]
                y: [double]
                z: [double]
     
  5. Offline

    Hoyken12

    the prolem can be here?
    Code:
      if(args[0].equalsIgnoreCase("create")){
                                if(args[1]!=null)   {
                                    int id = 0;
                                    try {
                                        id = Integer.parseInt(args[1]);
                                    }catch (Exception ex){
                                        p.sendMessage("Pls Enter valid id");
                                    }
                                    SettingManager.getManager().create(id + "");
                                    ArenaManage.getMange().createArena(id);
    
                                }
     
  6. Offline

    timtower Administrator Administrator Moderator

    @Hoyken12 What is line 23? What is the error?
     
  7. Offline

    Hoyken12

    line 23: spawn= new Location(Bukkit.getServer().getWorld(s.getString("world")),
    but i have other error on execute command: ArenaManage.getMange().createArena(id);
     
  8. Offline

    timtower Administrator Administrator Moderator

    @Hoyken12 You aren't giving the errors.
    And about line 23: s can be null, getString might return null, Bukkit.getServer().getWorld might return null.
     
  9. Offline

    Hoyken12

    Code:
     at com.hoyken.Main.Manage.Arena.<init>(Arena.java:24) ~[?:?]
            at com.hoyken.Main.Manage.ArenaManage.createArena(ArenaManage.java:20) ~[?:?]
            at com.hoyken.Main.Pl.onCommand(Pl.java:46) ~[?:?]
            at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[Spigot-1649.jar:git-Spigot-1649]
     
  10. Offline

    Scimiguy

    That's not the error, that's just some lines that caused it.
    What's the actual error?
     
Thread Status:
Not open for further replies.

Share This Page