mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-29 16:46:46 +01:00
Fixing start up errors when loading treasures.yml
This commit is contained in:
parent
2162c81b21
commit
ac31a3dc0e
@ -46,23 +46,6 @@ public class TreasureConfig extends ConfigLoader {
|
|||||||
protected boolean validateKeys() {
|
protected boolean validateKeys() {
|
||||||
// Validate all the settings!
|
// Validate all the settings!
|
||||||
List<String> reason = new ArrayList<>();
|
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);
|
return noErrorsInConfig(reason);
|
||||||
}
|
}
|
||||||
@ -74,7 +57,6 @@ public class TreasureConfig extends ConfigLoader {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
loadTreasures("Fishing");
|
|
||||||
loadTreasures("Excavation");
|
loadTreasures("Excavation");
|
||||||
loadTreasures("Hylian_Luck");
|
loadTreasures("Hylian_Luck");
|
||||||
|
|
||||||
@ -253,22 +235,6 @@ public class TreasureConfig extends ConfigLoader {
|
|||||||
hylianMap.get(dropper).add(treasure);
|
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) {
|
public double getItemDropRate(int tier, Rarity rarity) {
|
||||||
return config.getDouble("Item_Drop_Rates.Tier_" + tier + "." + rarity.toString());
|
return config.getDouble("Item_Drop_Rates.Tier_" + tier + "." + rarity.toString());
|
||||||
}
|
}
|
||||||
|
@ -531,7 +531,7 @@ public class FishingManager extends SkillManager {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case BEDROCK:
|
case BEDROCK:
|
||||||
if (TreasureConfig.getInstance().getInventoryStealEnabled()) {
|
if (FishingTreasureConfig.getInstance().getInventoryStealEnabled()) {
|
||||||
PlayerInventory inventory = targetPlayer.getInventory();
|
PlayerInventory inventory = targetPlayer.getInventory();
|
||||||
int length = inventory.getContents().length;
|
int length = inventory.getContents().length;
|
||||||
int slot = Misc.getRandom().nextInt(length);
|
int slot = Misc.getRandom().nextInt(length);
|
||||||
@ -541,7 +541,7 @@ public class FishingManager extends SkillManager {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TreasureConfig.getInstance().getInventoryStealStacks()) {
|
if (FishingTreasureConfig.getInstance().getInventoryStealStacks()) {
|
||||||
inventory.setItem(slot, null);
|
inventory.setItem(slot, null);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Loading…
Reference in New Issue
Block a user