|
|
|
@ -1,12 +1,15 @@
|
|
|
|
|
package com.gmail.nossr50.config.treasure;
|
|
|
|
|
|
|
|
|
|
import com.gmail.nossr50.config.Config;
|
|
|
|
|
import com.gmail.nossr50.config.ConfigCollection;
|
|
|
|
|
import com.gmail.nossr50.config.Registers;
|
|
|
|
|
import com.gmail.nossr50.config.UnsafeValueValidation;
|
|
|
|
|
import com.gmail.nossr50.datatypes.treasure.*;
|
|
|
|
|
import com.gmail.nossr50.mcMMO;
|
|
|
|
|
import com.gmail.nossr50.util.EnchantmentUtils;
|
|
|
|
|
import com.gmail.nossr50.util.StringUtils;
|
|
|
|
|
import com.google.common.reflect.TypeToken;
|
|
|
|
|
import ninja.leaping.configurate.ConfigurationNode;
|
|
|
|
|
import ninja.leaping.configurate.objectmapping.ObjectMappingException;
|
|
|
|
|
import org.bukkit.Material;
|
|
|
|
|
import org.bukkit.Tag;
|
|
|
|
@ -23,7 +26,15 @@ import java.util.ArrayList;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
public class TreasureConfig extends ConfigCollection implements UnsafeValueValidation {
|
|
|
|
|
//TODO: Need to rewrite this too
|
|
|
|
|
public class TreasureConfig extends Config implements UnsafeValueValidation, Registers {
|
|
|
|
|
|
|
|
|
|
public static final String ENCHANTMENT_DROP_RATES = "Enchantment_Drop_Rates";
|
|
|
|
|
public static final String ITEM_DROP_RATES = "Item_Drop_Rates";
|
|
|
|
|
public static final String FISHING = "Fishing";
|
|
|
|
|
public static final String EXCAVATION = "Excavation";
|
|
|
|
|
public static final String SHAKE = "Shake";
|
|
|
|
|
public static final String HYLIAN_LUCK = "Hylian_Luck";
|
|
|
|
|
|
|
|
|
|
public HashMap<String, List<ExcavationTreasure>> excavationMap = new HashMap<String, List<ExcavationTreasure>>();
|
|
|
|
|
|
|
|
|
@ -36,6 +47,7 @@ public class TreasureConfig extends ConfigCollection implements UnsafeValueValid
|
|
|
|
|
public TreasureConfig() {
|
|
|
|
|
//super(McmmoCore.getDataFolderPath().getAbsoluteFile(),"treasures.yml");
|
|
|
|
|
super(mcMMO.p.getDataFolder().getAbsoluteFile(), "treasures.yml", false, true, false);
|
|
|
|
|
register();
|
|
|
|
|
validateEntries();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -61,38 +73,59 @@ public class TreasureConfig extends ConfigCollection implements UnsafeValueValid
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void unload() {
|
|
|
|
|
excavationMap.clear();
|
|
|
|
|
|
|
|
|
|
shakeMap.clear();
|
|
|
|
|
|
|
|
|
|
hylianMap.clear();
|
|
|
|
|
|
|
|
|
|
fishingRewards.clear();
|
|
|
|
|
|
|
|
|
|
fishingEnchantments.clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<String> validateKeys() {
|
|
|
|
|
// Validate all the settings!
|
|
|
|
|
List<String> errorMessages = new ArrayList<String>();
|
|
|
|
|
try {
|
|
|
|
|
for (String tier : getUserRootNode().getNode("Enchantment_Drop_Rates").getList(TypeToken.of(String.class))) {
|
|
|
|
|
double totalEnchantDropRate = 0;
|
|
|
|
|
double totalItemDropRate = 0;
|
|
|
|
|
for (String tier : getUserRootNode().getNode(ENCHANTMENT_DROP_RATES).getList(TypeToken.of(String.class))) {
|
|
|
|
|
/*double totalEnchantDropRate = 0;
|
|
|
|
|
double totalItemDropRate = 0;*/
|
|
|
|
|
|
|
|
|
|
for (Rarity rarity : Rarity.values()) {
|
|
|
|
|
double enchantDropRate = getDoubleValue("Enchantment_Drop_Rates." + tier + "." + rarity.toString());
|
|
|
|
|
double itemDropRate = getDoubleValue("Item_Drop_Rates." + tier + "." + rarity.toString());
|
|
|
|
|
double enchantDropRate = getDoubleValue(ENCHANTMENT_DROP_RATES, tier, rarity.toString());
|
|
|
|
|
double itemDropRate = getDoubleValue(ITEM_DROP_RATES, tier, rarity.toString());
|
|
|
|
|
|
|
|
|
|
if ((enchantDropRate < 0.0 || enchantDropRate > 100.0) && rarity != Rarity.RECORD) {
|
|
|
|
|
errorMessages.add("The enchant drop rate for " + tier + " items that are " + rarity.toString() + "should be between 0.0 and 100.0!");
|
|
|
|
|
|
|
|
|
|
//Bound Values
|
|
|
|
|
/*enchantDropRate = boundValues(enchantDropRate, 0.0D, 100.0D);*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (itemDropRate < 0.0 || itemDropRate > 100.0) {
|
|
|
|
|
errorMessages.add("The item drop rate for " + tier + " items that are " + rarity.toString() + "should be between 0.0 and 100.0!");
|
|
|
|
|
|
|
|
|
|
//Bound Values
|
|
|
|
|
/*itemDropRate = boundValues(itemDropRate, 0.0D, 100.0D);*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
totalEnchantDropRate += enchantDropRate;
|
|
|
|
|
totalItemDropRate += itemDropRate;
|
|
|
|
|
/*totalEnchantDropRate += enchantDropRate;
|
|
|
|
|
totalItemDropRate += itemDropRate;*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (totalEnchantDropRate < 0 || totalEnchantDropRate > 100.0) {
|
|
|
|
|
//TODO: Why does it matter what the total item/enchant drop rate is?
|
|
|
|
|
|
|
|
|
|
/*if (totalEnchantDropRate < 0 || totalEnchantDropRate > 100.0) {
|
|
|
|
|
errorMessages.add("The total enchant drop rate for " + tier + " should be between 0.0 and 100.0!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (totalItemDropRate < 0 || totalItemDropRate > 100.0) {
|
|
|
|
|
errorMessages.add("The total item drop rate for " + tier + " should be between 0.0 and 100.0!");
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
}
|
|
|
|
|
} catch (ObjectMappingException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
@ -101,34 +134,62 @@ public class TreasureConfig extends ConfigCollection implements UnsafeValueValid
|
|
|
|
|
return errorMessages;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void register() {
|
|
|
|
|
if (config.getConfigurationSection("Treasures") != null) {
|
|
|
|
|
backup();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
private double boundValues(double valueRef, double min, double max)
|
|
|
|
|
{
|
|
|
|
|
if(valueRef < min)
|
|
|
|
|
valueRef = min;
|
|
|
|
|
else if(valueRef > max)
|
|
|
|
|
valueRef = max;
|
|
|
|
|
|
|
|
|
|
loadTreasures("Fishing");
|
|
|
|
|
return valueRef;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void register() {
|
|
|
|
|
/*loadTreasures("Fishing");
|
|
|
|
|
loadTreasures("Excavation");
|
|
|
|
|
loadTreasures("Hylian_Luck");
|
|
|
|
|
loadTreasures("Hylian_Luck");*/
|
|
|
|
|
|
|
|
|
|
initRegisters();
|
|
|
|
|
|
|
|
|
|
loadFishing();
|
|
|
|
|
loadExcavation();
|
|
|
|
|
loadHerbalism();
|
|
|
|
|
|
|
|
|
|
loadEnchantments();
|
|
|
|
|
|
|
|
|
|
for (EntityType entity : EntityType.values()) {
|
|
|
|
|
if (entity.isAlive()) {
|
|
|
|
|
loadTreasures("Shake." + entity.toString());
|
|
|
|
|
loadShake(entity);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void loadTreasures(String type) {
|
|
|
|
|
boolean isFishing = type.equals("Fishing");
|
|
|
|
|
boolean isShake = type.contains("Shake");
|
|
|
|
|
boolean isExcavation = type.equals("Excavation");
|
|
|
|
|
boolean isHylian = type.equals("Hylian_Luck");
|
|
|
|
|
private void initRegisters()
|
|
|
|
|
{
|
|
|
|
|
if(excavationMap == null)
|
|
|
|
|
excavationMap = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
ConfigurationSection treasureSection = config.getConfigurationSection(type);
|
|
|
|
|
if(shakeMap == null)
|
|
|
|
|
shakeMap = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
if (treasureSection == null) {
|
|
|
|
|
if(hylianMap == null)
|
|
|
|
|
hylianMap = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
if(fishingRewards == null)
|
|
|
|
|
fishingRewards = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
if(fishingEnchantments == null)
|
|
|
|
|
fishingEnchantments = new HashMap<>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void loadFishing()
|
|
|
|
|
{
|
|
|
|
|
ConfigurationNode fishingTreasureNode = getUserRootNode().getNode(FISHING);
|
|
|
|
|
|
|
|
|
|
if(fishingTreasureNode == null)
|
|
|
|
|
{
|
|
|
|
|
mcMMO.p.getLogger().info("Fishing treasures in treasures config not defined");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -139,9 +200,80 @@ public class TreasureConfig extends ConfigCollection implements UnsafeValueValid
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (String treasureName : treasureSection.getKeys(false)) {
|
|
|
|
|
try {
|
|
|
|
|
for (String treasureName : fishingTreasureNode.getList(TypeToken.of(String.class))) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
} catch (ObjectMappingException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void loadExcavation()
|
|
|
|
|
{
|
|
|
|
|
ConfigurationNode excavationTreasureNode = getUserRootNode().getNode(EXCAVATION);
|
|
|
|
|
|
|
|
|
|
if(excavationTreasureNode == null)
|
|
|
|
|
{
|
|
|
|
|
mcMMO.p.getLogger().info("Excavation treasures in treasures config not defined");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
for (String treasureName : excavationTreasureNode.getList(TypeToken.of(String.class))) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
} catch (ObjectMappingException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void loadHerbalism()
|
|
|
|
|
{
|
|
|
|
|
ConfigurationNode herbalismTreasureNode = getUserRootNode().getNode(HYLIAN_LUCK);
|
|
|
|
|
|
|
|
|
|
if(herbalismTreasureNode == null)
|
|
|
|
|
{
|
|
|
|
|
mcMMO.p.getLogger().info("Hylian_Luck in treasures config not defined");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
for (String treasureName : herbalismTreasureNode.getList(TypeToken.of(String.class))) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
} catch (ObjectMappingException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void loadShake(EntityType entityType)
|
|
|
|
|
{
|
|
|
|
|
ConfigurationNode shakeTreasureNode = getUserRootNode().getNode(SHAKE, entityType.toString());
|
|
|
|
|
|
|
|
|
|
if(shakeTreasureNode != null)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
for (String treasureName : shakeTreasureNode.getList(TypeToken.of(String.class))) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
} catch (ObjectMappingException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void loadTreasures(ConfigurationNode treasureChildNode) {
|
|
|
|
|
if (treasureChildNode == null) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (String treasureName : treasureChildNode.getKeys(false)) {
|
|
|
|
|
// Validate all the things!
|
|
|
|
|
List<String> reason = new ArrayList<String>();
|
|
|
|
|
List<String> errorMessages = new ArrayList<String>();
|
|
|
|
|
|
|
|
|
|
String[] treasureInfo = treasureName.split("[|]");
|
|
|
|
|
String materialName = treasureInfo[0];
|
|
|
|
@ -161,39 +293,39 @@ public class TreasureConfig extends ConfigCollection implements UnsafeValueValid
|
|
|
|
|
material = Material.matchMaterial(materialName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int amount = getIntValue(type + "." + treasureName + ".Amount");
|
|
|
|
|
short data = (treasureInfo.length == 2) ? Short.parseShort(treasureInfo[1]) : (short) getIntValue(type + "." + treasureName + ".Data");
|
|
|
|
|
int amount = getIntValue(treasureChildNodeAddress + "." + treasureName + ".Amount");
|
|
|
|
|
short data = (treasureInfo.length == 2) ? Short.parseShort(treasureInfo[1]) : (short) getIntValue(treasureChildNodeAddress + "." + treasureName + ".Data");
|
|
|
|
|
|
|
|
|
|
if (material == null) {
|
|
|
|
|
reason.add("Invalid material: " + materialName);
|
|
|
|
|
errorMessages.add("Invalid material: " + materialName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (amount <= 0) {
|
|
|
|
|
reason.add("Amount of " + treasureName + " must be greater than 0! " + amount);
|
|
|
|
|
errorMessages.add("Amount of " + treasureName + " must be greater than 0! " + amount);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (material != null && material.isBlock() && (data > 127 || data < -128)) {
|
|
|
|
|
reason.add("Data of " + treasureName + " is invalid! " + data);
|
|
|
|
|
errorMessages.add("Data of " + treasureName + " is invalid! " + data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* XP, Drop Chance, and Drop Level
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
int xp = getIntValue(type + "." + treasureName + ".XP");
|
|
|
|
|
double dropChance = getDoubleValue(type + "." + treasureName + ".Drop_Chance");
|
|
|
|
|
int dropLevel = getIntValue(type + "." + treasureName + ".Drop_Level");
|
|
|
|
|
int xp = getIntValue(treasureChildNodeAddress + "." + treasureName + ".XP");
|
|
|
|
|
double dropChance = getDoubleValue(treasureChildNodeAddress + "." + treasureName + ".Drop_Chance");
|
|
|
|
|
int dropLevel = getIntValue(treasureChildNodeAddress + "." + treasureName + ".Drop_Level");
|
|
|
|
|
|
|
|
|
|
if (xp < 0) {
|
|
|
|
|
reason.add(treasureName + " has an invalid XP value: " + xp);
|
|
|
|
|
errorMessages.add(treasureName + " has an invalid XP value: " + xp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (dropChance < 0.0D) {
|
|
|
|
|
reason.add(treasureName + " has an invalid Drop_Chance: " + dropChance);
|
|
|
|
|
errorMessages.add(treasureName + " has an invalid Drop_Chance: " + dropChance);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (dropLevel < 0) {
|
|
|
|
|
reason.add(treasureName + " has an invalid Drop_Level: " + dropLevel);
|
|
|
|
|
errorMessages.add(treasureName + " has an invalid Drop_Level: " + dropLevel);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
@ -202,10 +334,10 @@ public class TreasureConfig extends ConfigCollection implements UnsafeValueValid
|
|
|
|
|
Rarity rarity = null;
|
|
|
|
|
|
|
|
|
|
if (isFishing) {
|
|
|
|
|
rarity = Rarity.getRarity(getStringValue(type + "." + treasureName + ".Rarity"));
|
|
|
|
|
rarity = Rarity.getRarity(getStringValue(treasureChildNodeAddress + "." + treasureName + ".Rarity"));
|
|
|
|
|
|
|
|
|
|
if (rarity == null) {
|
|
|
|
|
reason.add("Invalid Rarity for item: " + treasureName);
|
|
|
|
|
errorMessages.add("Invalid Rarity for item: " + treasureName);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -217,28 +349,28 @@ public class TreasureConfig extends ConfigCollection implements UnsafeValueValid
|
|
|
|
|
if (materialName.contains("POTION")) {
|
|
|
|
|
Material mat = Material.matchMaterial(materialName);
|
|
|
|
|
if (mat == null) {
|
|
|
|
|
reason.add("Potion format for Treasures.yml has changed");
|
|
|
|
|
errorMessages.add("Potion format for Treasures.yml has changed");
|
|
|
|
|
} else {
|
|
|
|
|
item = new ItemStack(mat, amount, data);
|
|
|
|
|
PotionMeta itemMeta = (PotionMeta) item.getItemMeta();
|
|
|
|
|
|
|
|
|
|
PotionType potionType = null;
|
|
|
|
|
try {
|
|
|
|
|
potionType = PotionType.valueOf(getStringValue(type + "." + treasureName + ".PotionData.PotionType", "WATER"));
|
|
|
|
|
potionType = PotionType.valueOf(getStringValue(treasureChildNodeAddress + "." + treasureName + ".PotionData.PotionType", "WATER"));
|
|
|
|
|
} catch (IllegalArgumentException ex) {
|
|
|
|
|
reason.add("Invalid Potion_Type: " + getStringValue(type + "." + treasureName + ".PotionData.PotionType", "WATER"));
|
|
|
|
|
errorMessages.add("Invalid Potion_Type: " + getStringValue(treasureChildNodeAddress + "." + treasureName + ".PotionData.PotionType", "WATER"));
|
|
|
|
|
}
|
|
|
|
|
boolean extended = getBooleanValue(type + "." + treasureName + ".PotionData.Extended", false);
|
|
|
|
|
boolean upgraded = getBooleanValue(type + "." + treasureName + ".PotionData.Upgraded", false);
|
|
|
|
|
boolean extended = getBooleanValue(treasureChildNodeAddress + "." + treasureName + ".PotionData.Extended", false);
|
|
|
|
|
boolean upgraded = getBooleanValue(treasureChildNodeAddress + "." + treasureName + ".PotionData.Upgraded", false);
|
|
|
|
|
itemMeta.setBasePotionData(new PotionData(potionType, extended, upgraded));
|
|
|
|
|
|
|
|
|
|
if (config.contains(type + "." + treasureName + ".Custom_Name")) {
|
|
|
|
|
itemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', getStringValue(type + "." + treasureName + ".Custom_Name")));
|
|
|
|
|
if (config.contains(treasureChildNodeAddress + "." + treasureName + ".Custom_Name")) {
|
|
|
|
|
itemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', getStringValue(treasureChildNodeAddress + "." + treasureName + ".Custom_Name")));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (config.contains(type + "." + treasureName + ".Lore")) {
|
|
|
|
|
if (config.contains(treasureChildNodeAddress + "." + treasureName + ".Lore")) {
|
|
|
|
|
List<String> lore = new ArrayList<String>();
|
|
|
|
|
for (String s : getStringValueList(type + "." + treasureName + ".Lore")) {
|
|
|
|
|
for (String s : getStringValueList(treasureChildNodeAddress + "." + treasureName + ".Lore")) {
|
|
|
|
|
lore.add(ChatColor.translateAlternateColorCodes('&', s));
|
|
|
|
|
}
|
|
|
|
|
itemMeta.setLore(lore);
|
|
|
|
@ -248,16 +380,16 @@ public class TreasureConfig extends ConfigCollection implements UnsafeValueValid
|
|
|
|
|
} else if (material != null) {
|
|
|
|
|
item = new ItemStack(material, amount, data);
|
|
|
|
|
|
|
|
|
|
if (config.contains(type + "." + treasureName + ".Custom_Name")) {
|
|
|
|
|
if (config.contains(treasureChildNodeAddress + "." + treasureName + ".Custom_Name")) {
|
|
|
|
|
ItemMeta itemMeta = item.getItemMeta();
|
|
|
|
|
itemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', getStringValue(type + "." + treasureName + ".Custom_Name")));
|
|
|
|
|
itemMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', getStringValue(treasureChildNodeAddress + "." + treasureName + ".Custom_Name")));
|
|
|
|
|
item.setItemMeta(itemMeta);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (config.contains(type + "." + treasureName + ".Lore")) {
|
|
|
|
|
if (config.contains(treasureChildNodeAddress + "." + treasureName + ".Lore")) {
|
|
|
|
|
ItemMeta itemMeta = item.getItemMeta();
|
|
|
|
|
List<String> lore = new ArrayList<String>();
|
|
|
|
|
for (String s : getStringValueList(type + "." + treasureName + ".Lore")) {
|
|
|
|
|
for (String s : getStringValueList(treasureChildNodeAddress + "." + treasureName + ".Lore")) {
|
|
|
|
|
lore.add(ChatColor.translateAlternateColorCodes('&', s));
|
|
|
|
|
}
|
|
|
|
|
itemMeta.setLore(lore);
|
|
|
|
@ -265,19 +397,19 @@ public class TreasureConfig extends ConfigCollection implements UnsafeValueValid
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (noErrorsInConfig(reason)) {
|
|
|
|
|
if (noErrorsInConfig(errorMessages)) {
|
|
|
|
|
if (isFishing) {
|
|
|
|
|
fishingRewards.get(rarity).add(new FishingTreasure(item, xp));
|
|
|
|
|
} else if (isShake) {
|
|
|
|
|
ShakeTreasure shakeTreasure = new ShakeTreasure(item, xp, dropChance, dropLevel);
|
|
|
|
|
|
|
|
|
|
EntityType entityType = EntityType.valueOf(type.substring(6));
|
|
|
|
|
EntityType entityType = EntityType.valueOf(treasureChildNodeAddress.substring(6));
|
|
|
|
|
if (!shakeMap.containsKey(entityType))
|
|
|
|
|
shakeMap.put(entityType, new ArrayList<ShakeTreasure>());
|
|
|
|
|
shakeMap.get(entityType).add(shakeTreasure);
|
|
|
|
|
} else if (isExcavation) {
|
|
|
|
|
ExcavationTreasure excavationTreasure = new ExcavationTreasure(item, xp, dropChance, dropLevel);
|
|
|
|
|
List<String> dropList = getStringValueList(type + "." + treasureName + ".Drops_From");
|
|
|
|
|
List<String> dropList = getStringValueList(treasureChildNodeAddress + "." + treasureName + ".Drops_From");
|
|
|
|
|
|
|
|
|
|
for (String blockType : dropList) {
|
|
|
|
|
if (!excavationMap.containsKey(blockType))
|
|
|
|
@ -286,7 +418,7 @@ public class TreasureConfig extends ConfigCollection implements UnsafeValueValid
|
|
|
|
|
}
|
|
|
|
|
} else if (isHylian) {
|
|
|
|
|
HylianTreasure hylianTreasure = new HylianTreasure(item, xp, dropChance, dropLevel);
|
|
|
|
|
List<String> dropList = getStringValueList(type + "." + treasureName + ".Drops_From");
|
|
|
|
|
List<String> dropList = getStringValueList(treasureChildNodeAddress + "." + treasureName + ".Drops_From");
|
|
|
|
|
|
|
|
|
|
for (String dropper : dropList) {
|
|
|
|
|
if (dropper.equals("Bushes")) {
|
|
|
|
@ -375,7 +507,7 @@ public class TreasureConfig extends ConfigCollection implements UnsafeValueValid
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public double getItemDropRate(int tier, Rarity rarity) {
|
|
|
|
|
return getDoubleValue("Item_Drop_Rates.Tier_" + tier + "." + rarity.toString());
|
|
|
|
|
return getDoubleValue(ITEM_DROP_RATES + ".Tier_" + tier + "." + rarity.toString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public double getEnchantmentDropRate(int tier, Rarity rarity) {
|
|
|
|
|