Setting multiple spawns, loading them (Skywars)

Discussion in 'Spigot Plugin Development' started by JacksonHogan, May 12, 2016.

  1. Hey, I'm really confused...
    I'm trying to create an arena with multiple spawn points i can set for players to get teleported to.
    Then i'm trying to load the arenas.
    This is what i have so far.
    **(I'm not looking for someone to spoon feed me code, I kinda want to get it explained and do it my self)**

    Code (Text):
    public class Arena {
       
        private String arenaName;
        private Location lobbyLoc;
        private Location endLoc;
       
        private boolean isInGame;
        private boolean isInLobby;
        private boolean isInGmMode;
        private boolean countdownRunning;
       
        private World worldName;
        private int maxPlayers;
       
        private ArrayList<UUID> players = new ArrayList<UUID>();
        public static List<Arena> arenaObjects = new ArrayList<Arena>();

        private Map<Integer, EmptyChest> chests = new HashMap<Integer, EmptyChest>();
        private Map<Integer, Location> spawnPoints = new HashMap<Integer, Location>();
       
        public Arena(String arenaName, World worldName, Location lobbyLoc, Location endLoc, int maxPlayers){
            this.arenaName = arenaName;
            this.setLobbyLoc(lobbyLoc);
            this.endLoc = endLoc;
            this.isInGame = false;
            this.isInLobby = false;
            this.isInGmMode = false;
            this.countdownRunning = false;
            this.maxPlayers = maxPlayers;
            this.worldName = worldName;
            arenaObjects.add(this);
        }

        public Location getLobbyLoc() {
            return lobbyLoc;
        }

        public String getArenaName() {
            return arenaName;
        }

        public void setArenaName(String arenaName) {
            this.arenaName = arenaName;
        }

        public Location getEndLoc() {
            return endLoc;
        }

        public void setEndLoc(Location endLoc) {
            this.endLoc = endLoc;
        }

        public void setLobbyLoc(Location lobbyLoc) {
            this.lobbyLoc = lobbyLoc;
        }
       
        public ArrayList<UUID> getPlayers(){
            return players;
        }
       
        public boolean isInGame(Arena arenaName){
            return isInGame;
        }
       
        public void setInGame(boolean isInGame) {
            this.isInGame = isInGame;
        }
       
        public boolean isInLobby(Arena arenaName){
            return isInLobby;
        }
       
        public void setInLobby(boolean isInLobby) {
            this.isInLobby = isInLobby;
        }
       
        public boolean isInGmMode(Arena arenaName) {
            return isInGmMode;
        }

        public void setInGmMode(boolean isInGmMode) {
            this.isInGmMode = isInGmMode;
        }
       
        public boolean isCountdownRunning() {
            return countdownRunning;
        }

        public void setCountdownRunning(boolean countdownRunning) {
            this.countdownRunning = countdownRunning;
        }

        public void sendMessage(String msg){
            for(UUID u : getPlayers()){
                Player player = Bukkit.getPlayer(u);
                player.sendMessage(msg);
            }
        }

        public int getMaxPlayers() {
            return maxPlayers;
        }

        public void setMaxPlayers(int maxPlayers) {
            this.maxPlayers = maxPlayers;
        }
       
        public Map<Integer, EmptyChest> getChests() {
            return chests;
        }

        public void setChests(Map<Integer, EmptyChest> chests) {
            this.chests = chests;
        }

        public World getWorldName() {
            return worldName;
        }

        public void setWorldName(World worldName) {
            this.worldName = worldName;
        }
       
        public Map<Integer, Location> getSpawns(){
            return this.spawnPoints;
        }
    }

    Code (Text):
    public static void loadArenas(String arenaName){
            Arena a = getArena(arenaName);
            if(a == null){
                return;
            }
           
            for(String key : Skywars.config.getConfig().getConfigurationSection("Arenas").getKeys(false)){
               
               
            }
        }
     
  2. This post seems like it had a similar problem...
    I gave an answer on how to do it, you may want to try to follow that. Also, next time you have an issue you're trying to solve, try googling it, and rewording your question several times. You'd be surprised with how many posts all have the same questions...