|
@@ -1,16 +1,14 @@
|
|
package com.gmail.nossr50.config.treasure;
|
|
package com.gmail.nossr50.config.treasure;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
-import java.util.HashMap;
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
-import java.util.Map;
|
|
|
|
-import java.util.Map.Entry;
|
|
|
|
|
|
|
|
|
|
+import org.bukkit.DyeColor;
|
|
import org.bukkit.Material;
|
|
import org.bukkit.Material;
|
|
import org.bukkit.configuration.ConfigurationSection;
|
|
import org.bukkit.configuration.ConfigurationSection;
|
|
import org.bukkit.entity.EntityType;
|
|
import org.bukkit.entity.EntityType;
|
|
import org.bukkit.inventory.ItemStack;
|
|
import org.bukkit.inventory.ItemStack;
|
|
-import org.bukkit.material.MaterialData;
|
|
|
|
|
|
+import org.bukkit.material.Dye;
|
|
import org.bukkit.potion.Potion;
|
|
import org.bukkit.potion.Potion;
|
|
import org.bukkit.potion.PotionType;
|
|
import org.bukkit.potion.PotionType;
|
|
|
|
|
|
@@ -19,7 +17,6 @@ import com.gmail.nossr50.datatypes.treasure.ExcavationTreasure;
|
|
import com.gmail.nossr50.datatypes.treasure.FishingTreasure;
|
|
import com.gmail.nossr50.datatypes.treasure.FishingTreasure;
|
|
import com.gmail.nossr50.datatypes.treasure.HylianTreasure;
|
|
import com.gmail.nossr50.datatypes.treasure.HylianTreasure;
|
|
import com.gmail.nossr50.datatypes.treasure.ShakeTreasure;
|
|
import com.gmail.nossr50.datatypes.treasure.ShakeTreasure;
|
|
-import com.gmail.nossr50.datatypes.treasure.Treasure;
|
|
|
|
|
|
|
|
public class TreasureConfig extends ConfigLoader {
|
|
public class TreasureConfig extends ConfigLoader {
|
|
private static TreasureConfig instance;
|
|
private static TreasureConfig instance;
|
|
@@ -45,6 +42,7 @@ public class TreasureConfig extends ConfigLoader {
|
|
public List<ShakeTreasure> shakeFromCreeper = new ArrayList<ShakeTreasure>();
|
|
public List<ShakeTreasure> shakeFromCreeper = new ArrayList<ShakeTreasure>();
|
|
public List<ShakeTreasure> shakeFromEnderman = new ArrayList<ShakeTreasure>();
|
|
public List<ShakeTreasure> shakeFromEnderman = new ArrayList<ShakeTreasure>();
|
|
public List<ShakeTreasure> shakeFromGhast = new ArrayList<ShakeTreasure>();
|
|
public List<ShakeTreasure> shakeFromGhast = new ArrayList<ShakeTreasure>();
|
|
|
|
+ public List<ShakeTreasure> shakeFromHorse = new ArrayList<ShakeTreasure>();
|
|
public List<ShakeTreasure> shakeFromIronGolem = new ArrayList<ShakeTreasure>();
|
|
public List<ShakeTreasure> shakeFromIronGolem = new ArrayList<ShakeTreasure>();
|
|
public List<ShakeTreasure> shakeFromMagmaCube = new ArrayList<ShakeTreasure>();
|
|
public List<ShakeTreasure> shakeFromMagmaCube = new ArrayList<ShakeTreasure>();
|
|
public List<ShakeTreasure> shakeFromMushroomCow = new ArrayList<ShakeTreasure>();
|
|
public List<ShakeTreasure> shakeFromMushroomCow = new ArrayList<ShakeTreasure>();
|
|
@@ -75,47 +73,49 @@ public class TreasureConfig extends ConfigLoader {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
protected void loadKeys() {
|
|
protected void loadKeys() {
|
|
- Map<String, Treasure> treasures = new HashMap<String, Treasure>();
|
|
|
|
- ConfigurationSection treasureSection = config.getConfigurationSection("Treasures");
|
|
|
|
|
|
+ loadTreaures("Fishing");
|
|
|
|
+ loadTreaures("Excavation");
|
|
|
|
+ loadTreaures("Hylian");
|
|
|
|
+
|
|
|
|
+ for (EntityType entity : EntityType.values()) {
|
|
|
|
+ if (entity.isAlive()) {
|
|
|
|
+ loadTreaures("Shake." + entity.toString());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void loadTreaures(String type) {
|
|
|
|
+ boolean isFishing = type.equals("Fishing");
|
|
|
|
+ boolean isShake = type.contains("Shake");
|
|
|
|
+ boolean isExcavation = type.equals("Excavation");
|
|
|
|
+ boolean isHylian = type.equals("Hylian");
|
|
|
|
+
|
|
|
|
+ ConfigurationSection treasureSection = config.getConfigurationSection(type);
|
|
|
|
|
|
if (treasureSection == null) {
|
|
if (treasureSection == null) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
for (String treasureName : treasureSection.getKeys(false)) {
|
|
for (String treasureName : treasureSection.getKeys(false)) {
|
|
-
|
|
|
|
// Validate all the things!
|
|
// Validate all the things!
|
|
List<String> reason = new ArrayList<String>();
|
|
List<String> reason = new ArrayList<String>();
|
|
|
|
|
|
/*
|
|
/*
|
|
- * ID, Amount, and Data
|
|
|
|
|
|
+ * Material, Amount, and Data
|
|
*/
|
|
*/
|
|
|
|
+ Material material = treasureName.contains("POTION") ? Material.POTION : Material.matchMaterial(treasureName);
|
|
|
|
+ int amount = config.getInt(type + "." + treasureName + ".Amount");
|
|
|
|
+ int data = config.getInt(type + "." + treasureName + ".Data");
|
|
|
|
|
|
- if (!config.contains("Treasures." + treasureName + ".ID")) {
|
|
|
|
- reason.add("Missing ID");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (!config.contains("Treasures." + treasureName + ".Amount")) {
|
|
|
|
- reason.add("Missing Amount");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (!config.contains("Treasures." + treasureName + ".Data")) {
|
|
|
|
- reason.add("Missing Data");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- int id = config.getInt("Treasures." + treasureName + ".ID");
|
|
|
|
- int amount = config.getInt("Treasures." + treasureName + ".Amount");
|
|
|
|
- int data = config.getInt("Treasures." + treasureName + ".Data");
|
|
|
|
-
|
|
|
|
- if (Material.getMaterial(id) == null) {
|
|
|
|
- reason.add("Invalid id: " + id);
|
|
|
|
|
|
+ if (material == null) {
|
|
|
|
+ reason.add("Invalid material: " + treasureName);
|
|
}
|
|
}
|
|
|
|
|
|
if (amount < 1) {
|
|
if (amount < 1) {
|
|
reason.add("Invalid amount: " + amount);
|
|
reason.add("Invalid amount: " + amount);
|
|
}
|
|
}
|
|
|
|
|
|
- if (id < 256 && (data > 127 || data < -128)) {
|
|
|
|
|
|
+ if (material != null && material.isBlock() && (data > 127 || data < -128)) {
|
|
reason.add("Invalid data: " + data);
|
|
reason.add("Invalid data: " + data);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -123,27 +123,15 @@ public class TreasureConfig extends ConfigLoader {
|
|
* XP, Drop Chance, and Drop Level
|
|
* XP, Drop Chance, and Drop Level
|
|
*/
|
|
*/
|
|
|
|
|
|
- if (!config.contains("Treasures." + treasureName + ".XP")) {
|
|
|
|
- reason.add("Missing XP");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (!config.contains("Treasures." + treasureName + ".Drop_Chance")) {
|
|
|
|
- reason.add("Missing Drop_Chance");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (!config.contains("Treasures." + treasureName + ".Drop_Level")) {
|
|
|
|
- reason.add("Missing Drop_Level");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- int xp = config.getInt("Treasures." + treasureName + ".XP");
|
|
|
|
- Double dropChance = config.getDouble("Treasures." + treasureName + ".Drop_Chance");
|
|
|
|
- int dropLevel = config.getInt("Treasures." + treasureName + ".Drop_Level");
|
|
|
|
|
|
+ int xp = config.getInt(type + "." + treasureName + ".XP");
|
|
|
|
+ double dropChance = config.getDouble(type + "." + treasureName + ".Drop_Chance");
|
|
|
|
+ int dropLevel = config.getInt(type + "." + treasureName + ".Drop_Level");
|
|
|
|
|
|
if (xp < 0) {
|
|
if (xp < 0) {
|
|
reason.add("Invalid xp: " + xp);
|
|
reason.add("Invalid xp: " + xp);
|
|
}
|
|
}
|
|
|
|
|
|
- if (dropChance < 0) {
|
|
|
|
|
|
+ if (dropChance < 0.0D) {
|
|
reason.add("Invalid Drop_Chance: " + dropChance);
|
|
reason.add("Invalid Drop_Chance: " + dropChance);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -152,298 +140,178 @@ public class TreasureConfig extends ConfigLoader {
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
/*
|
|
- * Potions
|
|
|
|
|
|
+ * Specific Types
|
|
*/
|
|
*/
|
|
|
|
+ int maxLevel = 0;
|
|
|
|
|
|
- ItemStack item = null;
|
|
|
|
|
|
+ if (isFishing) {
|
|
|
|
+ maxLevel = config.getInt(type + "." + treasureName + ".Max_Level");
|
|
|
|
|
|
- if (config.contains("Treasures." + treasureName + ".Potion_Type")) {
|
|
|
|
- String potionType = config.getString("Treasures." + treasureName + ".Potion_Type");
|
|
|
|
- try {
|
|
|
|
- item = new Potion(PotionType.valueOf(potionType.toUpperCase())).toItemStack(amount);
|
|
|
|
|
|
+ if (maxLevel < -1) {
|
|
|
|
+ reason.add("Invalid Max_Level: " + maxLevel);
|
|
}
|
|
}
|
|
- catch (IllegalArgumentException ex) {
|
|
|
|
- reason.add("Invalid Potion_Type: " + potionType);
|
|
|
|
|
|
+
|
|
|
|
+ if (maxLevel != -1 && maxLevel < dropLevel) {
|
|
|
|
+ reason.add("Max_Level must be -1 or greater than Drop_Level!");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- else {
|
|
|
|
- item = (new MaterialData(id, (byte) data)).toItemStack(amount);
|
|
|
|
- }
|
|
|
|
|
|
|
|
/*
|
|
/*
|
|
- * Drops From & Max Level
|
|
|
|
|
|
+ * Itemstack
|
|
*/
|
|
*/
|
|
|
|
+ ItemStack item = null;
|
|
|
|
|
|
- if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Fishing", false)) {
|
|
|
|
- if (config.getConfigurationSection("Treasures." + treasureName + ".Drops_From").getKeys(false).size() != 1) {
|
|
|
|
- reason.add("This can only be a fishing drop.");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (!config.contains("Treasures." + treasureName + ".Max_Level")) {
|
|
|
|
- reason.add("Missing Max_Level");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- int maxLevel = config.getInt("Treasures." + treasureName + ".Max_Level");
|
|
|
|
-
|
|
|
|
- if (noErrorsInConfig(reason)) {
|
|
|
|
- FishingTreasure fTreasure = new FishingTreasure(item, xp, dropChance, dropLevel, maxLevel);
|
|
|
|
- treasures.put(treasureName, fTreasure);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- else if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Shake", false)) {
|
|
|
|
- if (config.getConfigurationSection("Treasures." + treasureName + ".Drops_From").getKeys(false).size() != 1) {
|
|
|
|
- reason.add("This can only be a shake drop.");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (!config.contains("Treasures." + treasureName + ".Mob")) {
|
|
|
|
- reason.add("Missing Mob");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- String mobType = config.getString("Treasures." + treasureName + ".Mob");
|
|
|
|
- EntityType mob = null;
|
|
|
|
|
|
+ if (treasureName.contains("POTION")) {
|
|
|
|
+ String potionType = treasureName.substring(7);
|
|
|
|
|
|
try {
|
|
try {
|
|
- mob = EntityType.valueOf(mobType.toUpperCase().trim());
|
|
|
|
- }
|
|
|
|
- catch (IllegalArgumentException ex){
|
|
|
|
- reason.add("Invalid Mob: " + mobType);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (noErrorsInConfig(reason)) {
|
|
|
|
- ShakeTreasure sTreasure = new ShakeTreasure(item, xp, dropChance, dropLevel, mob);
|
|
|
|
- treasures.put(treasureName, sTreasure);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- else {
|
|
|
|
- ExcavationTreasure eTreasure = new ExcavationTreasure(item, xp, dropChance, dropLevel);
|
|
|
|
- HylianTreasure hTreasure = new HylianTreasure(item, xp, dropChance, dropLevel);
|
|
|
|
-
|
|
|
|
- if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Dirt", false)) {
|
|
|
|
- eTreasure.setDropsFromDirt();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Grass", false)) {
|
|
|
|
- eTreasure.setDropsFromGrass();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Sand", false)) {
|
|
|
|
- eTreasure.setDropsFromSand();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Gravel", false)) {
|
|
|
|
- eTreasure.setDropsFromGravel();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Clay", false)) {
|
|
|
|
- eTreasure.setDropsFromClay();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Mycelium", false)) {
|
|
|
|
- eTreasure.setDropsFromMycel();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Soul_Sand", false)) {
|
|
|
|
- eTreasure.setDropsFromSoulSand();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Snow", false)) {
|
|
|
|
- eTreasure.setDropsFromSnow();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Bushes", false)) {
|
|
|
|
- hTreasure.setDropsFromBushes();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Flowers", false)) {
|
|
|
|
- hTreasure.setDropsFromFlowers();
|
|
|
|
|
|
+ item = new Potion(PotionType.valueOf(potionType.toUpperCase().trim())).toItemStack(amount);
|
|
}
|
|
}
|
|
-
|
|
|
|
- if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Pots", false)) {
|
|
|
|
- hTreasure.setDropsFromPots();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Fishing", false)) {
|
|
|
|
- reason.add("This cannot also be a fishing drop.");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (config.getBoolean("Treasures." + treasureName + ".Drops_From.Shake", false)) {
|
|
|
|
- reason.add("This cannot also be a shake drop.");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (noErrorsInConfig(reason) && hTreasure.getDropsFrom() == (byte) 0x0) {
|
|
|
|
- treasures.put(treasureName, eTreasure);
|
|
|
|
- }
|
|
|
|
- else if (noErrorsInConfig(reason) && eTreasure.getDropsFrom() == (byte) 0x0) {
|
|
|
|
- treasures.put(treasureName, hTreasure);
|
|
|
|
|
|
+ catch (IllegalArgumentException ex) {
|
|
|
|
+ reason.add("Invalid Potion_Type: " + potionType);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }
|
|
|
|
-
|
|
|
|
- List<String> excavationTreasures = config.getStringList("Excavation.Treasure");
|
|
|
|
- List<String> fishingTreasures = config.getStringList("Fishing.Treasure");
|
|
|
|
- List<String> hylianTreasures = config.getStringList("Hylian_Luck.Treasure");
|
|
|
|
- List<String> shakeTreasures = config.getStringList("Shake.Treasure");
|
|
|
|
|
|
+ else if (config.contains(type + "." + treasureName + ".Dye_Color")) {
|
|
|
|
+ String color = config.getString("Fishing." + treasureName + ".Dye_Color");
|
|
|
|
|
|
- for (Entry<String, Treasure> nextEntry : treasures.entrySet()) {
|
|
|
|
- String treasureKey = nextEntry.getKey();
|
|
|
|
- Treasure treasure = nextEntry.getValue();
|
|
|
|
-
|
|
|
|
- if (treasure instanceof FishingTreasure) {
|
|
|
|
- if (fishingTreasures == null || !fishingTreasures.contains(treasureKey)) {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
|
|
+ try {
|
|
|
|
+ Dye dye = new Dye();
|
|
|
|
+ dye.setColor(DyeColor.valueOf(color.toUpperCase().trim()));
|
|
|
|
|
|
- fishingRewards.add((FishingTreasure) treasure);
|
|
|
|
- }
|
|
|
|
- else if (treasure instanceof ShakeTreasure) {
|
|
|
|
- if (shakeTreasures == null || !shakeTreasures.contains(treasureKey)) {
|
|
|
|
- continue;
|
|
|
|
|
|
+ item = dye.toItemStack(amount);
|
|
}
|
|
}
|
|
-
|
|
|
|
- ShakeTreasure e = (ShakeTreasure) treasure;
|
|
|
|
- switch (e.getMob()) {
|
|
|
|
- case BLAZE:
|
|
|
|
- shakeFromBlaze.add(e);
|
|
|
|
- break;
|
|
|
|
-
|
|
|
|
- case CAVE_SPIDER:
|
|
|
|
- shakeFromCaveSpider.add(e);
|
|
|
|
- break;
|
|
|
|
-
|
|
|
|
- case CHICKEN:
|
|
|
|
- shakeFromChicken.add(e);
|
|
|
|
- break;
|
|
|
|
-
|
|
|
|
- case COW:
|
|
|
|
- shakeFromCow.add(e);
|
|
|
|
- break;
|
|
|
|
-
|
|
|
|
- case CREEPER:
|
|
|
|
- shakeFromCreeper.add(e);
|
|
|
|
- break;
|
|
|
|
-
|
|
|
|
- case ENDERMAN:
|
|
|
|
- shakeFromEnderman.add(e);
|
|
|
|
- break;
|
|
|
|
-
|
|
|
|
- case GHAST:
|
|
|
|
- shakeFromGhast.add(e);
|
|
|
|
- break;
|
|
|
|
-
|
|
|
|
- case IRON_GOLEM:
|
|
|
|
- shakeFromIronGolem.add(e);
|
|
|
|
- break;
|
|
|
|
-
|
|
|
|
- case MAGMA_CUBE:
|
|
|
|
- shakeFromMagmaCube.add(e);
|
|
|
|
- break;
|
|
|
|
-
|
|
|
|
- case MUSHROOM_COW:
|
|
|
|
- shakeFromMushroomCow.add(e);
|
|
|
|
- break;
|
|
|
|
-
|
|
|
|
- case PIG:
|
|
|
|
- shakeFromPig.add(e);
|
|
|
|
- break;
|
|
|
|
-
|
|
|
|
- case PIG_ZOMBIE:
|
|
|
|
- shakeFromPigZombie.add(e);
|
|
|
|
- break;
|
|
|
|
-
|
|
|
|
- case SHEEP:
|
|
|
|
- shakeFromSheep.add(e);
|
|
|
|
- break;
|
|
|
|
-
|
|
|
|
- case SKELETON:
|
|
|
|
- shakeFromSkeleton.add(e);
|
|
|
|
- break;
|
|
|
|
-
|
|
|
|
- case SLIME:
|
|
|
|
- shakeFromSlime.add(e);
|
|
|
|
- break;
|
|
|
|
-
|
|
|
|
- case SPIDER:
|
|
|
|
- shakeFromSpider.add(e);
|
|
|
|
- break;
|
|
|
|
-
|
|
|
|
- case SNOWMAN:
|
|
|
|
- shakeFromSnowman.add(e);
|
|
|
|
- break;
|
|
|
|
-
|
|
|
|
- case SQUID:
|
|
|
|
- shakeFromSquid.add(e);
|
|
|
|
- break;
|
|
|
|
-
|
|
|
|
- case WITCH:
|
|
|
|
- shakeFromWitch.add(e);
|
|
|
|
- break;
|
|
|
|
-
|
|
|
|
- case ZOMBIE:
|
|
|
|
- shakeFromZombie.add(e);
|
|
|
|
- break;
|
|
|
|
-
|
|
|
|
- default:
|
|
|
|
- break;
|
|
|
|
|
|
+ catch (IllegalArgumentException ex) {
|
|
|
|
+ reason.add("Invalid Dye_Color: " + color);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- else if (treasure instanceof HylianTreasure) {
|
|
|
|
- if (hylianTreasures == null || !hylianTreasures.contains(treasureKey)) {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- HylianTreasure hTreasure = (HylianTreasure) treasure;
|
|
|
|
-
|
|
|
|
- if (hTreasure.getDropsFromBushes()) {
|
|
|
|
- hylianFromBushes.add(hTreasure);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (hTreasure.getDropsFromFlowers()) {
|
|
|
|
- hylianFromFlowers.add(hTreasure);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (hTreasure.getDropsFromPots()) {
|
|
|
|
- hylianFromPots.add(hTreasure);
|
|
|
|
- }
|
|
|
|
|
|
+ else {
|
|
|
|
+ item = new ItemStack(material, amount, (short) data);
|
|
}
|
|
}
|
|
- else if (treasure instanceof ExcavationTreasure) {
|
|
|
|
- if (excavationTreasures == null || !excavationTreasures.contains(treasureKey)) {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- ExcavationTreasure eTreasure = (ExcavationTreasure) treasure;
|
|
|
|
-
|
|
|
|
- if (eTreasure.getDropsFromDirt()) {
|
|
|
|
- excavationFromDirt.add(eTreasure);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (eTreasure.getDropsFromGrass()) {
|
|
|
|
- excavationFromGrass.add(eTreasure);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (eTreasure.getDropsFromSand()) {
|
|
|
|
- excavationFromSand.add(eTreasure);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (eTreasure.getDropsFromGravel()) {
|
|
|
|
- excavationFromGravel.add(eTreasure);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (eTreasure.getDropsFromClay()) {
|
|
|
|
- excavationFromClay.add(eTreasure);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (eTreasure.getDropsFromMycel()) {
|
|
|
|
- excavationFromMycel.add(eTreasure);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (eTreasure.getDropsFromSoulSand()) {
|
|
|
|
- excavationFromSoulSand.add(eTreasure);
|
|
|
|
- }
|
|
|
|
|
|
|
|
- if (eTreasure.getDropsFromSnow()) {
|
|
|
|
- excavationFromSnow.add(eTreasure);
|
|
|
|
|
|
+ if (noErrorsInConfig(reason)) {
|
|
|
|
+ if (isFishing) {
|
|
|
|
+ fishingRewards.add(new FishingTreasure(item, xp, dropChance, dropLevel, maxLevel));
|
|
|
|
+ }
|
|
|
|
+ else if (isShake) {
|
|
|
|
+ ShakeTreasure shakeTreasure = new ShakeTreasure(item, xp, dropChance, dropLevel);
|
|
|
|
+
|
|
|
|
+ if (type.equals("Shake.BLAZE")) {
|
|
|
|
+ shakeFromBlaze.add(shakeTreasure);
|
|
|
|
+ }
|
|
|
|
+ else if (type.equals("Shake.CAVE_SPIDER")) {
|
|
|
|
+ shakeFromCaveSpider.add(shakeTreasure);
|
|
|
|
+ }
|
|
|
|
+ else if (type.equals("Shake.CHICKEN")) {
|
|
|
|
+ shakeFromChicken.add(shakeTreasure);
|
|
|
|
+ }
|
|
|
|
+ else if (type.equals("Shake.COW")) {
|
|
|
|
+ shakeFromCow.add(shakeTreasure);
|
|
|
|
+ }
|
|
|
|
+ else if (type.equals("Shake.CREEPER")) {
|
|
|
|
+ shakeFromCreeper.add(shakeTreasure);
|
|
|
|
+ }
|
|
|
|
+ else if (type.equals("Shake.ENDERMAN")) {
|
|
|
|
+ shakeFromEnderman.add(shakeTreasure);
|
|
|
|
+ }
|
|
|
|
+ else if (type.equals("Shake.GHAST")) {
|
|
|
|
+ shakeFromGhast.add(shakeTreasure);
|
|
|
|
+ }
|
|
|
|
+ else if (type.equals("Shake.HORSE")) {
|
|
|
|
+ shakeFromHorse.add(shakeTreasure);
|
|
|
|
+ }
|
|
|
|
+ else if (type.equals("Shake.IRON_GOLEM")) {
|
|
|
|
+ shakeFromIronGolem.add(shakeTreasure);
|
|
|
|
+ }
|
|
|
|
+ else if (type.equals("Shake.MAGMA_CUBE")) {
|
|
|
|
+ shakeFromMagmaCube.add(shakeTreasure);
|
|
|
|
+ }
|
|
|
|
+ else if (type.equals("Shake.MUSHROOM_COW")) {
|
|
|
|
+ shakeFromMushroomCow.add(shakeTreasure);
|
|
|
|
+ }
|
|
|
|
+ else if (type.equals("Shake.PIG")) {
|
|
|
|
+ shakeFromPig.add(shakeTreasure);
|
|
|
|
+ }
|
|
|
|
+ else if (type.equals("Shake.PIG_ZOMBIE")) {
|
|
|
|
+ shakeFromPigZombie.add(shakeTreasure);
|
|
|
|
+ }
|
|
|
|
+ else if (type.equals("Shake.SHEEP")) {
|
|
|
|
+ shakeFromSheep.add(shakeTreasure);
|
|
|
|
+ }
|
|
|
|
+ else if (type.equals("Shake.SKELETON")) {
|
|
|
|
+ shakeFromSkeleton.add(shakeTreasure);
|
|
|
|
+ }
|
|
|
|
+ else if (type.equals("Shake.SLIME")) {
|
|
|
|
+ shakeFromSlime.add(shakeTreasure);
|
|
|
|
+ }
|
|
|
|
+ else if (type.equals("Shake.SPIDER")) {
|
|
|
|
+ shakeFromSpider.add(shakeTreasure);
|
|
|
|
+ }
|
|
|
|
+ else if (type.equals("Shake.SNOWMAN")) {
|
|
|
|
+ shakeFromSnowman.add(shakeTreasure);
|
|
|
|
+ }
|
|
|
|
+ else if (type.equals("Shake.SQUID")) {
|
|
|
|
+ shakeFromSquid.add(shakeTreasure);
|
|
|
|
+ }
|
|
|
|
+ else if (type.equals("Shake.WITCH")) {
|
|
|
|
+ shakeFromWitch.add(shakeTreasure);
|
|
|
|
+ }
|
|
|
|
+ else if (type.equals("Shake.ZOMBIE")) {
|
|
|
|
+ shakeFromZombie.add(shakeTreasure);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else if (isExcavation) {
|
|
|
|
+ ExcavationTreasure excavationTreasure = new ExcavationTreasure(item, xp, dropChance, dropLevel);
|
|
|
|
+ List<String> dropList = config.getStringList(type + "." + treasureName + ".Drops_From");
|
|
|
|
+
|
|
|
|
+ if (dropList.contains("Dirt")) {
|
|
|
|
+ excavationFromDirt.add(excavationTreasure);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (dropList.contains("Grass")) {
|
|
|
|
+ excavationFromGrass.add(excavationTreasure);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (dropList.contains("Sand")) {
|
|
|
|
+ excavationFromSand.add(excavationTreasure);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (dropList.contains("Gravel")) {
|
|
|
|
+ excavationFromGravel.add(excavationTreasure);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (dropList.contains("Clay")) {
|
|
|
|
+ excavationFromClay.add(excavationTreasure);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (dropList.contains("Mycelium")) {
|
|
|
|
+ excavationFromMycel.add(excavationTreasure);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (dropList.contains("Soul_Sand")) {
|
|
|
|
+ excavationFromSoulSand.add(excavationTreasure);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (dropList.contains("Snow")) {
|
|
|
|
+ excavationFromSnow.add(excavationTreasure);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else if (isHylian) {
|
|
|
|
+ HylianTreasure hylianTreasure = new HylianTreasure(item, xp, dropChance, dropLevel);
|
|
|
|
+ List<String> dropList = config.getStringList(type + "." + treasureName + ".Drops_From");
|
|
|
|
+
|
|
|
|
+ if (dropList.contains("Bushes")) {
|
|
|
|
+ hylianFromBushes.add(hylianTreasure);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (dropList.contains("Flowers")) {
|
|
|
|
+ hylianFromFlowers.add(hylianTreasure);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (dropList.contains("Pots")) {
|
|
|
|
+ hylianFromPots.add(hylianTreasure);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
+}
|