Fixing start up errors when loading treasures.yml

This commit is contained in:
nossr50 2020-12-28 17:37:14 -08:00
parent 2162c81b21
commit ac31a3dc0e
2 changed files with 2 additions and 36 deletions

View File

@ -46,23 +46,6 @@ public class TreasureConfig extends ConfigLoader {
protected boolean validateKeys() {
// Validate all the settings!
List<String> reason = new ArrayList<>();
for (String tier : config.getConfigurationSection("Enchantment_Drop_Rates").getKeys(false)) {
double totalItemDropRate = 0;
for (Rarity rarity : Rarity.values()) {
double itemDropRate = config.getDouble("Item_Drop_Rates." + tier + "." + rarity.toString());
if (itemDropRate < 0.0 || itemDropRate > 100.0) {
reason.add("The item drop rate for " + tier + " items that are " + rarity.toString() + "should be between 0.0 and 100.0!");
}
totalItemDropRate += itemDropRate;
}
if (totalItemDropRate < 0 || totalItemDropRate > 100.0) {
reason.add("The total item drop rate for " + tier + " should be between 0.0 and 100.0!");
}
}
return noErrorsInConfig(reason);
}
@ -74,7 +57,6 @@ public class TreasureConfig extends ConfigLoader {
return;
}
loadTreasures("Fishing");
loadTreasures("Excavation");
loadTreasures("Hylian_Luck");
@ -253,22 +235,6 @@ public class TreasureConfig extends ConfigLoader {
hylianMap.get(dropper).add(treasure);
}
public boolean getInventoryStealEnabled() {
return config.contains("Shake.PLAYER.INVENTORY");
}
public boolean getInventoryStealStacks() {
return config.getBoolean("Shake.PLAYER.INVENTORY.Whole_Stacks");
}
public double getInventoryStealDropChance() {
return config.getDouble("Shake.PLAYER.INVENTORY.Drop_Chance");
}
public int getInventoryStealDropLevel() {
return config.getInt("Shake.PLAYER.INVENTORY.Drop_Level");
}
public double getItemDropRate(int tier, Rarity rarity) {
return config.getDouble("Item_Drop_Rates.Tier_" + tier + "." + rarity.toString());
}

View File

@ -531,7 +531,7 @@ public class FishingManager extends SkillManager {
break;
case BEDROCK:
if (TreasureConfig.getInstance().getInventoryStealEnabled()) {
if (FishingTreasureConfig.getInstance().getInventoryStealEnabled()) {
PlayerInventory inventory = targetPlayer.getInventory();
int length = inventory.getContents().length;
int slot = Misc.getRandom().nextInt(length);
@ -541,7 +541,7 @@ public class FishingManager extends SkillManager {
break;
}
if (TreasureConfig.getInstance().getInventoryStealStacks()) {
if (FishingTreasureConfig.getInstance().getInventoryStealStacks()) {
inventory.setItem(slot, null);
}
else {