Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.pixelyeti.goldsiege.GameMechs;
- import com.pixelyeti.goldsiege.Main;
- import com.pixelyeti.goldsiege.Util.FileManager;
- import org.bukkit.configuration.ConfigurationSection;
- import org.bukkit.configuration.file.FileConfiguration;
- import javax.security.auth.login.Configuration;
- import java.util.Random;
- /**
- * Created by Callum on 11/06/2015.
- */
- public class MapManager {
- private static Main plugin;
- public MapManager(Main plugin) {
- this.plugin = plugin;
- }
- public static final Map[] maps = null;
- public static int count = 0;
- public static final void initiateMaps() {
- FileConfiguration config = plugin.getConfigFile(); // <----------- ERRORING FOR NO REASON D:
- ConfigurationSection configSection = config.getConfigurationSection("Maps");
- for (String s : configSection.getKeys(false)) {
- String name = plugin.getConfigFile().getString("Maps." + s + ".Name");
- int numTeams = plugin.getConfigFile().getInt("Maps." + s + ".NumTeams");
- String worldFileName = plugin.getConfigFile().getString("Maps." + s + ".WorldFileName");
- boolean saving = plugin.getConfigFile().getBoolean("Maps." + s + ".Saving");
- maps[count] = new Map(name, numTeams, worldFileName, saving, Map.loadSpawns(name));
- count++;
- }
- }
- public static int selectMap() {
- Map map = null;
- Random rand = new Random();
- int randNum = rand.nextInt(((maps.length - 1) - 0) +1);
- map = maps[randNum];
- return randNum;
- }
- public static Map[] getMaps() {
- return maps;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement