Random arena selection

Discussion in 'Plugin Development' started by TheDeathMachine, May 23, 2013.

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

    TheDeathMachine

    So im making a minigame plugin.
    In the config multiple arena's can be set.
    What i want is to get all the arena's from the config and load them in a hashmap to, for example, teleport players players to an arena, remove the arena from the hashmap.
    Next round teleport them again.

    Or if someone knows how to get all the arena's from the config and teleport all players to a random one, that would be appreciated too.

    Every help would be appreciated actually :)

    The config will look like this:

    Code:
    arenaname:
      beginspawn:
        x:
        y:
        z:
        yaw:
        pitch:
      spawn 1
        x:
        y:
        z:
        yaw:
        pitch:
      spawn 2
        x:
        y:
        z:
        yaw:
        pitch:
    arenaname2:
      beginspawn:
        x:
        y:
        z:
        yaw:
        pitch:
      spawn 1
        x:
        y:
        z:
        yaw:
        pitch:
      spawn 2
        x:
        y:
        z:
        yaw:
        pitch:
     
  2. Offline

    mcat95

    Ok, now this one :p
    Maybe:
    Code:
    List<String> arenas = plugin.getConfig().getStringList("arenas");
    Random rand = new Random();
    int id = rand.nextInt(arenas.size());
    String arena = arenas.get(id);
    
    P.D. You may change your config and do:
    arenas:
    arena1:
    ...
    arena2:
    ...
     
  3. Offline

    TheDeathMachine

    mcat95 the config like this:

    Code:
    Arenas:
      1:
        Spawns:
          x: etc
      2:
    
    or like this:

    Code:
    Arenas:
      -Monkey
        spawns:
          x:
          etc
      -Potato
    ?
     
  4. Offline

    mcat95

    Second
     
  5. Offline

    TheDeathMachine

Thread Status:
Not open for further replies.

Share This Page