package com.gmail.jameshealey1994.simpletowns;

import java.util.HashSet;
import org.bukkit.Chunk;
import org.bukkit.entity.Player;

/**
 * Class representing a Town.
 *
 * @author JamesHealey94 <jameshealey1994.gmail.com>
 */
public class Town {

    /**
     * The name of the Town.
     */
    private String name;

    /**
     * The leaders of the Town.
     * A Player should only be a citizen or a leader, not both.
     */
    private HashSet<Player> leaders = new HashSet<>();

    /**
     * The citizens of the Town.
     * A Player should only be a citizen or a leader, not both.
     */
    private HashSet<Player> citizens = new HashSet<>();

    /**
     * The chunks belonging to the Town.
     * A chunk should only belong to 1 Town at a time.
     */
    private HashSet<Chunk> chunks;

    /**
     * Constructor - Initialises name, adds creator to leaders, and chunk to
     * chunks.
     *
     * @param name          the name of the Town
     * @param creator       the creator of the Town, normally the player that
     *                      sent the command
     * @param chunk         the first chunk in the town, normally the chunk that
     *                      the creator is standing in when creating the town
     */
    public Town(String name, Player creator, Chunk chunk) {
        this.name = name;
        this.leaders.add(creator);
        this.chunks.add(chunk);
    }

    /**
     * Returns the name of the Town.
     *
     * @return      the name of the Town
     */
    public String getName() {
        return name;
    }

    /**
     * Sets the name of the Town.
     *
     * @param name      the new the name of the Town
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * Returns the leaders of the Town.
     *
     * @return      the leaders of the Town
     */
    public HashSet<Player> getLeaders() {
        return leaders;
    }

    /**
     * Sets the leaders of the Town.
     *
     * @param leaders       the new leaders of the Town
     */
    public void setLeaders(HashSet<Player> leaders) {
        this.leaders = leaders;
    }

    /**
     * Returns the citizens of the Town.
     * Citizens are members of the Town but not leaders.
     *
     * @return      the citizens of the Town
     */
    public HashSet<Player> getCitizens() {
        return citizens;
    }

    /**
     * Sets the new citizens of the Town.
     *
     * @param citizens      the new citizens of the Town
     */
    public void setCitizens(HashSet<Player> citizens) {
        this.citizens = citizens;
    }

    /**
     * Returns the set of Chunks belonging to the Town.
     *
     * @return      the set of Chunks belonging to the Town
     */
    public HashSet<Chunk> getChunks() {
        return chunks;
    }

    /**
     * Sets the new set of Chunks belonging to the Town.
     *
     * @param chunks        the new set of Chunks belonging to the Town
     */
    public void setChunks(HashSet<Chunk> chunks) {
        this.chunks = chunks;
    }

}
@@ -99,42 +99,8 @@
 nk;%0D
-%0Aimport org.bukkit.entity.Player;%0D
 %0A%0D%0A/
@@ -316,16 +316,33 @@
   * The 
+usernames of the 
 leaders 
@@ -441,38 +441,38 @@
 private HashSet%3C
-Player
+String
 %3E leaders = new 
@@ -507,16 +507,33 @@
   * The 
+usernames of the 
 citizens
@@ -633,38 +633,38 @@
 private HashSet%3C
-Player
+String
 %3E citizens = new
@@ -1319,22 +1319,22 @@
 g name, 
-Player
+String
  creator
@@ -1839,24 +1839,41 @@
 Returns the 
+usernames of the 
 leaders of t
@@ -1910,24 +1910,41 @@
 rn      the 
+usernames of the 
 leaders of t
@@ -1976,30 +1976,30 @@
 lic HashSet%3C
-Player
+String
 %3E getLeaders
@@ -2059,24 +2059,41 @@
  * Sets the 
+usernames of the 
 leaders of t
@@ -2146,16 +2146,33 @@
 the new 
+usernames of the 
 leaders 
@@ -2228,22 +2228,22 @@
 HashSet%3C
-Player
+String
 %3E leader
@@ -2314,24 +2314,41 @@
 Returns the 
+usernames of the 
 citizens of 
@@ -2444,24 +2444,41 @@
 rn      the 
+usernames of the 
 citizens of 
@@ -2515,22 +2515,22 @@
 HashSet%3C
-Player
+String
 %3E getCit
@@ -2596,32 +2596,49 @@
  * Sets the new 
+usernames of the 
 citizens of the 
@@ -2688,16 +2688,33 @@
 the new 
+usernames of the 
 citizens
@@ -2772,22 +2772,22 @@
 HashSet%3C
-Player
+String
 %3E citize

Store usernames, instead of the actual player.