Solved Multi Arena Management

Discussion in 'Plugin Development' started by Minefar.net - Fundy, Sep 27, 2014.

Thread Status:
Not open for further replies.
  1. Im working on some minigame plugins and i don't figure out how to regist the Players are in a Arena
    can i edit the meta of the Player or something like this?
     
  2. Offline

    xTrollxDudex

    Put the player UUID in collection
     
  3. yes but can i create a collection with a specific name like an Arena name?
     
  4. Offline

    xTrollxDudex

    You could if you wanted to, but you'd want to wrap the list first.
     
  5. Code:java
    1. List<Player> arenaPlayers = new LinkedList<Player>();

    ?

    Code:java
    1. String arenaName="Arena1";
    2. List<Player> arenaName = new LinkedList<Player>();
    3. //Wouldn't work right?


    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 10, 2016
  6. Offline

    blablubbabc

    Code:
    public class Arena {
      private final String arenaName;
      private final List<UUID> players = new ArrayList<UUID>();
     
      public Arena(String arenaName) {
        this.arenaName = arenaName;
      }
     
      public void addPlayer(Player player) {
        this.players.add(player.getUniqueId());
      }
    }
     
    And somewhere else in your code a collection for all your arena's, for example a map:
     
    // maps arena names to the arena:
    private final Map<String, Arena> arenas = new HashMap<String, Arena>();
     
    public void createArena(String arenaName) {
      arenas.put(arenaName, new Arena(ArenaName));
    }
     
    public Arena getArena(String arenaName) {
      return arenas.get(arenaName);
    }
    
     
  7. thx very much!
     
Thread Status:
Not open for further replies.

Share This Page