mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 06:36:45 +01:00
finished default repairables, diamond armor gives less xp by default
This commit is contained in:
parent
968636b8d4
commit
e232bb3699
@ -14,6 +14,7 @@ Version 2.2.0
|
||||
You can now specify multiple repair-items for an item (such as specifying that a wooden sword can be repaired by all types of planks)
|
||||
Simplified the config entries for Repairables in the Repair config
|
||||
Repairables in the repair config now use their internal registry key names instead of Bukkit material names
|
||||
Diamond Armor XP multiplier vanilla config setting reduced from 6x -> 2x
|
||||
Optimizations were made for many anti-exploit behaviours
|
||||
Acrobatic's Dodge will no longer reward XP for a few seconds after a TP
|
||||
Roll will not give XP for a few seconds after a TP
|
||||
|
@ -11,7 +11,7 @@
|
||||
## Valid values are ARMOR, TOOL, and OTHER.
|
||||
## This defaults to OTHER.
|
||||
#
|
||||
# MaterialType: This is the type of the material of the item to be repaired, this is only important for permissions.
|
||||
# ItemMaterialCategory: This is the type of the material of the item to be repaired, this is only important for permissions.
|
||||
## Valid values are STRING, LEATHER, WOOD, STONE, IRON, GOLD, DIAMOND, and OTHER
|
||||
## This defaults to OTHER.
|
||||
#
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.gmail.nossr50.commands.skills;
|
||||
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||
import com.gmail.nossr50.datatypes.skills.ItemMaterialCategory;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
@ -17,7 +17,6 @@ import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.meta.Repairable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -80,13 +79,13 @@ public class RepairCommand extends SkillCommand {
|
||||
canSuperRepair = canUseSubskill(player, SubSkillType.REPAIR_SUPER_REPAIR);
|
||||
canMasterRepair = canUseSubskill(player, SubSkillType.REPAIR_REPAIR_MASTERY);
|
||||
canArcaneForge = canUseSubskill(player, SubSkillType.REPAIR_ARCANE_FORGING);
|
||||
canRepairDiamond = Permissions.repairMaterialType(player, MaterialType.DIAMOND);
|
||||
canRepairGold = Permissions.repairMaterialType(player, MaterialType.GOLD);
|
||||
canRepairIron = Permissions.repairMaterialType(player, MaterialType.IRON);
|
||||
canRepairStone = Permissions.repairMaterialType(player, MaterialType.STONE);
|
||||
canRepairString = Permissions.repairMaterialType(player, MaterialType.STRING);
|
||||
canRepairLeather = Permissions.repairMaterialType(player, MaterialType.LEATHER);
|
||||
canRepairWood = Permissions.repairMaterialType(player, MaterialType.WOOD);
|
||||
canRepairDiamond = Permissions.repairMaterialType(player, ItemMaterialCategory.DIAMOND);
|
||||
canRepairGold = Permissions.repairMaterialType(player, ItemMaterialCategory.GOLD);
|
||||
canRepairIron = Permissions.repairMaterialType(player, ItemMaterialCategory.IRON);
|
||||
canRepairStone = Permissions.repairMaterialType(player, ItemMaterialCategory.STONE);
|
||||
canRepairString = Permissions.repairMaterialType(player, ItemMaterialCategory.STRING);
|
||||
canRepairLeather = Permissions.repairMaterialType(player, ItemMaterialCategory.LEATHER);
|
||||
canRepairWood = Permissions.repairMaterialType(player, ItemMaterialCategory.WOOD);
|
||||
arcaneBypass = Permissions.arcaneBypass(player);
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ package com.gmail.nossr50.config.collectionconfigs;
|
||||
import com.gmail.nossr50.config.ConfigCollection;
|
||||
import com.gmail.nossr50.config.ConfigConstants;
|
||||
import com.gmail.nossr50.datatypes.skills.ItemType;
|
||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||
import com.gmail.nossr50.datatypes.skills.ItemMaterialCategory;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
||||
import com.gmail.nossr50.skills.repair.repairables.RepairableFactory;
|
||||
@ -28,7 +28,7 @@ public class RepairConfig extends ConfigCollection {
|
||||
|
||||
public static final String REPAIRABLES = "Repairables";
|
||||
public static final String ITEM_ID = "ItemId";
|
||||
public static final String MATERIAL_TYPE = "MaterialType";
|
||||
public static final String MATERIAL_TYPE = "ItemMaterialCategory";
|
||||
public static final String REPAIR_MATERIAL = "RepairMaterial";
|
||||
public static final String MAXIMUM_DURABILITY = "MaximumDurability";
|
||||
public static final String ITEM_TYPE = "ItemType";
|
||||
@ -88,38 +88,38 @@ public class RepairConfig extends ConfigCollection {
|
||||
* Determine Repair Material Type
|
||||
*//*
|
||||
|
||||
MaterialType repairMaterialType = MaterialType.OTHER;
|
||||
ItemMaterialCategory repairMaterialType = ItemMaterialCategory.OTHER;
|
||||
String repairMaterialTypeString = getRepairMaterialTypeString(repairChildNodeName);
|
||||
|
||||
if (hasNode(REPAIRABLES, repairChildNodeName, MATERIAL_TYPE)) {
|
||||
ItemStack repairItem = new ItemStack(itemMaterial);
|
||||
|
||||
if (ItemUtils.isWoodTool(repairItem)) {
|
||||
repairMaterialType = MaterialType.WOOD;
|
||||
repairMaterialType = ItemMaterialCategory.WOOD;
|
||||
}
|
||||
else if (ItemUtils.isStoneTool(repairItem)) {
|
||||
repairMaterialType = MaterialType.STONE;
|
||||
repairMaterialType = ItemMaterialCategory.STONE;
|
||||
}
|
||||
else if (ItemUtils.isStringTool(repairItem)) {
|
||||
repairMaterialType = MaterialType.STRING;
|
||||
repairMaterialType = ItemMaterialCategory.STRING;
|
||||
}
|
||||
else if (ItemUtils.isLeatherArmor(repairItem)) {
|
||||
repairMaterialType = MaterialType.LEATHER;
|
||||
repairMaterialType = ItemMaterialCategory.LEATHER;
|
||||
}
|
||||
else if (ItemUtils.isIronArmor(repairItem) || ItemUtils.isIronTool(repairItem)) {
|
||||
repairMaterialType = MaterialType.IRON;
|
||||
repairMaterialType = ItemMaterialCategory.IRON;
|
||||
}
|
||||
else if (ItemUtils.isGoldArmor(repairItem) || ItemUtils.isGoldTool(repairItem)) {
|
||||
repairMaterialType = MaterialType.GOLD;
|
||||
repairMaterialType = ItemMaterialCategory.GOLD;
|
||||
}
|
||||
else if (ItemUtils.isDiamondArmor(repairItem) || ItemUtils.isDiamondTool(repairItem)) {
|
||||
repairMaterialType = MaterialType.DIAMOND;
|
||||
repairMaterialType = ItemMaterialCategory.DIAMOND;
|
||||
}
|
||||
}
|
||||
else {
|
||||
//If a material cannot be matched, try matching the material to its repair material type string from the config
|
||||
try {
|
||||
repairMaterialType = MaterialType.valueOf(repairMaterialTypeString.toUpperCase());
|
||||
repairMaterialType = ItemMaterialCategory.valueOf(repairMaterialTypeString.toUpperCase());
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
errorMessages.add("Repair Config: " + repairChildNodeName + " has an invalid " + MATERIAL_TYPE + " of " + repairMaterialTypeString);
|
||||
|
@ -2,8 +2,8 @@ package com.gmail.nossr50.config.collectionconfigs;
|
||||
|
||||
import com.gmail.nossr50.config.ConfigCollection;
|
||||
import com.gmail.nossr50.config.ConfigConstants;
|
||||
import com.gmail.nossr50.datatypes.skills.ItemMaterialCategory;
|
||||
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;
|
||||
@ -21,7 +21,7 @@ import java.util.List;
|
||||
public class SalvageConfig extends ConfigCollection {
|
||||
|
||||
public static final String SALVAGEABLES = "Salvageables";
|
||||
public static final String MATERIAL_TYPE = "MaterialType";
|
||||
public static final String MATERIAL_TYPE = "ItemMaterialCategory";
|
||||
public static final String SALVAGE_MATERIAL = "SalvageMaterial";
|
||||
public static final String MAXIMUM_DURABILITY = "MaximumDurability";
|
||||
public static final String ITEM_TYPE = "ItemType";
|
||||
@ -65,7 +65,7 @@ public class SalvageConfig extends ConfigCollection {
|
||||
}
|
||||
|
||||
// Salvage Material Type
|
||||
MaterialType salvageMaterialType = MaterialType.OTHER;
|
||||
ItemMaterialCategory salvageItemMaterialCategory = ItemMaterialCategory.OTHER;
|
||||
|
||||
String salvageMaterialTypeString;
|
||||
|
||||
@ -78,31 +78,31 @@ public class SalvageConfig extends ConfigCollection {
|
||||
ItemStack salvageItem = new ItemStack(itemMaterial);
|
||||
|
||||
if (ItemUtils.isWoodTool(salvageItem)) {
|
||||
salvageMaterialType = MaterialType.WOOD;
|
||||
salvageItemMaterialCategory = ItemMaterialCategory.WOOD;
|
||||
} else if (ItemUtils.isStoneTool(salvageItem)) {
|
||||
salvageMaterialType = MaterialType.STONE;
|
||||
salvageItemMaterialCategory = ItemMaterialCategory.STONE;
|
||||
} else if (ItemUtils.isStringTool(salvageItem)) {
|
||||
salvageMaterialType = MaterialType.STRING;
|
||||
salvageItemMaterialCategory = ItemMaterialCategory.STRING;
|
||||
} else if (ItemUtils.isLeatherArmor(salvageItem)) {
|
||||
salvageMaterialType = MaterialType.LEATHER;
|
||||
salvageItemMaterialCategory = ItemMaterialCategory.LEATHER;
|
||||
} else if (ItemUtils.isIronArmor(salvageItem) || ItemUtils.isIronTool(salvageItem)) {
|
||||
salvageMaterialType = MaterialType.IRON;
|
||||
salvageItemMaterialCategory = ItemMaterialCategory.IRON;
|
||||
} else if (ItemUtils.isGoldArmor(salvageItem) || ItemUtils.isGoldTool(salvageItem)) {
|
||||
salvageMaterialType = MaterialType.GOLD;
|
||||
salvageItemMaterialCategory = ItemMaterialCategory.GOLD;
|
||||
} else if (ItemUtils.isDiamondArmor(salvageItem) || ItemUtils.isDiamondTool(salvageItem)) {
|
||||
salvageMaterialType = MaterialType.DIAMOND;
|
||||
salvageItemMaterialCategory = ItemMaterialCategory.DIAMOND;
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
salvageMaterialType = MaterialType.valueOf(salvageMaterialTypeString.replace(" ", "_").toUpperCase());
|
||||
salvageItemMaterialCategory = ItemMaterialCategory.valueOf(salvageMaterialTypeString.replace(" ", "_").toUpperCase());
|
||||
} catch (IllegalArgumentException ex) {
|
||||
errorMessages.add("Salvage Config: " + salvageChildNodeName + " has an invalid MaterialType of " + salvageMaterialTypeString);
|
||||
errorMessages.add("Salvage Config: " + salvageChildNodeName + " has an invalid ItemMaterialCategory of " + salvageMaterialTypeString);
|
||||
}
|
||||
}
|
||||
|
||||
// Salvage Material
|
||||
String salvageMaterialName = getStringValue(SALVAGEABLES, salvageChildNodeName, SALVAGE_MATERIAL);
|
||||
Material salvageMaterial = (salvageMaterialName == null ? salvageMaterialType.getDefaultMaterial() : Material.matchMaterial(salvageMaterialName));
|
||||
Material salvageMaterial = (salvageMaterialName == null ? salvageItemMaterialCategory.getDefaultMaterial() : Material.matchMaterial(salvageMaterialName));
|
||||
|
||||
if (salvageMaterial == null) {
|
||||
errorMessages.add(salvageChildNodeName + " has an invalid salvage material: " + salvageMaterialName);
|
||||
@ -169,7 +169,7 @@ public class SalvageConfig extends ConfigCollection {
|
||||
if(xpMultiplier < 0)
|
||||
xpMultiplier = 0;
|
||||
|
||||
Salvageable salvageable = SalvageableFactory.getSalvageable(itemMaterial, salvageMaterial, salvageMetadata, minimumLevel, maximumQuantity, maximumDurability, salvageItemType, salvageMaterialType, xpMultiplier);
|
||||
Salvageable salvageable = SalvageableFactory.getSalvageable(itemMaterial, salvageMaterial, salvageMetadata, minimumLevel, maximumQuantity, maximumDurability, salvageItemType, salvageItemMaterialCategory, xpMultiplier);
|
||||
genericCollection.add(salvageable);
|
||||
|
||||
for (String issue : errorMessages) {
|
||||
|
@ -3,7 +3,7 @@ package com.gmail.nossr50.config.experience;
|
||||
import com.gmail.nossr50.config.ConfigConstants;
|
||||
import com.gmail.nossr50.config.ConfigValidated;
|
||||
import com.gmail.nossr50.datatypes.experience.FormulaType;
|
||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||
import com.gmail.nossr50.datatypes.skills.ItemMaterialCategory;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.alchemy.PotionStage;
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
@ -438,8 +438,8 @@ public class ExperienceConfig extends ConfigValidated {
|
||||
return getDoubleValue(EXPERIENCE, REPAIR, BASE1);
|
||||
}
|
||||
|
||||
public double getRepairXP(MaterialType repairMaterialType) {
|
||||
return getDoubleValue(EXPERIENCE, REPAIR, StringUtils.getCapitalized(repairMaterialType.toString()));
|
||||
public double getRepairXP(ItemMaterialCategory repairItemMaterialCategory) {
|
||||
return getDoubleValue(EXPERIENCE, REPAIR, StringUtils.getCapitalized(repairItemMaterialCategory.toString()));
|
||||
}
|
||||
|
||||
/* Taming */
|
||||
|
@ -26,178 +26,48 @@ public class ConfigRepair {
|
||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(WOODEN_AXE, Arrays.asList(PLANKS), 1, 0, .5D));
|
||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(WOODEN_HOE, Arrays.asList(PLANKS), 1, 0, .25D));
|
||||
|
||||
/*
|
||||
Repairables:
|
||||
#
|
||||
# Wooden repairables
|
||||
###
|
||||
# Tools
|
||||
WOODEN_SWORD:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: .25
|
||||
WOODEN_SHOVEL:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: .16
|
||||
WOODEN_PICKAXE:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: .5
|
||||
WOODEN_AXE:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: .5
|
||||
WOODEN_HOE:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: .25
|
||||
#
|
||||
# Stone repairables
|
||||
###
|
||||
# Tools
|
||||
STONE_SWORD:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: .25
|
||||
STONE_SHOVEL:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: .16
|
||||
STONE_PICKAXE:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: .5
|
||||
STONE_AXE:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: .5
|
||||
STONE_HOE:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: .25
|
||||
#
|
||||
# Iron repairables
|
||||
###
|
||||
# Tools
|
||||
IRON_SWORD:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: .5
|
||||
IRON_SHOVEL:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: .3
|
||||
IRON_PICKAXE:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: 1
|
||||
IRON_AXE:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: 1
|
||||
IRON_HOE:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: .5
|
||||
SHEARS:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: .5
|
||||
FLINT_AND_STEEL:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: .3
|
||||
# Armor
|
||||
IRON_HELMET:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: 2
|
||||
IRON_CHESTPLATE:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: 2
|
||||
IRON_LEGGINGS:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: 2
|
||||
IRON_BOOTS:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: 2
|
||||
#
|
||||
# Gold repairables
|
||||
###
|
||||
# Tools
|
||||
GOLDEN_SWORD:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: 4
|
||||
GOLDEN_SHOVEL:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: 2.6
|
||||
GOLDEN_PICKAXE:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: 8
|
||||
GOLDEN_AXE:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: 8
|
||||
GOLDEN_HOE:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: 4
|
||||
# Armor
|
||||
GOLDEN_HELMET:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: 4
|
||||
GOLDEN_CHESTPLATE:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: 4
|
||||
GOLDEN_LEGGINGS:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: 4
|
||||
GOLDEN_BOOTS:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: 4
|
||||
#
|
||||
# Diamond repairables
|
||||
###
|
||||
# Tools
|
||||
DIAMOND_SWORD:
|
||||
MinimumLevel: 50
|
||||
XpMultiplier: .5
|
||||
DIAMOND_SHOVEL:
|
||||
MinimumLevel: 50
|
||||
XpMultiplier: .3
|
||||
DIAMOND_PICKAXE:
|
||||
MinimumLevel: 50
|
||||
XpMultiplier: 1
|
||||
DIAMOND_AXE:
|
||||
MinimumLevel: 50
|
||||
XpMultiplier: 1
|
||||
DIAMOND_HOE:
|
||||
MinimumLevel: 50
|
||||
XpMultiplier: .5
|
||||
# Armor
|
||||
DIAMOND_HELMET:
|
||||
MinimumLevel: 50
|
||||
XpMultiplier: 6
|
||||
DIAMOND_CHESTPLATE:
|
||||
MinimumLevel: 50
|
||||
XpMultiplier: 6
|
||||
DIAMOND_LEGGINGS:
|
||||
MinimumLevel: 50
|
||||
XpMultiplier: 6
|
||||
DIAMOND_BOOTS:
|
||||
MinimumLevel: 50
|
||||
XpMultiplier: 6
|
||||
#
|
||||
# Leather repairables
|
||||
###
|
||||
# Armor
|
||||
LEATHER_HELMET:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: 1
|
||||
LEATHER_CHESTPLATE:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: 1
|
||||
LEATHER_LEGGINGS:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: 1
|
||||
LEATHER_BOOTS:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: 1
|
||||
#
|
||||
# String repairables
|
||||
###
|
||||
# Tools
|
||||
FISHING_ROD:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: .5
|
||||
BOW:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: .5
|
||||
CARROT_ON_A_STICK:
|
||||
MinimumLevel: 0
|
||||
XpMultiplier: .5
|
||||
*/
|
||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(STONE_SWORD, COBBLESTONE, 1, 0, .25D));
|
||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(STONE_SHOVEL, COBBLESTONE, 1, 0, .15D));
|
||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(STONE_PICKAXE, COBBLESTONE, 1, 0, .5D));
|
||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(STONE_AXE, COBBLESTONE, 1, 0, .5D));
|
||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(STONE_HOE, COBBLESTONE, 1, 0, .25D));
|
||||
|
||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(IRON_SWORD, IRON_INGOT, 1, 0, .5D));
|
||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(IRON_SHOVEL, IRON_INGOT, 1, 0, .3D));
|
||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(IRON_PICKAXE, IRON_INGOT, 1, 0, 1D));
|
||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(IRON_AXE, IRON_INGOT, 1, 0, 1D));
|
||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(IRON_HOE, IRON_INGOT, 1, 0, .5D));
|
||||
|
||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(IRON_HELMET, IRON_INGOT, 1, 0, 2D));
|
||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(IRON_CHESTPLATE, IRON_INGOT, 1, 0, 2D));
|
||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(IRON_LEGGINGS, IRON_INGOT, 1, 0, 2D));
|
||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(IRON_BOOTS, IRON_INGOT, 1, 0, 2D));
|
||||
|
||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(SHEARS, IRON_INGOT, 1, 0, .5D));
|
||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(FLINT_AND_STEEL, IRON_INGOT, 1, 0, .3D));
|
||||
|
||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(GOLDEN_SWORD, GOLD_INGOT, 1, 0, 4D));
|
||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(GOLDEN_SHOVEL, GOLD_INGOT, 1, 0, 2.6D));
|
||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(GOLDEN_PICKAXE, GOLD_INGOT, 1, 0, 8D));
|
||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(GOLDEN_AXE, GOLD_INGOT, 1, 0, 8D));
|
||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(GOLDEN_HOE, GOLD_INGOT, 1, 0, 4D));
|
||||
|
||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(GOLDEN_HELMET, GOLD_INGOT, 1, 0, 4D));
|
||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(GOLDEN_CHESTPLATE, GOLD_INGOT, 1, 0, 4D));
|
||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(GOLDEN_LEGGINGS, GOLD_INGOT, 1, 0, 4D));
|
||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(GOLDEN_BOOTS, GOLD_INGOT, 1, 0, 4D));
|
||||
|
||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(DIAMOND_SWORD, DIAMOND, 1, 0, .5D));
|
||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(DIAMOND_SHOVEL, DIAMOND, 1, 0, .3D));
|
||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(DIAMOND_PICKAXE, DIAMOND, 1, 0, 1D));
|
||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(DIAMOND_AXE, DIAMOND, 1, 0, 1D));
|
||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(DIAMOND_HOE, DIAMOND, 1, 0, .5D));
|
||||
|
||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(DIAMOND_HELMET, DIAMOND, 1, 0, 2D));
|
||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(DIAMOND_CHESTPLATE, DIAMOND, 1, 0, 2D));
|
||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(DIAMOND_LEGGINGS, DIAMOND, 1, 0, 2D));
|
||||
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(DIAMOND_BOOTS, DIAMOND, 1, 0, 2D));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
//package com.gmail.nossr50.config.mods;
|
||||
//
|
||||
//import com.gmail.nossr50.config.ConfigCollection;
|
||||
//import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||
//import com.gmail.nossr50.datatypes.skills.ItemMaterialCategory;
|
||||
//import com.gmail.nossr50.mcMMO;
|
||||
//import com.gmail.nossr50.skills.repair.repairables.Repairable;
|
||||
//import com.gmail.nossr50.skills.repair.repairables.RepairableFactory;
|
||||
@ -102,7 +102,7 @@
|
||||
// durability = (short) getIntValue(armorType + "." + armorName + ".Durability", 70);
|
||||
// }
|
||||
//
|
||||
// repairables.add(RepairableFactory.getRepairable(armorMaterial, repairMaterial, repairData, repairItemName, repairMinimumLevel, repairQuantity, durability, ConfigItemCategory.ARMOR, MaterialType.OTHER, repairXpMultiplier));
|
||||
// repairables.add(RepairableFactory.getRepairable(armorMaterial, repairMaterial, repairData, repairItemName, repairMinimumLevel, repairQuantity, durability, ConfigItemCategory.ARMOR, ItemMaterialCategory.OTHER, repairXpMultiplier));
|
||||
// }
|
||||
//
|
||||
// materialList.add(armorMaterial);
|
||||
|
@ -86,7 +86,7 @@ public class CustomToolConfig extends Config {
|
||||
durability = (short) getIntValue(toolType + "." + toolName + ".Durability", 60);
|
||||
}
|
||||
|
||||
repairables.add(RepairableFactory.getRepairable(toolMaterial, repairMaterial, repairData, repairItemName, repairMinimumLevel, repairQuantity, durability, ItemType.TOOL, MaterialType.OTHER, repairXpMultiplier));
|
||||
repairables.add(RepairableFactory.getRepairable(toolMaterial, repairMaterial, repairData, repairItemName, repairMinimumLevel, repairQuantity, durability, ItemType.TOOL, ItemMaterialCategory.OTHER, repairXpMultiplier));
|
||||
}
|
||||
|
||||
double multiplier = getDoubleValue(toolType + "." + toolName + ".XP_Modifier", 1.0);
|
||||
|
@ -2,7 +2,7 @@ package com.gmail.nossr50.datatypes.skills;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
public enum MaterialType {
|
||||
public enum ItemMaterialCategory {
|
||||
STRING,
|
||||
LEATHER,
|
||||
WOOD,
|
@ -73,7 +73,7 @@ public class RepairManager extends SkillManager {
|
||||
}
|
||||
|
||||
// Permissions checks on material and item types
|
||||
if (!Permissions.repairMaterialType(player, repairable.getRepairMaterialType())) {
|
||||
if (!Permissions.repairMaterialType(player, repairable.getRepairItemMaterialCategory())) {
|
||||
NotificationManager.sendPlayerInformation(player, NotificationType.NO_PERMISSION, "mcMMO.NoPermission");
|
||||
return;
|
||||
}
|
||||
@ -160,7 +160,7 @@ public class RepairManager extends SkillManager {
|
||||
inventory.removeItem(toRemove);
|
||||
|
||||
// Give out XP like candy
|
||||
applyXpGain((float) ((getPercentageRepaired(startDurability, newDurability, repairable.getMaximumDurability()) * repairable.getXpMultiplier()) * ExperienceConfig.getInstance().getRepairXPBase() * ExperienceConfig.getInstance().getRepairXP(repairable.getRepairMaterialType())), XPGainReason.PVE);
|
||||
applyXpGain((float) ((getPercentageRepaired(startDurability, newDurability, repairable.getMaximumDurability()) * repairable.getXpMultiplier()) * ExperienceConfig.getInstance().getRepairXPBase() * ExperienceConfig.getInstance().getRepairXP(repairable.getRepairItemMaterialCategory())), XPGainReason.PVE);
|
||||
|
||||
// BWONG BWONG BWONG
|
||||
if (mcMMO.getConfigManager().getConfigRepair().getRepairGeneral().isAnvilUseSounds()) {
|
||||
|
@ -2,7 +2,7 @@
|
||||
package com.gmail.nossr50.skills.repair.repairables;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.ItemType;
|
||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||
import com.gmail.nossr50.datatypes.skills.ItemMaterialCategory;
|
||||
import org.bukkit.Material;
|
||||
|
||||
|
||||
@ -41,7 +41,7 @@ public interface Repairable {
|
||||
* @return the RepairMaterialType for this repairable
|
||||
*//*
|
||||
|
||||
public MaterialType getRepairMaterialType();
|
||||
public ItemMaterialCategory getRepairItemMaterialCategory();
|
||||
|
||||
*/
|
||||
/**
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.gmail.nossr50.skills.repair.repairables;
|
||||
|
||||
import com.gmail.nossr50.datatypes.skills.ItemMaterialCategory;
|
||||
import com.gmail.nossr50.datatypes.skills.ItemType;
|
||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||
import com.gmail.nossr50.util.ItemUtils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -16,7 +16,7 @@ public class SimpleRepairable {
|
||||
private final int minimumQuantity, minimumLevel;
|
||||
private final short maximumDurability, baseRepairDurability;
|
||||
private final ItemType repairItemType;
|
||||
private final MaterialType repairMaterialType;
|
||||
private final ItemMaterialCategory repairItemMaterialCategory;
|
||||
private final double xpMultiplier;
|
||||
|
||||
public SimpleRepairable(Material itemMaterial, Material repairMaterial, int minimumQuantity, int minimumLevel, double xpMultiplier) {
|
||||
@ -38,16 +38,16 @@ public class SimpleRepairable {
|
||||
this.baseRepairDurability = (short) (maximumDurability / minimumQuantity);
|
||||
|
||||
this.repairItemType = determineItemType(this.itemMaterial);
|
||||
this.repairMaterialType = determineMaterialType(this.repairMaterials.get(0));
|
||||
this.repairItemMaterialCategory = determineMaterialType(this.repairMaterials.get(0));
|
||||
}
|
||||
|
||||
public MaterialType determineMaterialType(Material material) {
|
||||
public ItemMaterialCategory determineMaterialType(Material material) {
|
||||
switch (material) {
|
||||
case STRING:
|
||||
return MaterialType.STRING;
|
||||
return ItemMaterialCategory.STRING;
|
||||
|
||||
case LEATHER:
|
||||
return MaterialType.LEATHER;
|
||||
return ItemMaterialCategory.LEATHER;
|
||||
|
||||
case ACACIA_PLANKS:
|
||||
case BIRCH_PLANKS:
|
||||
@ -55,22 +55,22 @@ public class SimpleRepairable {
|
||||
case JUNGLE_PLANKS:
|
||||
case OAK_PLANKS:
|
||||
case SPRUCE_PLANKS:
|
||||
return MaterialType.WOOD;
|
||||
return ItemMaterialCategory.WOOD;
|
||||
|
||||
case STONE:
|
||||
return MaterialType.STONE;
|
||||
return ItemMaterialCategory.STONE;
|
||||
|
||||
case IRON_INGOT:
|
||||
return MaterialType.IRON;
|
||||
return ItemMaterialCategory.IRON;
|
||||
|
||||
case GOLD_INGOT:
|
||||
return MaterialType.GOLD;
|
||||
return ItemMaterialCategory.GOLD;
|
||||
|
||||
case DIAMOND:
|
||||
return MaterialType.DIAMOND;
|
||||
return ItemMaterialCategory.DIAMOND;
|
||||
|
||||
default:
|
||||
return MaterialType.OTHER;
|
||||
return ItemMaterialCategory.OTHER;
|
||||
}
|
||||
}
|
||||
|
||||
@ -103,8 +103,8 @@ public class SimpleRepairable {
|
||||
return repairItemType;
|
||||
}
|
||||
|
||||
public MaterialType getRepairMaterialType() {
|
||||
return repairMaterialType;
|
||||
public ItemMaterialCategory getRepairItemMaterialCategory() {
|
||||
return repairItemMaterialCategory;
|
||||
}
|
||||
|
||||
public int getMinimumQuantity() {
|
||||
|
@ -75,7 +75,7 @@ public class SalvageManager extends SkillManager {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Permissions.salvageMaterialType(player, salvageable.getSalvageMaterialType())) {
|
||||
if (!Permissions.salvageMaterialType(player, salvageable.getSalvageItemMaterialCategory())) {
|
||||
NotificationManager.sendPlayerInformation(player, NotificationType.NO_PERMISSION, "mcMMO.NoPermission");
|
||||
return;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
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.datatypes.skills.MaterialType;
|
||||
import org.bukkit.Material;
|
||||
|
||||
public interface Salvageable {
|
||||
@ -34,11 +34,11 @@ public interface Salvageable {
|
||||
public ItemType getSalvageItemType();
|
||||
|
||||
/**
|
||||
* Gets the MaterialType value for this salvageable item
|
||||
* Gets the ItemMaterialCategory value for this salvageable item
|
||||
*
|
||||
* @return the MaterialType for this salvageable
|
||||
* @return the ItemMaterialCategory for this salvageable
|
||||
*/
|
||||
public MaterialType getSalvageMaterialType();
|
||||
public ItemMaterialCategory getSalvageItemMaterialCategory();
|
||||
|
||||
/**
|
||||
* Gets the maximum quantity of salvage materials ignoring all other salvage bonuses
|
||||
|
@ -1,16 +1,16 @@
|
||||
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.datatypes.skills.MaterialType;
|
||||
import org.bukkit.Material;
|
||||
|
||||
public class SalvageableFactory {
|
||||
public static Salvageable getSalvageable(Material itemMaterial, Material repairMaterial, byte repairMetadata, int maximumQuantity, short maximumDurability) {
|
||||
return getSalvageable(itemMaterial, repairMaterial, repairMetadata, 0, maximumQuantity, maximumDurability, ItemType.OTHER, MaterialType.OTHER, 1);
|
||||
return getSalvageable(itemMaterial, repairMaterial, repairMetadata, 0, maximumQuantity, maximumDurability, ItemType.OTHER, ItemMaterialCategory.OTHER, 1);
|
||||
}
|
||||
|
||||
public static Salvageable getSalvageable(Material itemMaterial, Material repairMaterial, byte repairMetadata, int minimumLevel, int maximumQuantity, short maximumDurability, ItemType repairItemType, MaterialType repairMaterialType, double xpMultiplier) {
|
||||
public static Salvageable getSalvageable(Material itemMaterial, Material repairMaterial, byte repairMetadata, int minimumLevel, int maximumQuantity, short maximumDurability, ItemType repairItemType, ItemMaterialCategory repairItemMaterialCategory, double xpMultiplier) {
|
||||
// TODO: Add in loading from config what type of repairable we want.
|
||||
return new SimpleSalvageable(itemMaterial, repairMaterial, repairMetadata, minimumLevel, maximumQuantity, maximumDurability, repairItemType, repairMaterialType, xpMultiplier);
|
||||
return new SimpleSalvageable(itemMaterial, repairMaterial, repairMetadata, minimumLevel, maximumQuantity, maximumDurability, repairItemType, repairItemMaterialCategory, xpMultiplier);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
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.datatypes.skills.MaterialType;
|
||||
import org.bukkit.Material;
|
||||
|
||||
|
||||
@ -11,15 +11,15 @@ public class SimpleSalvageable implements Salvageable {
|
||||
private final short maximumDurability, baseSalvageDurability;
|
||||
private final byte salvageMetadata;
|
||||
private final ItemType salvageItemType;
|
||||
private final MaterialType salvageMaterialType;
|
||||
private final ItemMaterialCategory salvageItemMaterialCategory;
|
||||
private final double xpMultiplier;
|
||||
|
||||
protected SimpleSalvageable(Material type, Material salvageMaterial, byte salvageMetadata, int minimumLevel, int maximumQuantity, short maximumDurability, ItemType salvageItemType, MaterialType salvageMaterialType, double xpMultiplier) {
|
||||
protected SimpleSalvageable(Material type, Material salvageMaterial, byte salvageMetadata, int minimumLevel, int maximumQuantity, short maximumDurability, ItemType salvageItemType, ItemMaterialCategory salvageItemMaterialCategory, double xpMultiplier) {
|
||||
this.itemMaterial = type;
|
||||
this.salvageMaterial = salvageMaterial;
|
||||
this.salvageMetadata = salvageMetadata;
|
||||
this.salvageItemType = salvageItemType;
|
||||
this.salvageMaterialType = salvageMaterialType;
|
||||
this.salvageItemMaterialCategory = salvageItemMaterialCategory;
|
||||
this.minimumLevel = minimumLevel;
|
||||
this.maximumQuantity = maximumQuantity;
|
||||
this.maximumDurability = maximumDurability;
|
||||
@ -48,8 +48,8 @@ public class SimpleSalvageable implements Salvageable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public MaterialType getSalvageMaterialType() {
|
||||
return salvageMaterialType;
|
||||
public ItemMaterialCategory getSalvageItemMaterialCategory() {
|
||||
return salvageItemMaterialCategory;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,8 +1,8 @@
|
||||
package com.gmail.nossr50.util;
|
||||
|
||||
import com.gmail.nossr50.commands.party.PartySubcommandType;
|
||||
import com.gmail.nossr50.datatypes.skills.ItemMaterialCategory;
|
||||
import com.gmail.nossr50.datatypes.skills.ItemType;
|
||||
import com.gmail.nossr50.datatypes.skills.MaterialType;
|
||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
|
||||
@ -169,14 +169,14 @@ public final class Permissions {
|
||||
|
||||
/* REPAIR */
|
||||
public static boolean repairItemType(Permissible permissible, ItemType repairItemType) { return permissible.hasPermission("mcmmo.ability.repair." + repairItemType.toString().toLowerCase() + "repair"); }
|
||||
public static boolean repairMaterialType(Permissible permissible, MaterialType repairMaterialType) { return permissible.hasPermission("mcmmo.ability.repair." + repairMaterialType.toString().toLowerCase() + "repair"); }
|
||||
public static boolean repairMaterialType(Permissible permissible, ItemMaterialCategory repairItemMaterialCategory) { return permissible.hasPermission("mcmmo.ability.repair." + repairItemMaterialCategory.toString().toLowerCase() + "repair"); }
|
||||
|
||||
/* SALVAGE */
|
||||
public static boolean advancedSalvage(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.salvage.advancedsalvage"); }
|
||||
public static boolean arcaneSalvage(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.salvage.arcanesalvage"); }
|
||||
|
||||
public static boolean salvageItemType(Permissible permissible, ItemType salvageItemType) { return permissible.hasPermission("mcmmo.ability.salvage." + salvageItemType.toString().toLowerCase() + "salvage"); }
|
||||
public static boolean salvageMaterialType(Permissible permissible, MaterialType salvageMaterialType) { return permissible.hasPermission("mcmmo.ability.salvage." + salvageMaterialType.toString().toLowerCase() + "salvage"); }
|
||||
public static boolean salvageMaterialType(Permissible permissible, ItemMaterialCategory salvageItemMaterialCategory) { return permissible.hasPermission("mcmmo.ability.salvage." + salvageItemMaterialCategory.toString().toLowerCase() + "salvage"); }
|
||||
|
||||
/* SMELTING */
|
||||
public static boolean fluxMining(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.smelting.fluxmining"); }
|
||||
|
@ -10,7 +10,7 @@
|
||||
## Valid values are ARMOR, TOOL, and OTHER.
|
||||
## This defaults to OTHER.
|
||||
#
|
||||
# MaterialType: This is the type of the material of the item to be repaired, this is only important for permissions.
|
||||
# ItemMaterialCategory: This is the type of the material of the item to be repaired, this is only important for permissions.
|
||||
## Valid values are STRING, LEATHER, WOOD, STONE, IRON, GOLD, DIAMOND, and OTHER
|
||||
## This defaults to OTHER.
|
||||
#
|
||||
|
@ -10,7 +10,7 @@
|
||||
## Valid values are ARMOR, TOOL, and OTHER.
|
||||
## This defaults to OTHER.
|
||||
#
|
||||
# MaterialType: This is the type of the material of the item to be salvaged, this is only important for permissions.
|
||||
# ItemMaterialCategory: This is the type of the material of the item to be salvaged, this is only important for permissions.
|
||||
## Valid values are STRING, LEATHER, WOOD, STONE, IRON, GOLD, DIAMOND, and OTHER
|
||||
## This defaults to OTHER.
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user