Advertisement
Guest User

Untitled

a guest
Jan 2nd, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 13.39 KB | None | 0 0
  1. package me.wazup.kitbattle;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.Arrays;
  5. import java.util.HashMap;
  6. import java.util.Iterator;
  7. import java.util.List;
  8. import org.bukkit.ChatColor;
  9. import org.bukkit.configuration.ConfigurationSection;
  10. import org.bukkit.configuration.file.FileConfiguration;
  11. import org.bukkit.potion.PotionEffect;
  12. import org.bukkit.potion.PotionEffectType;
  13.  
  14. public class Config
  15. {
  16.   private main plugin;
  17.   boolean UUID;
  18.   int StartingCoins;
  19.   boolean DoPlayersDropItemsOnDeath;
  20.   boolean CanPlayersPickItemsOnGround;
  21.   boolean CanPlayersDropItemsOnGround;
  22.   boolean DoPlayersLoseHunger;
  23.   int EarnedCoinsPerKill;
  24.   ArrayList<String> defaultKits;
  25.   ArrayList<Integer> possibleExp;
  26.   ArrayList<String> allowedCommands;
  27.   String ChallengeKit;
  28.   int ChallengeDuration;
  29.   boolean BroadcastRankUp;
  30.   boolean BungeeMode;
  31.   boolean MapShuffle;
  32.   int ShuffleEveryInMinutes;
  33.   ArrayList<Integer> TimeShownBeforeShuffle;
  34.   int HighestTimeShownBeforeShuffle;
  35.   boolean PurchaseableKitsArePermanent;
  36.   boolean ShowRankInChat;
  37.   String RanksPrefix;
  38.   int StartingAmountOfKitUnlockers;
  39.   ArrayList<String> commandsExecutedForChallengeWinner;
  40.   ArrayList<String> commandsExecutedForChallengeLoser;
  41.   boolean SendDeathMessageToEveryone;
  42.   double SpongeBoostUpwards;
  43.   double SpongeFallProtection;
  44.   boolean FallDamageEnabled;
  45.   boolean SendKillstreaksToEveryone;
  46.   boolean useMySQL;
  47.  
  48.   public Config(main parammain)
  49.   {
  50.     this.plugin = parammain;
  51.   }
  52.  
  53.   HashMap<Integer, List<String>> Killstreaks = new HashMap();
  54.   int UpdateTopSignsEveryInMinutes;
  55.   int StatsLoadDelay;
  56.   String tableprefix;
  57.   String mysqlhost;
  58.   String mysqlport;
  59.   String mysqldatabase;
  60.   String mysqlusername;
  61.   String mysqlpassword;
  62.  
  63.   public void loadConfig()
  64.   {
  65.     FileConfiguration localFileConfiguration = this.plugin.getConfig();
  66.     this.UUID = localFileConfiguration.getBoolean("use-UUID");
  67.     this.StartingCoins = localFileConfiguration.getInt("Starting-Coins");
  68.     this.DoPlayersDropItemsOnDeath = localFileConfiguration.getBoolean("Do-Players-Drop-Items-On-Death");
  69.     this.CanPlayersPickItemsOnGround = localFileConfiguration.getBoolean("Can-Players-Pick-Items-On-Ground");
  70.     this.CanPlayersDropItemsOnGround = localFileConfiguration.getBoolean("Can-Players-Drop-Items-On-Ground");
  71.     this.DoPlayersLoseHunger = localFileConfiguration.getBoolean("Do-Players-Lose-Hunger");
  72.     this.EarnedCoinsPerKill = localFileConfiguration.getInt("Earned-Coins-Per-Kill");
  73.     this.defaultKits = new ArrayList();
  74.     this.defaultKits.addAll(localFileConfiguration.getStringList("Default-Kits"));
  75.     this.possibleExp = new ArrayList();
  76.     for (int i = localFileConfiguration.getInt("Minimum-Exp-Per-Kill"); i < localFileConfiguration.getInt("Maximum-Exp-Per-Kill") + 1; i++) {
  77.       this.possibleExp.add(Integer.valueOf(i));
  78.     }
  79.     this.allowedCommands = new ArrayList();
  80.     for (String str1 : localFileConfiguration.getStringList("Allowed-Commands")) {
  81.       this.allowedCommands.add(str1.toLowerCase());
  82.     }
  83.     this.StatsLoadDelay = localFileConfiguration.getInt("Stats-Load-Delay");
  84.     this.ChallengeDuration = localFileConfiguration.getInt("Challenge-Duratiaon");
  85.     this.ChallengeKit = localFileConfiguration.getString("Challenge-Kit").toLowerCase();
  86.     this.BroadcastRankUp = localFileConfiguration.getBoolean("Broadcast-Rank-Up");
  87.     this.BungeeMode = localFileConfiguration.getBoolean("Bungee-Mode");
  88.     this.MapShuffle = localFileConfiguration.getBoolean("Map-Shuffle");
  89.     this.ShuffleEveryInMinutes = localFileConfiguration.getInt("Shuffle-Every-In-Minutes");
  90.     this.TimeShownBeforeShuffle = new ArrayList();
  91.     for (??? = localFileConfiguration.getIntegerList("Time-Shown-Before-Shuffle").iterator(); ???.hasNext();)
  92.     {
  93.       int j = ((Integer)???.next()).intValue();
  94.       this.TimeShownBeforeShuffle.add(Integer.valueOf(j));
  95.       if (j > this.HighestTimeShownBeforeShuffle) {
  96.         this.HighestTimeShownBeforeShuffle = j;
  97.       }
  98.     }
  99.     this.PurchaseableKitsArePermanent = localFileConfiguration.getBoolean("Purchaseable-Kits-Are-Permanent");
  100.     this.ShowRankInChat = localFileConfiguration.getBoolean("Show-Rank-In-Chat");
  101.     this.RanksPrefix = ChatColor.translateAlternateColorCodes('&', localFileConfiguration.getString("Ranks-Prefix"));
  102.     this.StartingAmountOfKitUnlockers = localFileConfiguration.getInt("Starting-Amount-Of-Kit-Unlockers");
  103.     this.commandsExecutedForChallengeWinner = new ArrayList(localFileConfiguration.getStringList("Commands-Executed-When-Player-Win-Challenge"));
  104.     this.commandsExecutedForChallengeLoser = new ArrayList(localFileConfiguration.getStringList("Commands-Executed-When-Player-Lose-Challenge"));
  105.     this.SendDeathMessageToEveryone = localFileConfiguration.getBoolean("Send-Death-Message-To-Everyone");
  106.     this.SpongeBoostUpwards = localFileConfiguration.getDouble("Sponge-Boost-Upwards");
  107.     this.SpongeFallProtection = (this.SpongeBoostUpwards * this.SpongeBoostUpwards * 3.0D);
  108.     this.FallDamageEnabled = localFileConfiguration.getBoolean("Fall-Damage-Enabled");
  109.     if (localFileConfiguration.getConfigurationSection("Killstreaks") == null)
  110.     {
  111.       localFileConfiguration.set("Killstreaks.3.Commands-Executed", Arrays.asList(new String[] { "kb coins add %player% 20" }));
  112.       localFileConfiguration.set("Killstreaks.5.Commands-Executed", Arrays.asList(new String[] { "kb coins add %player% 30" }));
  113.       localFileConfiguration.set("Killstreaks.10.Commands-Executed", Arrays.asList(new String[] { "kb coins add %player% 50" }));
  114.       localFileConfiguration.set("Killstreaks.20.Commands-Executed", Arrays.asList(new String[] { "kb coins add %player% 100" }));
  115.       localFileConfiguration.set("Killstreaks.30.Commands-Executed", Arrays.asList(new String[] { "kb coins add %player% 200" }));
  116.       this.plugin.saveConfig();
  117.     }
  118.     if (localFileConfiguration.getBoolean("Killstreaks-Enabled")) {
  119.       for (String str2 : localFileConfiguration.getConfigurationSection("Killstreaks").getKeys(false)) {
  120.         this.Killstreaks.put(Integer.valueOf(str2), localFileConfiguration.getStringList("Killstreaks." + str2 + ".Commands-Executed"));
  121.       }
  122.     }
  123.     this.SendKillstreaksToEveryone = localFileConfiguration.getBoolean("Send-Killstreaks-To-Everyone");
  124.     this.UpdateTopSignsEveryInMinutes = localFileConfiguration.getInt("Update-Top-Signs-Every-In-Minutes");
  125.     this.useMySQL = localFileConfiguration.getBoolean("use-mysql");
  126.     this.tableprefix = localFileConfiguration.getString("table-prefix");
  127.     this.mysqlhost = localFileConfiguration.getString("mysql-host");
  128.     this.mysqlport = localFileConfiguration.getString("mysql-port");
  129.     this.mysqldatabase = localFileConfiguration.getString("mysql-database");
  130.     this.mysqlusername = localFileConfiguration.getString("mysql-username");
  131.     this.mysqlpassword = localFileConfiguration.getString("mysql-password");
  132.   }
  133.  
  134.   int HadesCooldown = 30;
  135.   int HadesAmountOfDogs = 3;
  136.   int HadesDogsLastFor = 10;
  137.   int ThorCooldown = 10;
  138.   int ThorLightningDamage = 4;
  139.   int ThorStrikeRadius = 5;
  140.   int StomperStompRadius = 5;
  141.   int StomperMaxFallDamage = 4;
  142.   int StomperMaxDamageDealtWhenStompedWhileShifting = 4;
  143.   int SpidermanCooldown = 15;
  144.   int SpidermanWebsLastFor = 200;
  145.   int PrisonerCooldown = 60;
  146.   int PrisonerPrisonLastsFor = 100;
  147.   int ClimberCooldown = 20;
  148.   int ClimberTimeUntilChickenDisappear = 100;
  149.   int DragonCooldown = 30;
  150.   int DragonAmountOfBursts = 3;
  151.   int DragonDamageDealt = 4;
  152.   int DragonFireLastsFor = 100;
  153.   int DragonFireRange = 10;
  154.   int PhantomCooldown = 45;
  155.   int PhantomFlightLastsFor = 5;
  156.   int TimelordCooldown = 45;
  157.   int TimelordFreezeRadius = 7;
  158.   int TimelordFreezeTime = 200;
  159.   int BurrowerCooldown = 60;
  160.   int BurrowerRoomLastsFor = 160;
  161.   int ZenCooldown = 60;
  162.   int ZenMaxRange = 60;
  163.   int ViperPoisonChance = 5;
  164.   PotionEffect poisonEffect = new PotionEffect(PotionEffectType.POISON, 200, 0);
  165.   int MonkCooldown = 45;
  166.   int HulkCooldown = 45;
  167.   int HulkDamageDealt = 10;
  168.   int HulkDamageRadius = 10;
  169.   int RiderCooldown = 45;
  170.   int RiderHorseLastsFor = 200;
  171.   int SummonerCooldown = 70;
  172.   int SummonerGolemLastsFor = 400;
  173.   int SuicidalCooldown = 20;
  174.  
  175.   public void loadAbilities()
  176.   {
  177.     FileConfiguration localFileConfiguration = this.plugin.fileManager.AbilitiesConfig;
  178.     this.HadesCooldown = localFileConfiguration.getInt("Abilities.Hades.Cooldown");
  179.     this.HadesAmountOfDogs = localFileConfiguration.getInt("Abilities.Hades.Amount-Of-Dogs");
  180.     this.HadesDogsLastFor = (localFileConfiguration.getInt("Abilities.Hades.Dogs-Last-For") * 20);
  181.     this.ThorCooldown = localFileConfiguration.getInt("Abilities.Thor.Cooldown");
  182.     this.ThorLightningDamage = (localFileConfiguration.getInt("Abilities.Thor.Lightning-Damage") * 2);
  183.     this.ThorStrikeRadius = localFileConfiguration.getInt("Abilities.Thor.Strike-Radius");
  184.     this.StomperStompRadius = localFileConfiguration.getInt("Abilities.Stomper.Stomp-Radius");
  185.     this.StomperMaxFallDamage = (localFileConfiguration.getInt("Abilities.Stomper.Max-Fall-Damage") * 2);
  186.     this.StomperMaxDamageDealtWhenStompedWhileShifting = (localFileConfiguration.getInt("Abilities.Stomper.Max-Damage-Dealt-When-Stomped-While-Shifting") * 2);
  187.     this.SpidermanCooldown = localFileConfiguration.getInt("Abilities.Spiderman.Cooldown");
  188.     this.SpidermanWebsLastFor = (localFileConfiguration.getInt("Abilities.Spiderman.Webs-Last-For") * 20);
  189.     this.PrisonerCooldown = localFileConfiguration.getInt("Abilities.Prisoner.Cooldown");
  190.     this.PrisonerPrisonLastsFor = (localFileConfiguration.getInt("Abilities.Prisoner.Prison-Lasts-For") * 20);
  191.     this.ClimberCooldown = localFileConfiguration.getInt("Abilities.Climber.Cooldown");
  192.     this.ClimberTimeUntilChickenDisappear = (localFileConfiguration.getInt("Abilities.Climber.Time-Until-Chicken-Disappear") * 20);
  193.     this.DragonCooldown = localFileConfiguration.getInt("Abilities.Dragon.Cooldown");
  194.     this.DragonAmountOfBursts = localFileConfiguration.getInt("Abilities.Dragon.Amount-Of-Bursts");
  195.     this.DragonDamageDealt = (localFileConfiguration.getInt("Abilities.Dragon.Damage-Dealt") * 2);
  196.     this.DragonFireLastsFor = (localFileConfiguration.getInt("Abilities.Dragon.Fire-Lasts-For") * 20);
  197.     this.DragonFireRange = localFileConfiguration.getInt("Abilities.Dragon.Fire-Range");
  198.     this.PhantomCooldown = localFileConfiguration.getInt("Abilities.Phantom.Cooldown");
  199.     this.PhantomFlightLastsFor = localFileConfiguration.getInt("Abilities.Phantom.Flight-Lasts-For");
  200.     this.TimelordCooldown = localFileConfiguration.getInt("Abilities.Timelord.Cooldown");
  201.     this.TimelordFreezeRadius = localFileConfiguration.getInt("Abilities.Timelord.Freeze-Radius");
  202.     this.TimelordFreezeTime = (localFileConfiguration.getInt("Abilities.Timelord.Freeze-Time") * 20);
  203.     this.BurrowerCooldown = localFileConfiguration.getInt("Abilities.Burrower.Cooldown");
  204.     this.BurrowerRoomLastsFor = (localFileConfiguration.getInt("Abilities.Burrower.Room-Lasts-For") * 20);
  205.     this.ZenCooldown = localFileConfiguration.getInt("Abilities.Zen.Cooldown");
  206.     this.ZenMaxRange = localFileConfiguration.getInt("Abilities.Zen.Max-Range");
  207.     this.ViperPoisonChance = Integer.valueOf(localFileConfiguration.getString("Abilities.Viper.Poison-Chance").replace("%", "")).intValue();
  208.     this.poisonEffect = new PotionEffect(PotionEffectType.POISON, localFileConfiguration.getInt("Abilities.Viper.Poison-Lasts-For") * 20, localFileConfiguration.getInt("Abilities.Viper.Poison-Level") - 1);
  209.     this.MonkCooldown = localFileConfiguration.getInt("Abilities.Monk.Cooldown");
  210.     this.HulkCooldown = localFileConfiguration.getInt("Abilities.Hulk.Cooldown");
  211.     this.HulkDamageDealt = (localFileConfiguration.getInt("Abilities.Hulk.Damage-Dealt") * 2);
  212.     this.HulkDamageRadius = localFileConfiguration.getInt("Abilities.Hulk.Damage-Radius");
  213.     this.RiderCooldown = localFileConfiguration.getInt("Abilities.Rider.Cooldown");
  214.     this.RiderHorseLastsFor = (localFileConfiguration.getInt("Abilities.Rider.Horse-Lasts-For") * 20);
  215.     this.SummonerCooldown = localFileConfiguration.getInt("Abilities.Summoner.Cooldown");
  216.     this.SummonerGolemLastsFor = (localFileConfiguration.getInt("Abilities.Summoner.Golem-Lasts-For") * 20);
  217.     this.SuicidalCooldown = localFileConfiguration.getInt("Abilities.Suicidal.Cooldown");
  218.   }
  219.  
  220.   String SignsPrefix = ChatColor.DARK_AQUA + "[" + ChatColor.AQUA + "KB" + ChatColor.DARK_AQUA + "]";
  221.   String JoinPrefix = ChatColor.AQUA + "Join";
  222.   String LeavePrefix = ChatColor.AQUA + "Leave";
  223.   String SoupPrefix = ChatColor.AQUA + "Soup";
  224.   String StatsPrefix = ChatColor.AQUA + "Stats";
  225.   ChatColor JoinLine3Color = ChatColor.BLACK;
  226.  
  227.   public void loadSignPrefixes()
  228.   {
  229.     FileConfiguration localFileConfiguration = this.plugin.fileManager.SignsConfig;
  230.     this.SignsPrefix = ChatColor.translateAlternateColorCodes('&', localFileConfiguration.getString("Signs-Prefix"));
  231.     this.JoinPrefix = ChatColor.translateAlternateColorCodes('&', localFileConfiguration.getString("Join-Prefix"));
  232.     this.LeavePrefix = ChatColor.translateAlternateColorCodes('&', localFileConfiguration.getString("Leave-Prefix"));
  233.     this.SoupPrefix = ChatColor.translateAlternateColorCodes('&', localFileConfiguration.getString("Soup-Prefix"));
  234.     this.StatsPrefix = ChatColor.translateAlternateColorCodes('&', localFileConfiguration.getString("Stats-Prefix"));
  235.     this.JoinLine3Color = ChatColor.getByChar(localFileConfiguration.getString("Join-Line-3-Color").replace("&", ""));
  236.   }
  237. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement