Repair / Salvage fixes

This commit is contained in:
nossr50 2020-06-30 10:03:37 -07:00
parent b0ce6fb170
commit 78eb367b86
6 changed files with 55 additions and 19 deletions

View File

@ -29,9 +29,13 @@ Version 2.1.131
Added Red Nether Bricks to Experience tables for Mining in experience.yml (see notes)
Added Netherite to Experience tables for Repair in experience.yml (see notes)
Changed Salvage maximum quantity values to 4 for all Netherite gear
Netherite now requires 100 Salvage skill (by default configs) in order to salvage
NOTES:
Repair and Salvage are going to get some tweaks regarding Netherite gear really soon.
This update adds quite a few missing entries for bonus drops, without these entries double drops on these items/blocks will not happen.
You should not need to edit your configs to receive these changes.

View File

@ -1,17 +1,20 @@
package com.gmail.nossr50.config.skills.salvage;
import com.gmail.nossr50.config.ConfigLoader;
import com.gmail.nossr50.datatypes.database.UpgradeType;
import com.gmail.nossr50.datatypes.skills.ItemType;
import com.gmail.nossr50.datatypes.skills.MaterialType;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.salvage.salvageables.Salvageable;
import com.gmail.nossr50.skills.salvage.salvageables.SalvageableFactory;
import com.gmail.nossr50.util.ItemUtils;
import com.gmail.nossr50.util.MaterialMapStore;
import com.gmail.nossr50.util.skills.SkillUtils;
import org.bukkit.Material;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.inventory.ItemStack;
import java.io.IOException;
import java.util.*;
public class SalvageConfig extends ConfigLoader {
@ -36,6 +39,24 @@ public class SalvageConfig extends ConfigLoader {
ConfigurationSection section = config.getConfigurationSection("Salvageables");
Set<String> keys = section.getKeys(false);
//Original version of 1.16 support had maximum quantities that were bad, this fixes it
if(mcMMO.getUpgradeManager().shouldUpgrade(UpgradeType.FIX_NETHERITE_SALVAGE_QUANTITIES)) {
mcMMO.p.getLogger().info("Fixing incorrect Salvage quantities on Netherite gear, this will only run once...");
for(String namespacedkey : mcMMO.getMaterialMapStore().getNetheriteArmor()) {
config.set("Salvageables." + namespacedkey.toUpperCase() + ".MaximumQuantity", 4);
}
try {
config.save(getFile());
// mcMMO.getUpgradeManager().setUpgradeCompleted(UpgradeType.FIX_NETHERITE_SALVAGE_QUANTITIES);
mcMMO.p.getLogger().info("Fixed incorrect Salvage quantities for Netherite gear!");
} catch (IOException e) {
mcMMO.p.getLogger().info("Unable to fix Salvage config, please delete the salvage yml file to generate a new one.");
e.printStackTrace();
}
}
for (String key : keys) {
// Validate all the things!
List<String> reason = new ArrayList<String>();
@ -131,7 +152,7 @@ public class SalvageConfig extends ConfigLoader {
}
// Maximum Quantity
int maximumQuantity = (itemMaterial != null ? SkillUtils.getRepairAndSalvageQuantities(itemMaterial, salvageMaterial) : config.getInt("Salvageables." + key + ".MaximumQuantity", 2));
int maximumQuantity = (itemMaterial != null ? SkillUtils.getRepairAndSalvageQuantities(itemMaterial, salvageMaterial) : config.getInt("Salvageables." + key + ".MaximumQuantity", 1));
if (maximumQuantity <= 0 && itemMaterial != null) {
maximumQuantity = config.getInt("Salvageables." + key + ".MaximumQuantity", 1);

View File

@ -15,5 +15,6 @@ public enum UpgradeType {
ADD_SKILL_TOTAL,
ADD_UNIQUE_PLAYER_DATA,
FIX_SPELLING_NETHERITE_SALVAGE,
FIX_SPELLING_NETHERITE_REPAIR
FIX_SPELLING_NETHERITE_REPAIR,
FIX_NETHERITE_SALVAGE_QUANTITIES
}

View File

@ -1088,6 +1088,15 @@ public class MaterialMapStore {
toolBlackList.add("respawn_anchor");
}
public HashSet<String> getNetheriteArmor() {
return netheriteArmor;
}
public HashSet<String> getNetheriteTools() {
return netheriteTools;
}
public int getTier(Material material) {
return getTier(material.getKey().getKey());
}

View File

@ -221,40 +221,40 @@ Salvageables:
MaximumQuantity: 4
NETHERITE_SWORD:
MinimumLevel: 50
MinimumLevel: 100
XpMultiplier: .5
MaximumQuantity: 2
MaximumQuantity: 4
NETHERITE_SHOVEL:
MinimumLevel: 50
MinimumLevel: 100
XpMultiplier: .3
MaximumQuantity: 1
MaximumQuantity: 4
NETHERITE_PICKAXE:
MinimumLevel: 50
MinimumLevel: 100
XpMultiplier: 1
MaximumQuantity: 3
MaximumQuantity: 4
NETHERITE_AXE:
MinimumLevel: 50
MinimumLevel: 100
XpMultiplier: 1
MaximumQuantity: 3
MaximumQuantity: 4
NETHERITE_HOE:
MinimumLevel: 50
MinimumLevel: 100
XpMultiplier: .5
MaximumQuantity: 2
MaximumQuantity: 4
# Armor
NETHERITE_HELMET:
MinimumLevel: 50
MinimumLevel: 100
XpMultiplier: 6
MaximumQuantity: 5
MaximumQuantity: 4
NETHERITE_CHESTPLATE:
MinimumLevel: 50
MinimumLevel: 100
XpMultiplier: 6
MaximumQuantity: 8
MaximumQuantity: 4
NETHERITE_LEGGINGS:
MinimumLevel: 50
MinimumLevel: 100
XpMultiplier: 6
MaximumQuantity: 7
MaximumQuantity: 4
NETHERITE_BOOTS:
MinimumLevel: 50
MinimumLevel: 100
XpMultiplier: 6
MaximumQuantity: 4
#

View File

@ -9,3 +9,4 @@ Upgrades_Finished:
ADD_ALCHEMY: false
FIX_SPELLING_NETHERITE_SALVAGE: false
FIX_SPELLING_NETHERITE_REPAIR: false
FIX_NETHERITE_SALVAGE_QUANTITIES: false