mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-07-01 13:14:44 +02:00
Kill the MultiConfigs
This commit is contained in:
@ -37,53 +37,8 @@ public class Repairable {
|
||||
this.maximumDurability = this.itemMaterial.getMaxDurability();
|
||||
this.baseRepairDurability = (short) (maximumDurability / minimumQuantity);
|
||||
|
||||
this.repairItemType = determineItemType(this.itemMaterial);
|
||||
this.repairItemMaterialCategory = determineMaterialType(this.repairMaterials.get(0));
|
||||
}
|
||||
|
||||
public ItemMaterialCategory determineMaterialType(Material material) {
|
||||
switch (material) {
|
||||
case STRING:
|
||||
return ItemMaterialCategory.STRING;
|
||||
|
||||
case LEATHER:
|
||||
return ItemMaterialCategory.LEATHER;
|
||||
|
||||
case ACACIA_PLANKS:
|
||||
case BIRCH_PLANKS:
|
||||
case DARK_OAK_PLANKS:
|
||||
case JUNGLE_PLANKS:
|
||||
case OAK_PLANKS:
|
||||
case SPRUCE_PLANKS:
|
||||
return ItemMaterialCategory.WOOD;
|
||||
|
||||
case STONE:
|
||||
return ItemMaterialCategory.STONE;
|
||||
|
||||
case IRON_INGOT:
|
||||
return ItemMaterialCategory.IRON;
|
||||
|
||||
case GOLD_INGOT:
|
||||
return ItemMaterialCategory.GOLD;
|
||||
|
||||
case DIAMOND:
|
||||
return ItemMaterialCategory.DIAMOND;
|
||||
|
||||
default:
|
||||
return ItemMaterialCategory.OTHER;
|
||||
}
|
||||
}
|
||||
|
||||
private ItemType determineItemType(Material material)
|
||||
{
|
||||
if (ItemUtils.isMinecraftTool(new ItemStack(material))) {
|
||||
return ItemType.TOOL;
|
||||
}
|
||||
else if (ItemUtils.isArmor(new ItemStack((material)))) {
|
||||
return ItemType.ARMOR;
|
||||
} else {
|
||||
return ItemType.OTHER;
|
||||
}
|
||||
this.repairItemType = ItemUtils.determineItemType(this.itemMaterial);
|
||||
this.repairItemMaterialCategory = ItemUtils.determineMaterialType(this.repairMaterials.get(0));
|
||||
}
|
||||
|
||||
public Material getItemMaterial() {
|
||||
|
@ -5,14 +5,15 @@ import org.bukkit.Material;
|
||||
|
||||
public class Salvage {
|
||||
|
||||
public static Material anvilMaterial;
|
||||
public static boolean arcaneSalvageDowngrades;
|
||||
public static boolean arcaneSalvageEnchantLoss;
|
||||
|
||||
public Salvage() {
|
||||
anvilMaterial = mcMMO.getConfigManager().getConfigSalvage().getGeneral().getSalvageAnvilMaterial();
|
||||
arcaneSalvageDowngrades = mcMMO.getConfigManager().getConfigSalvage().getConfigArcaneSalvage().isDowngradesEnabled();
|
||||
arcaneSalvageEnchantLoss = mcMMO.getConfigManager().getConfigSalvage().getConfigArcaneSalvage().isMayLoseEnchants();
|
||||
}
|
||||
public static Material anvilMaterial;
|
||||
public static boolean arcaneSalvageDowngrades;
|
||||
public static boolean arcaneSalvageEnchantLoss;
|
||||
|
||||
protected static int calculateSalvageableAmount(short currentDurability, short maxDurability, int baseAmount) {
|
||||
double percentDamaged = (maxDurability <= 0) ? 1D : (double) (maxDurability - currentDurability) / maxDurability;
|
||||
|
@ -104,7 +104,6 @@ public class SalvageManager extends SkillManager {
|
||||
|
||||
salvageableAmount = Math.min(salvageableAmount, getSalvageableAmount()); // Always get at least something back, if you're capable of salvaging it.
|
||||
|
||||
|
||||
player.getInventory().setItemInMainHand(new ItemStack(Material.AIR));
|
||||
location.add(0.5, 1, 0.5);
|
||||
|
||||
@ -115,7 +114,7 @@ public class SalvageManager extends SkillManager {
|
||||
enchantBook = arcaneSalvageCheck(enchants);
|
||||
}
|
||||
|
||||
ItemStack salvageResults = new ItemStack(salvageable.getSalvageMaterial(), salvageableAmount);
|
||||
ItemStack salvageResults = new ItemStack(salvageable.getSalvagedItemMaterial(), salvageableAmount);
|
||||
|
||||
//Call event
|
||||
if (EventUtils.callSalvageCheckEvent(player, item, salvageResults, enchantBook).isCancelled()) {
|
||||
|
@ -2,31 +2,22 @@ package com.gmail.nossr50.skills.salvage.salvageables;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.ItemMaterialCategory;
|
||||
import com.gmail.nossr50.datatypes.skills.ItemType;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
|
||||
/**
|
||||
* Represents a 'Salvageable' item
|
||||
* Includes all the data needed for determining rewards from Salvage
|
||||
*/
|
||||
public class Salvageable {
|
||||
private final Material itemMaterial, salvagedItemMaterial;
|
||||
private final int maximumQuantity, minimumLevel;
|
||||
private final short maximumDurability, baseSalvageDurability;
|
||||
private final byte salvageMetadata;
|
||||
private final ItemType salvageItemType;
|
||||
private final ItemMaterialCategory salvageItemMaterialCategory;
|
||||
private final double xpMultiplier;
|
||||
|
||||
/*protected Salvageable(Material type, Material salvagedItemMaterial, byte salvageMetadata, int minimumLevel, int maximumQuantity, short maximumDurability, ItemType salvageItemType, ItemMaterialCategory salvageItemMaterialCategory, double xpMultiplier) {
|
||||
this.itemMaterial = type;
|
||||
this.salvagedItemMaterial = salvagedItemMaterial;
|
||||
this.salvageMetadata = salvageMetadata;
|
||||
this.salvageItemType = salvageItemType;
|
||||
this.salvageItemMaterialCategory = salvageItemMaterialCategory;
|
||||
this.minimumLevel = minimumLevel;
|
||||
this.maximumQuantity = maximumQuantity;
|
||||
this.maximumDurability = maximumDurability;
|
||||
this.baseSalvageDurability = (short) (maximumDurability / maximumQuantity);
|
||||
this.xpMultiplier = xpMultiplier;
|
||||
}*/
|
||||
|
||||
public Salvageable(String itemRegisterKey, String salvagedMaterialRegisterKey, int minimumLevel, int maximumQuantity)
|
||||
{
|
||||
this(Material.matchMaterial(itemRegisterKey), Material.matchMaterial(salvagedMaterialRegisterKey), minimumLevel, maximumQuantity);
|
||||
@ -34,17 +25,15 @@ public class Salvageable {
|
||||
|
||||
public Salvageable(Material itemMaterial, Material salvagedItemMaterial, int minimumLevel, int maximumQuantity)
|
||||
{
|
||||
|
||||
this.itemMaterial = itemMaterial;
|
||||
this.salvagedItemMaterial = salvagedItemMaterial;
|
||||
// this.salvageMetadata = salvageMetadata;
|
||||
this.salvageItemType = salvageItemType;
|
||||
this.salvageItemMaterialCategory = salvageItemMaterialCategory;
|
||||
this.salvageItemType = ItemUtils.determineItemType(itemMaterial);
|
||||
this.salvageItemMaterialCategory = ItemUtils.determineMaterialType(salvagedItemMaterial);
|
||||
this.minimumLevel = minimumLevel;
|
||||
this.maximumQuantity = maximumQuantity;
|
||||
this.maximumDurability = maximumDurability;
|
||||
this.maximumDurability = itemMaterial.getMaxDurability();
|
||||
this.baseSalvageDurability = (short) (maximumDurability / maximumQuantity);
|
||||
this.xpMultiplier = xpMultiplier;
|
||||
this.xpMultiplier = 1.0D;
|
||||
}
|
||||
|
||||
public Material getItemMaterial() {
|
||||
@ -55,10 +44,6 @@ public class Salvageable {
|
||||
return salvagedItemMaterial;
|
||||
}
|
||||
|
||||
/*public byte getSalvageMaterialMetadata() {
|
||||
return salvageMetadata;
|
||||
}*/
|
||||
|
||||
public ItemType getSalvageItemType() {
|
||||
return salvageItemType;
|
||||
}
|
||||
|
Reference in New Issue
Block a user