mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-12-19 07:18:45 +01:00
2.2.044 Fix copper repair and salvage
This commit is contained in:
@@ -1,3 +1,6 @@
|
|||||||
|
Version 2.2.044
|
||||||
|
Fixed copper armor and tools not working with Repair or Salvage
|
||||||
|
|
||||||
Version 2.2.043
|
Version 2.2.043
|
||||||
Added support for the new copper tools and armor added in Minecraft 1.21.9
|
Added support for the new copper tools and armor added in Minecraft 1.21.9
|
||||||
Added many missing buttons, trapdoors, doors, fence gates, etc to the ability/tool blacklists (see notes)
|
Added many missing buttons, trapdoors, doors, fence gates, etc to the ability/tool blacklists (see notes)
|
||||||
|
|||||||
2
pom.xml
2
pom.xml
@@ -2,7 +2,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
||||||
<artifactId>mcMMO</artifactId>
|
<artifactId>mcMMO</artifactId>
|
||||||
<version>2.2.044-SNAPSHOT</version>
|
<version>2.2.044</version>
|
||||||
<name>mcMMO</name>
|
<name>mcMMO</name>
|
||||||
<url>https://github.com/mcMMO-Dev/mcMMO</url>
|
<url>https://github.com/mcMMO-Dev/mcMMO</url>
|
||||||
<scm>
|
<scm>
|
||||||
|
|||||||
@@ -1,5 +1,20 @@
|
|||||||
package com.gmail.nossr50.config.skills.repair;
|
package com.gmail.nossr50.config.skills.repair;
|
||||||
|
|
||||||
|
import static com.gmail.nossr50.util.ItemUtils.isCopperArmor;
|
||||||
|
import static com.gmail.nossr50.util.ItemUtils.isCopperTool;
|
||||||
|
import static com.gmail.nossr50.util.ItemUtils.isDiamondArmor;
|
||||||
|
import static com.gmail.nossr50.util.ItemUtils.isDiamondTool;
|
||||||
|
import static com.gmail.nossr50.util.ItemUtils.isGoldArmor;
|
||||||
|
import static com.gmail.nossr50.util.ItemUtils.isGoldTool;
|
||||||
|
import static com.gmail.nossr50.util.ItemUtils.isIronArmor;
|
||||||
|
import static com.gmail.nossr50.util.ItemUtils.isIronTool;
|
||||||
|
import static com.gmail.nossr50.util.ItemUtils.isLeatherArmor;
|
||||||
|
import static com.gmail.nossr50.util.ItemUtils.isNetheriteArmor;
|
||||||
|
import static com.gmail.nossr50.util.ItemUtils.isNetheriteTool;
|
||||||
|
import static com.gmail.nossr50.util.ItemUtils.isStoneTool;
|
||||||
|
import static com.gmail.nossr50.util.ItemUtils.isStringTool;
|
||||||
|
import static com.gmail.nossr50.util.ItemUtils.isWoodTool;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.BukkitConfig;
|
import com.gmail.nossr50.config.BukkitConfig;
|
||||||
import com.gmail.nossr50.datatypes.skills.ItemType;
|
import com.gmail.nossr50.datatypes.skills.ItemType;
|
||||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||||
@@ -63,27 +78,27 @@ public class RepairConfig extends BukkitConfig {
|
|||||||
String repairMaterialTypeString = config.getString(
|
String repairMaterialTypeString = config.getString(
|
||||||
"Repairables." + key + ".MaterialType", "OTHER");
|
"Repairables." + key + ".MaterialType", "OTHER");
|
||||||
|
|
||||||
if (!config.contains("Repairables." + key + ".MaterialType") && itemMaterial != null) {
|
if (!config.contains("Repairables." + key + ".MaterialType")) {
|
||||||
ItemStack repairItem = new ItemStack(itemMaterial);
|
final ItemStack repairItem = new ItemStack(itemMaterial);
|
||||||
|
|
||||||
if (ItemUtils.isWoodTool(repairItem)) {
|
if (isWoodTool(repairItem)) {
|
||||||
repairMaterialType = MaterialType.WOOD;
|
repairMaterialType = MaterialType.WOOD;
|
||||||
} else if (ItemUtils.isStoneTool(repairItem)) {
|
} else if (isStoneTool(repairItem)) {
|
||||||
repairMaterialType = MaterialType.STONE;
|
repairMaterialType = MaterialType.STONE;
|
||||||
} else if (ItemUtils.isStringTool(repairItem)) {
|
} else if (isStringTool(repairItem)) {
|
||||||
repairMaterialType = MaterialType.STRING;
|
repairMaterialType = MaterialType.STRING;
|
||||||
} else if (ItemUtils.isLeatherArmor(repairItem)) {
|
} else if (isLeatherArmor(repairItem)) {
|
||||||
repairMaterialType = MaterialType.LEATHER;
|
repairMaterialType = MaterialType.LEATHER;
|
||||||
} else if (ItemUtils.isIronArmor(repairItem) || ItemUtils.isIronTool(repairItem)) {
|
} else if (isIronArmor(repairItem) || isIronTool(repairItem)) {
|
||||||
repairMaterialType = MaterialType.IRON;
|
repairMaterialType = MaterialType.IRON;
|
||||||
} else if (ItemUtils.isGoldArmor(repairItem) || ItemUtils.isGoldTool(repairItem)) {
|
} else if (isGoldArmor(repairItem) || isGoldTool(repairItem)) {
|
||||||
repairMaterialType = MaterialType.GOLD;
|
repairMaterialType = MaterialType.GOLD;
|
||||||
} else if (ItemUtils.isDiamondArmor(repairItem) || ItemUtils.isDiamondTool(
|
} else if (isDiamondArmor(repairItem) || isDiamondTool(repairItem)) {
|
||||||
repairItem)) {
|
|
||||||
repairMaterialType = MaterialType.DIAMOND;
|
repairMaterialType = MaterialType.DIAMOND;
|
||||||
} else if (ItemUtils.isNetheriteArmor(repairItem) || ItemUtils.isNetheriteTool(
|
} else if (isNetheriteArmor(repairItem) || isNetheriteTool(repairItem)) {
|
||||||
repairItem)) {
|
|
||||||
repairMaterialType = MaterialType.NETHERITE;
|
repairMaterialType = MaterialType.NETHERITE;
|
||||||
|
} else if (isCopperTool(repairItem) || isCopperArmor(repairItem)) {
|
||||||
|
repairMaterialType = MaterialType.COPPER;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
@@ -105,9 +120,7 @@ public class RepairConfig extends BukkitConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Maximum Durability
|
// Maximum Durability
|
||||||
short maximumDurability = (itemMaterial != null ? itemMaterial.getMaxDurability()
|
short maximumDurability = itemMaterial.getMaxDurability();
|
||||||
: (short) config.getInt(
|
|
||||||
"Repairables." + key + ".MaximumDurability"));
|
|
||||||
|
|
||||||
if (maximumDurability <= 0) {
|
if (maximumDurability <= 0) {
|
||||||
maximumDurability = (short) config.getInt(
|
maximumDurability = (short) config.getInt(
|
||||||
@@ -169,7 +182,7 @@ public class RepairConfig extends BukkitConfig {
|
|||||||
//Report unsupported
|
//Report unsupported
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
|
|
||||||
if (notSupported.size() > 0) {
|
if (!notSupported.isEmpty()) {
|
||||||
stringBuilder.append(
|
stringBuilder.append(
|
||||||
"mcMMO found the following materials in the Repair config that are not supported by the version of Minecraft running on this server: ");
|
"mcMMO found the following materials in the Repair config that are not supported by the version of Minecraft running on this server: ");
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,21 @@
|
|||||||
package com.gmail.nossr50.config.skills.salvage;
|
package com.gmail.nossr50.config.skills.salvage;
|
||||||
|
|
||||||
|
import static com.gmail.nossr50.util.ItemUtils.isCopperArmor;
|
||||||
|
import static com.gmail.nossr50.util.ItemUtils.isCopperTool;
|
||||||
|
import static com.gmail.nossr50.util.ItemUtils.isDiamondArmor;
|
||||||
|
import static com.gmail.nossr50.util.ItemUtils.isDiamondTool;
|
||||||
|
import static com.gmail.nossr50.util.ItemUtils.isGoldArmor;
|
||||||
|
import static com.gmail.nossr50.util.ItemUtils.isGoldTool;
|
||||||
|
import static com.gmail.nossr50.util.ItemUtils.isIronArmor;
|
||||||
|
import static com.gmail.nossr50.util.ItemUtils.isIronTool;
|
||||||
|
import static com.gmail.nossr50.util.ItemUtils.isLeatherArmor;
|
||||||
|
import static com.gmail.nossr50.util.ItemUtils.isNetheriteArmor;
|
||||||
|
import static com.gmail.nossr50.util.ItemUtils.isNetheriteTool;
|
||||||
|
import static com.gmail.nossr50.util.ItemUtils.isPrismarineTool;
|
||||||
|
import static com.gmail.nossr50.util.ItemUtils.isStoneTool;
|
||||||
|
import static com.gmail.nossr50.util.ItemUtils.isStringTool;
|
||||||
|
import static com.gmail.nossr50.util.ItemUtils.isWoodTool;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.BukkitConfig;
|
import com.gmail.nossr50.config.BukkitConfig;
|
||||||
import com.gmail.nossr50.datatypes.database.UpgradeType;
|
import com.gmail.nossr50.datatypes.database.UpgradeType;
|
||||||
import com.gmail.nossr50.datatypes.skills.ItemType;
|
import com.gmail.nossr50.datatypes.skills.ItemType;
|
||||||
@@ -50,9 +66,9 @@ public class SalvageConfig extends BukkitConfig {
|
|||||||
mcMMO.p.getLogger().log(
|
mcMMO.p.getLogger().log(
|
||||||
Level.INFO,
|
Level.INFO,
|
||||||
"Fixing incorrect Salvage quantities on Netherite gear, this will only run once...");
|
"Fixing incorrect Salvage quantities on Netherite gear, this will only run once...");
|
||||||
for (String namespacedkey : mcMMO.getMaterialMapStore().getNetheriteArmor()) {
|
for (String namespacedKey : mcMMO.getMaterialMapStore().getNetheriteArmor()) {
|
||||||
config.set(
|
config.set(
|
||||||
"Salvageables." + namespacedkey.toUpperCase(Locale.ENGLISH)
|
"Salvageables." + namespacedKey.toUpperCase(Locale.ENGLISH)
|
||||||
+ ".MaximumQuantity",
|
+ ".MaximumQuantity",
|
||||||
4); //TODO: Doesn't make sense to default to 4 for everything
|
4); //TODO: Doesn't make sense to default to 4 for everything
|
||||||
}
|
}
|
||||||
@@ -84,34 +100,32 @@ public class SalvageConfig extends BukkitConfig {
|
|||||||
|
|
||||||
// Salvage Material Type
|
// Salvage Material Type
|
||||||
MaterialType salvageMaterialType = MaterialType.OTHER;
|
MaterialType salvageMaterialType = MaterialType.OTHER;
|
||||||
String salvageMaterialTypeString = config.getString(
|
final String salvageMaterialTypeString = config.getString(
|
||||||
"Salvageables." + key + ".MaterialType", "OTHER");
|
"Salvageables." + key + ".MaterialType", "OTHER");
|
||||||
|
|
||||||
if (!config.contains("Salvageables." + key + ".MaterialType") && itemMaterial != null) {
|
if (!config.contains("Salvageables." + key + ".MaterialType")) {
|
||||||
ItemStack salvageItem = new ItemStack(itemMaterial);
|
final ItemStack salvageItem = new ItemStack(itemMaterial);
|
||||||
|
|
||||||
if (ItemUtils.isWoodTool(salvageItem)) {
|
if (isWoodTool(salvageItem)) {
|
||||||
salvageMaterialType = MaterialType.WOOD;
|
salvageMaterialType = MaterialType.WOOD;
|
||||||
} else if (ItemUtils.isStoneTool(salvageItem)) {
|
} else if (isStoneTool(salvageItem)) {
|
||||||
salvageMaterialType = MaterialType.STONE;
|
salvageMaterialType = MaterialType.STONE;
|
||||||
} else if (ItemUtils.isStringTool(salvageItem)) {
|
} else if (isStringTool(salvageItem)) {
|
||||||
salvageMaterialType = MaterialType.STRING;
|
salvageMaterialType = MaterialType.STRING;
|
||||||
} else if (ItemUtils.isPrismarineTool(salvageItem)) {
|
} else if (isPrismarineTool(salvageItem)) {
|
||||||
salvageMaterialType = MaterialType.PRISMARINE;
|
salvageMaterialType = MaterialType.PRISMARINE;
|
||||||
} else if (ItemUtils.isLeatherArmor(salvageItem)) {
|
} else if (isLeatherArmor(salvageItem)) {
|
||||||
salvageMaterialType = MaterialType.LEATHER;
|
salvageMaterialType = MaterialType.LEATHER;
|
||||||
} else if (ItemUtils.isIronArmor(salvageItem) || ItemUtils.isIronTool(
|
} else if (isIronArmor(salvageItem) || isIronTool(salvageItem)) {
|
||||||
salvageItem)) {
|
|
||||||
salvageMaterialType = MaterialType.IRON;
|
salvageMaterialType = MaterialType.IRON;
|
||||||
} else if (ItemUtils.isGoldArmor(salvageItem) || ItemUtils.isGoldTool(
|
} else if (isGoldArmor(salvageItem) || isGoldTool(salvageItem)) {
|
||||||
salvageItem)) {
|
|
||||||
salvageMaterialType = MaterialType.GOLD;
|
salvageMaterialType = MaterialType.GOLD;
|
||||||
} else if (ItemUtils.isDiamondArmor(salvageItem) || ItemUtils.isDiamondTool(
|
} else if (isDiamondArmor(salvageItem) || isDiamondTool(salvageItem)) {
|
||||||
salvageItem)) {
|
|
||||||
salvageMaterialType = MaterialType.DIAMOND;
|
salvageMaterialType = MaterialType.DIAMOND;
|
||||||
} else if (ItemUtils.isNetheriteTool(salvageItem) || ItemUtils.isNetheriteArmor(
|
} else if (isNetheriteTool(salvageItem) || isNetheriteArmor(salvageItem)) {
|
||||||
salvageItem)) {
|
|
||||||
salvageMaterialType = MaterialType.NETHERITE;
|
salvageMaterialType = MaterialType.NETHERITE;
|
||||||
|
} else if (isCopperTool(salvageItem) || isCopperArmor(salvageItem)) {
|
||||||
|
salvageMaterialType = MaterialType.COPPER;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
@@ -124,8 +138,7 @@ public class SalvageConfig extends BukkitConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Salvage Material
|
// Salvage Material
|
||||||
String salvageMaterialName = config.getString(
|
String salvageMaterialName = config.getString("Salvageables." + key + ".SalvageMaterial");
|
||||||
"Salvageables." + key + ".SalvageMaterial");
|
|
||||||
Material salvageMaterial = (salvageMaterialName == null
|
Material salvageMaterial = (salvageMaterialName == null
|
||||||
? salvageMaterialType.getDefaultMaterial()
|
? salvageMaterialType.getDefaultMaterial()
|
||||||
: Material.matchMaterial(salvageMaterialName));
|
: Material.matchMaterial(salvageMaterialName));
|
||||||
@@ -136,16 +149,14 @@ public class SalvageConfig extends BukkitConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Maximum Durability
|
// Maximum Durability
|
||||||
short maximumDurability = (itemMaterial != null ? itemMaterial.getMaxDurability()
|
short maximumDurability = itemMaterial.getMaxDurability();
|
||||||
: (short) config.getInt(
|
|
||||||
"Salvageables." + key + ".MaximumDurability"));
|
|
||||||
|
|
||||||
// Item Type
|
// Item Type
|
||||||
ItemType salvageItemType = ItemType.OTHER;
|
ItemType salvageItemType = ItemType.OTHER;
|
||||||
String salvageItemTypeString = config.getString("Salvageables." + key + ".ItemType",
|
String salvageItemTypeString = config.getString("Salvageables." + key + ".ItemType",
|
||||||
"OTHER");
|
"OTHER");
|
||||||
|
|
||||||
if (!config.contains("Salvageables." + key + ".ItemType") && itemMaterial != null) {
|
if (!config.contains("Salvageables." + key + ".ItemType")) {
|
||||||
ItemStack salvageItem = new ItemStack(itemMaterial);
|
ItemStack salvageItem = new ItemStack(itemMaterial);
|
||||||
|
|
||||||
if (ItemUtils.isMinecraftTool(salvageItem)) {
|
if (ItemUtils.isMinecraftTool(salvageItem)) {
|
||||||
@@ -170,11 +181,11 @@ public class SalvageConfig extends BukkitConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Maximum Quantity
|
// Maximum Quantity
|
||||||
int maximumQuantity = itemMaterial != null ? SkillUtils.getRepairAndSalvageQuantities(
|
int maximumQuantity = SkillUtils.getRepairAndSalvageQuantities(
|
||||||
itemMaterial,
|
itemMaterial,
|
||||||
salvageMaterial) : config.getInt("Salvageables." + key + ".MaximumQuantity", 1);
|
salvageMaterial);
|
||||||
|
|
||||||
if (maximumQuantity <= 0 && itemMaterial != null) {
|
if (maximumQuantity <= 0) {
|
||||||
maximumQuantity = config.getInt("Salvageables." + key + ".MaximumQuantity", 1);
|
maximumQuantity = config.getInt("Salvageables." + key + ".MaximumQuantity", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -206,7 +217,7 @@ public class SalvageConfig extends BukkitConfig {
|
|||||||
//Report unsupported
|
//Report unsupported
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
|
|
||||||
if (notSupported.size() > 0) {
|
if (!notSupported.isEmpty()) {
|
||||||
stringBuilder.append(
|
stringBuilder.append(
|
||||||
"mcMMO found the following materials in the Salvage config that are not supported by the version of Minecraft running on this server: ");
|
"mcMMO found the following materials in the Salvage config that are not supported by the version of Minecraft running on this server: ");
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ public enum MaterialType {
|
|||||||
WOOD,
|
WOOD,
|
||||||
STONE,
|
STONE,
|
||||||
IRON,
|
IRON,
|
||||||
|
COPPER,
|
||||||
GOLD,
|
GOLD,
|
||||||
DIAMOND,
|
DIAMOND,
|
||||||
NETHERITE,
|
NETHERITE,
|
||||||
@@ -45,6 +46,8 @@ public enum MaterialType {
|
|||||||
}
|
}
|
||||||
case PRISMARINE:
|
case PRISMARINE:
|
||||||
return Material.PRISMARINE_CRYSTALS;
|
return Material.PRISMARINE_CRYSTALS;
|
||||||
|
case COPPER:
|
||||||
|
return Material.COPPER_INGOT;
|
||||||
|
|
||||||
case OTHER:
|
case OTHER:
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -380,6 +380,10 @@ public final class ItemUtils {
|
|||||||
return mcMMO.getMaterialMapStore().isIronArmor(item.getType().getKey().getKey());
|
return mcMMO.getMaterialMapStore().isIronArmor(item.getType().getKey().getKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isCopperArmor(ItemStack item) {
|
||||||
|
return mcMMO.getMaterialMapStore().isCopperArmor(item.getType().getKey().getKey());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks to see if an item is a diamond armor piece.
|
* Checks to see if an item is a diamond armor piece.
|
||||||
*
|
*
|
||||||
@@ -452,6 +456,10 @@ public final class ItemUtils {
|
|||||||
return mcMMO.getMaterialMapStore().isPrismarineTool(item.getType().getKey().getKey());
|
return mcMMO.getMaterialMapStore().isPrismarineTool(item.getType().getKey().getKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isCopperTool(ItemStack item) {
|
||||||
|
return mcMMO.getMaterialMapStore().isCopperTool(item.getType().getKey().getKey());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks to see if an item is a gold tool.
|
* Checks to see if an item is a gold tool.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user