|
@@ -9,6 +9,7 @@ import com.gmail.nossr50.skills.salvage.salvageables.Salvageable;
|
|
import com.gmail.nossr50.skills.salvage.salvageables.SalvageableFactory;
|
|
import com.gmail.nossr50.skills.salvage.salvageables.SalvageableFactory;
|
|
import com.gmail.nossr50.util.ItemUtils;
|
|
import com.gmail.nossr50.util.ItemUtils;
|
|
import com.gmail.nossr50.util.LogUtils;
|
|
import com.gmail.nossr50.util.LogUtils;
|
|
|
|
+import com.gmail.nossr50.util.skills.SkillUtils;
|
|
import org.bukkit.Material;
|
|
import org.bukkit.Material;
|
|
import org.bukkit.configuration.ConfigurationSection;
|
|
import org.bukkit.configuration.ConfigurationSection;
|
|
import org.bukkit.inventory.ItemStack;
|
|
import org.bukkit.inventory.ItemStack;
|
|
@@ -17,8 +18,6 @@ import java.io.IOException;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.logging.Level;
|
|
import java.util.logging.Level;
|
|
|
|
|
|
-import static com.gmail.nossr50.util.skills.SkillUtils.getRepairAndSalvageQuantities;
|
|
|
|
-
|
|
|
|
public class SalvageConfig extends BukkitConfig {
|
|
public class SalvageConfig extends BukkitConfig {
|
|
private final HashSet<String> notSupported;
|
|
private final HashSet<String> notSupported;
|
|
private Set<Salvageable> salvageables;
|
|
private Set<Salvageable> salvageables;
|
|
@@ -42,7 +41,6 @@ public class SalvageConfig extends BukkitConfig {
|
|
Set<String> keys = section.getKeys(false);
|
|
Set<String> keys = section.getKeys(false);
|
|
|
|
|
|
//Original version of 1.16 support had maximum quantities that were bad, this fixes it
|
|
//Original version of 1.16 support had maximum quantities that were bad, this fixes it
|
|
-
|
|
|
|
if (mcMMO.getUpgradeManager().shouldUpgrade(UpgradeType.FIX_NETHERITE_SALVAGE_QUANTITIES)) {
|
|
if (mcMMO.getUpgradeManager().shouldUpgrade(UpgradeType.FIX_NETHERITE_SALVAGE_QUANTITIES)) {
|
|
mcMMO.p.getLogger().log(Level.INFO, "Fixing incorrect Salvage quantities on Netherite gear, this will only run once...");
|
|
mcMMO.p.getLogger().log(Level.INFO, "Fixing incorrect Salvage quantities on Netherite gear, this will only run once...");
|
|
for (String namespacedkey : mcMMO.getMaterialMapStore().getNetheriteArmor()) {
|
|
for (String namespacedkey : mcMMO.getMaterialMapStore().getNetheriteArmor()) {
|
|
@@ -59,7 +57,6 @@ public class SalvageConfig extends BukkitConfig {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
for (String key : keys) {
|
|
for (String key : keys) {
|
|
// Validate all the things!
|
|
// Validate all the things!
|
|
List<String> reason = new ArrayList<>();
|
|
List<String> reason = new ArrayList<>();
|
|
@@ -85,6 +82,8 @@ public class SalvageConfig extends BukkitConfig {
|
|
salvageMaterialType = MaterialType.STONE;
|
|
salvageMaterialType = MaterialType.STONE;
|
|
} else if (ItemUtils.isStringTool(salvageItem)) {
|
|
} else if (ItemUtils.isStringTool(salvageItem)) {
|
|
salvageMaterialType = MaterialType.STRING;
|
|
salvageMaterialType = MaterialType.STRING;
|
|
|
|
+ } else if (ItemUtils.isPrismarineTool(salvageItem)) {
|
|
|
|
+ salvageMaterialType = MaterialType.PRISMARINE;
|
|
} else if (ItemUtils.isLeatherArmor(salvageItem)) {
|
|
} else if (ItemUtils.isLeatherArmor(salvageItem)) {
|
|
salvageMaterialType = MaterialType.LEATHER;
|
|
salvageMaterialType = MaterialType.LEATHER;
|
|
} else if (ItemUtils.isIronArmor(salvageItem) || ItemUtils.isIronTool(salvageItem)) {
|
|
} else if (ItemUtils.isIronArmor(salvageItem) || ItemUtils.isIronTool(salvageItem)) {
|
|
@@ -145,7 +144,7 @@ public class SalvageConfig extends BukkitConfig {
|
|
|
|
|
|
// Maximum Quantity
|
|
// Maximum Quantity
|
|
int maximumQuantity = itemMaterial != null
|
|
int maximumQuantity = itemMaterial != null
|
|
- ? getRepairAndSalvageQuantities(itemMaterial, salvageMaterial)
|
|
|
|
|
|
+ ? SkillUtils.getRepairAndSalvageQuantities(itemMaterial, salvageMaterial)
|
|
: config.getInt("Salvageables." + key + ".MaximumQuantity", 1);
|
|
: config.getInt("Salvageables." + key + ".MaximumQuantity", 1);
|
|
|
|
|
|
if (maximumQuantity <= 0 && itemMaterial != null) {
|
|
if (maximumQuantity <= 0 && itemMaterial != null) {
|