/** Main method to assign values to every field. */
  public void Setup() {
    CustomConfig conf = plugin.configManager.getConfig("GunConfig");
    MultiBox = plugin.getConfig().getBoolean("config.gameSettings.MultipleMysteryBoxes");
    doublePointsTimer = plugin.getConfig().getInt("config.gameSettings.doublePointsTimer");
    instaKillTimer = plugin.getConfig().getInt("config.gameSettings.instaKillTimer");
    fireSaleTimer = plugin.getConfig().getInt("config.gameSettings.fireSaleTimer");
    maxZombies = (int) plugin.getConfig().getDouble("config.gameSettings.maxZombies");
    waveSpawnInterval = (int) plugin.getConfig().getDouble("config.gameSettings.waveSpawnInterval");
    pointsOnHit = plugin.getConfig().getInt("config.gameSettings.defaultPointsOnHit");
    pointsOnKill = plugin.getConfig().getInt("config.gameSettings.defaultPointsOnKill");
    maxWave = plugin.getConfig().getInt("config.gameSettings.maxWave");
    reviveTimer = plugin.getConfig().getInt("config.ReviveSettings.ReviveTimer");
    configVersion = plugin.getConfig().getString("vID");
    reloadTime = plugin.getConfig().getInt("config.gameSettings.reloadTime");
    if (plugin.possibleGuns.size() != 0) {
      plugin.possibleGuns.clear();
    }

    Material m = Material.getMaterial(conf.getString("PistolsMaterial", "WOOD_HOE"));
    if (m != null) {
      GunTypeEnum.Pistols.setMaterial(m);
      System.out.println(COMZombies.consoleprefix + "Set pistol gun material to " + m.toString());
    } else
      Bukkit.broadcastMessage(
          COMZombies.prefix
              + "Unable to change the material for pistols! "
              + conf.getString("PistolsMaterial")
              + " Is not a valid material!!!");

    m = Material.getMaterial(conf.getString("ShotgunsMaterial", "STONE_HOE"));
    if (m != null) {
      GunTypeEnum.Shotguns.setMaterial(m);
      System.out.println(COMZombies.consoleprefix + "Set shotgun gun material to " + m.toString());
    } else
      Bukkit.broadcastMessage(
          COMZombies.prefix
              + "Unable to change the material for shotguns! "
              + conf.getString("ShotgunsMaterial")
              + " Is not a valid material!!!");

    m = Material.getMaterial(conf.getString("AssaultRiflesMaterial", "GOLD_HOE"));
    if (m != null) {
      GunTypeEnum.AssaultRifles.setMaterial(m);
      System.out.println(
          COMZombies.consoleprefix + "Set assault rifle material to " + m.toString());
    } else
      Bukkit.broadcastMessage(
          COMZombies.prefix
              + "Unable to change the material for assault rifles! "
              + conf.getString("AssaultRiflesMaterial")
              + " Is not a valid material!!!");

    m = Material.getMaterial(conf.getString("LightMachineGunsMaterial", "IRON_HOE"));
    if (m != null) {
      GunTypeEnum.LightMachineGuns.setMaterial(m);
      System.out.println(
          COMZombies.consoleprefix + "Set light machinegun material to " + m.toString());
    } else
      Bukkit.broadcastMessage(
          COMZombies.prefix
              + "Unable to change the material for light machineguns! "
              + conf.getString("LightMachineGunsMaterial")
              + " Is not a valid material!!!");

    m = Material.getMaterial(conf.getString("SubMachineGunsMaterial", "STICK"));
    if (m != null) {
      GunTypeEnum.SubMachineGuns.setMaterial(m);
      System.out.println(
          COMZombies.consoleprefix + "Set sub machinegun material to " + m.toString());
    } else
      Bukkit.broadcastMessage(
          COMZombies.prefix
              + "Unable to change the material for sub machineguns! "
              + conf.getString("SubMachineGunsMaterial")
              + " Is not a valid material!!!");

    m = Material.getMaterial(conf.getString("SniperRiflesMaterial", "BLAZE_ROD"));
    if (m != null) {
      GunTypeEnum.SniperRifles.setMaterial(m);
      System.out.println(COMZombies.consoleprefix + "Set sniper rifle material to " + m.toString());
    } else
      Bukkit.broadcastMessage(
          COMZombies.prefix
              + "Unable to change the material for sniper rifles! "
              + conf.getString("SniperRiflesMaterial")
              + " Is not a valid material!!!");

    m = Material.getMaterial(conf.getString("OthersMaterial", "DIAMOND_HOE"));
    if (m != null) {
      GunTypeEnum.Others.setMaterial(m);
      System.out.println(COMZombies.consoleprefix + "Set other's gun material to " + m.toString());
    } else
      Bukkit.broadcastMessage(
          COMZombies.prefix
              + "Unable to change the material for others! "
              + conf.getString("OthersMaterial")
              + " Is not a valid material!!!");

    for (String group : conf.getConfigurationSection("Guns").getKeys(false)) {
      for (String gun : conf.getConfigurationSection("Guns." + group).getKeys(false)) {
        String ammo = conf.getString("Guns." + group + "." + gun + ".Ammo");
        String packAmmo = conf.getString("Guns." + group + "." + gun + ".PackAPunch.Ammo");
        int clipAmmo = Integer.parseInt(ammo.substring(0, ammo.indexOf("/")));
        int totalAmmo = Integer.parseInt(ammo.substring(ammo.indexOf("/") + 1));
        int damage = conf.getInt("Guns." + group + "." + gun + ".Damage");
        int fireDelay = conf.getInt("Guns." + group + "." + gun + ".FireDelay", 5);
        double speed = conf.getDouble("Guns." + group + "." + gun + ".ProjectileSpeed", 3);
        int pClip = Integer.parseInt(packAmmo.substring(0, packAmmo.indexOf("/")));
        int pTotal = Integer.parseInt(packAmmo.substring(packAmmo.indexOf("/") + 1));
        int packDamage = conf.getInt("Guns." + group + "." + gun + ".PackAPunch.Damage");
        String packGunName = conf.getString("Guns." + group + "." + gun + ".PackAPunch.Name");
        plugin.possibleGuns.add(
            new GunType(
                GunTypeEnum.getGun(group),
                gun,
                damage,
                fireDelay,
                speed,
                clipAmmo,
                totalAmmo,
                pClip,
                pTotal,
                packDamage,
                packGunName));
      }
    }
    maxAmmo = plugin.getConfig().getBoolean("config.Perks.MaxAmmo");
    instaKill = plugin.getConfig().getBoolean("config.Perks.InstaKill");
    carpenter = plugin.getConfig().getBoolean("config.Perks.Carpenter");
    nuke = plugin.getConfig().getBoolean("config.Perks.Nuke");
    if (!MultiBox) fireSale = plugin.getConfig().getBoolean("config.Perks.FireSale");
    else fireSale = false;
    doublePoints = plugin.getConfig().getBoolean("config.Perks.DoublePoints");
    arenaStartTime = plugin.getConfig().getInt("config.gameSettings.arenaStartTime");
    maxPerks = plugin.getConfig().getInt("config.Perks.maxPerks");
    KillMoney = plugin.getConfig().getInt("config.Economy.MoneyPerKill");
    // PistolMaterial = plugin.getConfig().getInt("config.Guns.PistolMaterial");

    try {
      CustomConfig killsconf = plugin.configManager.getConfig("kills");
      for (String a : killsconf.getConfigurationSection("Kills").getKeys(true)) {
        PlayerStats stat = new PlayerStats(a, killsconf.getInt("Kills." + a));
        plugin.leaderboards.addPlayerStats(stat);
      }
    } catch (NullPointerException e) {

    }
  }