finished default repairables, diamond armor gives less xp by default

This commit is contained in:
nossr50 2019-03-22 16:04:31 -07:00
parent 968636b8d4
commit e232bb3699
20 changed files with 122 additions and 252 deletions

View File

@ -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) 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 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 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 Optimizations were made for many anti-exploit behaviours
Acrobatic's Dodge will no longer reward XP for a few seconds after a TP 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 Roll will not give XP for a few seconds after a TP

View File

@ -11,7 +11,7 @@
## Valid values are ARMOR, TOOL, and OTHER. ## Valid values are ARMOR, TOOL, and OTHER.
## This defaults to 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 ## Valid values are STRING, LEATHER, WOOD, STONE, IRON, GOLD, DIAMOND, and OTHER
## This defaults to OTHER. ## This defaults to OTHER.
# #

View File

@ -1,7 +1,7 @@
package com.gmail.nossr50.commands.skills; package com.gmail.nossr50.commands.skills;
import com.gmail.nossr50.config.AdvancedConfig; 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.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader; 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 net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.meta.Repairable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -80,13 +79,13 @@ public class RepairCommand extends SkillCommand {
canSuperRepair = canUseSubskill(player, SubSkillType.REPAIR_SUPER_REPAIR); canSuperRepair = canUseSubskill(player, SubSkillType.REPAIR_SUPER_REPAIR);
canMasterRepair = canUseSubskill(player, SubSkillType.REPAIR_REPAIR_MASTERY); canMasterRepair = canUseSubskill(player, SubSkillType.REPAIR_REPAIR_MASTERY);
canArcaneForge = canUseSubskill(player, SubSkillType.REPAIR_ARCANE_FORGING); canArcaneForge = canUseSubskill(player, SubSkillType.REPAIR_ARCANE_FORGING);
canRepairDiamond = Permissions.repairMaterialType(player, MaterialType.DIAMOND); canRepairDiamond = Permissions.repairMaterialType(player, ItemMaterialCategory.DIAMOND);
canRepairGold = Permissions.repairMaterialType(player, MaterialType.GOLD); canRepairGold = Permissions.repairMaterialType(player, ItemMaterialCategory.GOLD);
canRepairIron = Permissions.repairMaterialType(player, MaterialType.IRON); canRepairIron = Permissions.repairMaterialType(player, ItemMaterialCategory.IRON);
canRepairStone = Permissions.repairMaterialType(player, MaterialType.STONE); canRepairStone = Permissions.repairMaterialType(player, ItemMaterialCategory.STONE);
canRepairString = Permissions.repairMaterialType(player, MaterialType.STRING); canRepairString = Permissions.repairMaterialType(player, ItemMaterialCategory.STRING);
canRepairLeather = Permissions.repairMaterialType(player, MaterialType.LEATHER); canRepairLeather = Permissions.repairMaterialType(player, ItemMaterialCategory.LEATHER);
canRepairWood = Permissions.repairMaterialType(player, MaterialType.WOOD); canRepairWood = Permissions.repairMaterialType(player, ItemMaterialCategory.WOOD);
arcaneBypass = Permissions.arcaneBypass(player); arcaneBypass = Permissions.arcaneBypass(player);
} }

View File

@ -4,7 +4,7 @@ package com.gmail.nossr50.config.collectionconfigs;
import com.gmail.nossr50.config.ConfigCollection; import com.gmail.nossr50.config.ConfigCollection;
import com.gmail.nossr50.config.ConfigConstants; import com.gmail.nossr50.config.ConfigConstants;
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.ItemMaterialCategory;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.repair.repairables.Repairable; import com.gmail.nossr50.skills.repair.repairables.Repairable;
import com.gmail.nossr50.skills.repair.repairables.RepairableFactory; 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 REPAIRABLES = "Repairables";
public static final String ITEM_ID = "ItemId"; 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 REPAIR_MATERIAL = "RepairMaterial";
public static final String MAXIMUM_DURABILITY = "MaximumDurability"; public static final String MAXIMUM_DURABILITY = "MaximumDurability";
public static final String ITEM_TYPE = "ItemType"; public static final String ITEM_TYPE = "ItemType";
@ -88,38 +88,38 @@ public class RepairConfig extends ConfigCollection {
* Determine Repair Material Type * Determine Repair Material Type
*//* *//*
MaterialType repairMaterialType = MaterialType.OTHER; ItemMaterialCategory repairMaterialType = ItemMaterialCategory.OTHER;
String repairMaterialTypeString = getRepairMaterialTypeString(repairChildNodeName); String repairMaterialTypeString = getRepairMaterialTypeString(repairChildNodeName);
if (hasNode(REPAIRABLES, repairChildNodeName, MATERIAL_TYPE)) { if (hasNode(REPAIRABLES, repairChildNodeName, MATERIAL_TYPE)) {
ItemStack repairItem = new ItemStack(itemMaterial); ItemStack repairItem = new ItemStack(itemMaterial);
if (ItemUtils.isWoodTool(repairItem)) { if (ItemUtils.isWoodTool(repairItem)) {
repairMaterialType = MaterialType.WOOD; repairMaterialType = ItemMaterialCategory.WOOD;
} }
else if (ItemUtils.isStoneTool(repairItem)) { else if (ItemUtils.isStoneTool(repairItem)) {
repairMaterialType = MaterialType.STONE; repairMaterialType = ItemMaterialCategory.STONE;
} }
else if (ItemUtils.isStringTool(repairItem)) { else if (ItemUtils.isStringTool(repairItem)) {
repairMaterialType = MaterialType.STRING; repairMaterialType = ItemMaterialCategory.STRING;
} }
else if (ItemUtils.isLeatherArmor(repairItem)) { else if (ItemUtils.isLeatherArmor(repairItem)) {
repairMaterialType = MaterialType.LEATHER; repairMaterialType = ItemMaterialCategory.LEATHER;
} }
else if (ItemUtils.isIronArmor(repairItem) || ItemUtils.isIronTool(repairItem)) { else if (ItemUtils.isIronArmor(repairItem) || ItemUtils.isIronTool(repairItem)) {
repairMaterialType = MaterialType.IRON; repairMaterialType = ItemMaterialCategory.IRON;
} }
else if (ItemUtils.isGoldArmor(repairItem) || ItemUtils.isGoldTool(repairItem)) { else if (ItemUtils.isGoldArmor(repairItem) || ItemUtils.isGoldTool(repairItem)) {
repairMaterialType = MaterialType.GOLD; repairMaterialType = ItemMaterialCategory.GOLD;
} }
else if (ItemUtils.isDiamondArmor(repairItem) || ItemUtils.isDiamondTool(repairItem)) { else if (ItemUtils.isDiamondArmor(repairItem) || ItemUtils.isDiamondTool(repairItem)) {
repairMaterialType = MaterialType.DIAMOND; repairMaterialType = ItemMaterialCategory.DIAMOND;
} }
} }
else { else {
//If a material cannot be matched, try matching the material to its repair material type string from the config //If a material cannot be matched, try matching the material to its repair material type string from the config
try { try {
repairMaterialType = MaterialType.valueOf(repairMaterialTypeString.toUpperCase()); repairMaterialType = ItemMaterialCategory.valueOf(repairMaterialTypeString.toUpperCase());
} }
catch (IllegalArgumentException ex) { catch (IllegalArgumentException ex) {
errorMessages.add("Repair Config: " + repairChildNodeName + " has an invalid " + MATERIAL_TYPE + " of " + repairMaterialTypeString); errorMessages.add("Repair Config: " + repairChildNodeName + " has an invalid " + MATERIAL_TYPE + " of " + repairMaterialTypeString);

View File

@ -2,8 +2,8 @@ package com.gmail.nossr50.config.collectionconfigs;
import com.gmail.nossr50.config.ConfigCollection; import com.gmail.nossr50.config.ConfigCollection;
import com.gmail.nossr50.config.ConfigConstants; 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.ItemType;
import com.gmail.nossr50.datatypes.skills.MaterialType;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.skills.salvage.salvageables.Salvageable; import com.gmail.nossr50.skills.salvage.salvageables.Salvageable;
import com.gmail.nossr50.skills.salvage.salvageables.SalvageableFactory; import com.gmail.nossr50.skills.salvage.salvageables.SalvageableFactory;
@ -21,7 +21,7 @@ import java.util.List;
public class SalvageConfig extends ConfigCollection { public class SalvageConfig extends ConfigCollection {
public static final String SALVAGEABLES = "Salvageables"; 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 SALVAGE_MATERIAL = "SalvageMaterial";
public static final String MAXIMUM_DURABILITY = "MaximumDurability"; public static final String MAXIMUM_DURABILITY = "MaximumDurability";
public static final String ITEM_TYPE = "ItemType"; public static final String ITEM_TYPE = "ItemType";
@ -65,7 +65,7 @@ public class SalvageConfig extends ConfigCollection {
} }
// Salvage Material Type // Salvage Material Type
MaterialType salvageMaterialType = MaterialType.OTHER; ItemMaterialCategory salvageItemMaterialCategory = ItemMaterialCategory.OTHER;
String salvageMaterialTypeString; String salvageMaterialTypeString;
@ -78,31 +78,31 @@ public class SalvageConfig extends ConfigCollection {
ItemStack salvageItem = new ItemStack(itemMaterial); ItemStack salvageItem = new ItemStack(itemMaterial);
if (ItemUtils.isWoodTool(salvageItem)) { if (ItemUtils.isWoodTool(salvageItem)) {
salvageMaterialType = MaterialType.WOOD; salvageItemMaterialCategory = ItemMaterialCategory.WOOD;
} else if (ItemUtils.isStoneTool(salvageItem)) { } else if (ItemUtils.isStoneTool(salvageItem)) {
salvageMaterialType = MaterialType.STONE; salvageItemMaterialCategory = ItemMaterialCategory.STONE;
} else if (ItemUtils.isStringTool(salvageItem)) { } else if (ItemUtils.isStringTool(salvageItem)) {
salvageMaterialType = MaterialType.STRING; salvageItemMaterialCategory = ItemMaterialCategory.STRING;
} else if (ItemUtils.isLeatherArmor(salvageItem)) { } else if (ItemUtils.isLeatherArmor(salvageItem)) {
salvageMaterialType = MaterialType.LEATHER; salvageItemMaterialCategory = ItemMaterialCategory.LEATHER;
} else if (ItemUtils.isIronArmor(salvageItem) || ItemUtils.isIronTool(salvageItem)) { } else if (ItemUtils.isIronArmor(salvageItem) || ItemUtils.isIronTool(salvageItem)) {
salvageMaterialType = MaterialType.IRON; salvageItemMaterialCategory = ItemMaterialCategory.IRON;
} else if (ItemUtils.isGoldArmor(salvageItem) || ItemUtils.isGoldTool(salvageItem)) { } else if (ItemUtils.isGoldArmor(salvageItem) || ItemUtils.isGoldTool(salvageItem)) {
salvageMaterialType = MaterialType.GOLD; salvageItemMaterialCategory = ItemMaterialCategory.GOLD;
} else if (ItemUtils.isDiamondArmor(salvageItem) || ItemUtils.isDiamondTool(salvageItem)) { } else if (ItemUtils.isDiamondArmor(salvageItem) || ItemUtils.isDiamondTool(salvageItem)) {
salvageMaterialType = MaterialType.DIAMOND; salvageItemMaterialCategory = ItemMaterialCategory.DIAMOND;
} }
} else { } else {
try { try {
salvageMaterialType = MaterialType.valueOf(salvageMaterialTypeString.replace(" ", "_").toUpperCase()); salvageItemMaterialCategory = ItemMaterialCategory.valueOf(salvageMaterialTypeString.replace(" ", "_").toUpperCase());
} catch (IllegalArgumentException ex) { } 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 // Salvage Material
String salvageMaterialName = getStringValue(SALVAGEABLES, salvageChildNodeName, 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) { if (salvageMaterial == null) {
errorMessages.add(salvageChildNodeName + " has an invalid salvage material: " + salvageMaterialName); errorMessages.add(salvageChildNodeName + " has an invalid salvage material: " + salvageMaterialName);
@ -169,7 +169,7 @@ public class SalvageConfig extends ConfigCollection {
if(xpMultiplier < 0) if(xpMultiplier < 0)
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); genericCollection.add(salvageable);
for (String issue : errorMessages) { for (String issue : errorMessages) {

View File

@ -3,7 +3,7 @@ package com.gmail.nossr50.config.experience;
import com.gmail.nossr50.config.ConfigConstants; import com.gmail.nossr50.config.ConfigConstants;
import com.gmail.nossr50.config.ConfigValidated; import com.gmail.nossr50.config.ConfigValidated;
import com.gmail.nossr50.datatypes.experience.FormulaType; 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.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.alchemy.PotionStage; import com.gmail.nossr50.datatypes.skills.alchemy.PotionStage;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
@ -438,8 +438,8 @@ public class ExperienceConfig extends ConfigValidated {
return getDoubleValue(EXPERIENCE, REPAIR, BASE1); return getDoubleValue(EXPERIENCE, REPAIR, BASE1);
} }
public double getRepairXP(MaterialType repairMaterialType) { public double getRepairXP(ItemMaterialCategory repairItemMaterialCategory) {
return getDoubleValue(EXPERIENCE, REPAIR, StringUtils.getCapitalized(repairMaterialType.toString())); return getDoubleValue(EXPERIENCE, REPAIR, StringUtils.getCapitalized(repairItemMaterialCategory.toString()));
} }
/* Taming */ /* Taming */

View File

@ -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_AXE, Arrays.asList(PLANKS), 1, 0, .5D));
CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(WOODEN_HOE, Arrays.asList(PLANKS), 1, 0, .25D)); CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(WOODEN_HOE, Arrays.asList(PLANKS), 1, 0, .25D));
/* CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(STONE_SWORD, COBBLESTONE, 1, 0, .25D));
Repairables: CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(STONE_SHOVEL, COBBLESTONE, 1, 0, .15D));
# CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(STONE_PICKAXE, COBBLESTONE, 1, 0, .5D));
# Wooden repairables CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(STONE_AXE, COBBLESTONE, 1, 0, .5D));
### CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(STONE_HOE, COBBLESTONE, 1, 0, .25D));
# Tools
WOODEN_SWORD: CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(IRON_SWORD, IRON_INGOT, 1, 0, .5D));
MinimumLevel: 0 CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(IRON_SHOVEL, IRON_INGOT, 1, 0, .3D));
XpMultiplier: .25 CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(IRON_PICKAXE, IRON_INGOT, 1, 0, 1D));
WOODEN_SHOVEL: CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(IRON_AXE, IRON_INGOT, 1, 0, 1D));
MinimumLevel: 0 CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(IRON_HOE, IRON_INGOT, 1, 0, .5D));
XpMultiplier: .16
WOODEN_PICKAXE: CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(IRON_HELMET, IRON_INGOT, 1, 0, 2D));
MinimumLevel: 0 CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(IRON_CHESTPLATE, IRON_INGOT, 1, 0, 2D));
XpMultiplier: .5 CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(IRON_LEGGINGS, IRON_INGOT, 1, 0, 2D));
WOODEN_AXE: CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(IRON_BOOTS, IRON_INGOT, 1, 0, 2D));
MinimumLevel: 0
XpMultiplier: .5 CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(SHEARS, IRON_INGOT, 1, 0, .5D));
WOODEN_HOE: CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(FLINT_AND_STEEL, IRON_INGOT, 1, 0, .3D));
MinimumLevel: 0
XpMultiplier: .25 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));
# Stone repairables 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));
# Tools CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(GOLDEN_HOE, GOLD_INGOT, 1, 0, 4D));
STONE_SWORD:
MinimumLevel: 0 CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(GOLDEN_HELMET, GOLD_INGOT, 1, 0, 4D));
XpMultiplier: .25 CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(GOLDEN_CHESTPLATE, GOLD_INGOT, 1, 0, 4D));
STONE_SHOVEL: CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(GOLDEN_LEGGINGS, GOLD_INGOT, 1, 0, 4D));
MinimumLevel: 0 CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(GOLDEN_BOOTS, GOLD_INGOT, 1, 0, 4D));
XpMultiplier: .16
STONE_PICKAXE: CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(DIAMOND_SWORD, DIAMOND, 1, 0, .5D));
MinimumLevel: 0 CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(DIAMOND_SHOVEL, DIAMOND, 1, 0, .3D));
XpMultiplier: .5 CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(DIAMOND_PICKAXE, DIAMOND, 1, 0, 1D));
STONE_AXE: CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(DIAMOND_AXE, DIAMOND, 1, 0, 1D));
MinimumLevel: 0 CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(DIAMOND_HOE, DIAMOND, 1, 0, .5D));
XpMultiplier: .5
STONE_HOE: CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(DIAMOND_HELMET, DIAMOND, 1, 0, 2D));
MinimumLevel: 0 CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(DIAMOND_CHESTPLATE, DIAMOND, 1, 0, 2D));
XpMultiplier: .25 CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(DIAMOND_LEGGINGS, DIAMOND, 1, 0, 2D));
# CONFIG_REPAIRABLES_DEFAULTS.add(new SimpleRepairable(DIAMOND_BOOTS, DIAMOND, 1, 0, 2D));
# 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
*/
} }

View File

@ -1,7 +1,7 @@
//package com.gmail.nossr50.config.mods; //package com.gmail.nossr50.config.mods;
// //
//import com.gmail.nossr50.config.ConfigCollection; //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.mcMMO;
//import com.gmail.nossr50.skills.repair.repairables.Repairable; //import com.gmail.nossr50.skills.repair.repairables.Repairable;
//import com.gmail.nossr50.skills.repair.repairables.RepairableFactory; //import com.gmail.nossr50.skills.repair.repairables.RepairableFactory;
@ -102,7 +102,7 @@
// durability = (short) getIntValue(armorType + "." + armorName + ".Durability", 70); // 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); // materialList.add(armorMaterial);

View File

@ -86,7 +86,7 @@ public class CustomToolConfig extends Config {
durability = (short) getIntValue(toolType + "." + toolName + ".Durability", 60); 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); double multiplier = getDoubleValue(toolType + "." + toolName + ".XP_Modifier", 1.0);

View File

@ -2,7 +2,7 @@ package com.gmail.nossr50.datatypes.skills;
import org.bukkit.Material; import org.bukkit.Material;
public enum MaterialType { public enum ItemMaterialCategory {
STRING, STRING,
LEATHER, LEATHER,
WOOD, WOOD,

View File

@ -73,7 +73,7 @@ public class RepairManager extends SkillManager {
} }
// Permissions checks on material and item types // 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"); NotificationManager.sendPlayerInformation(player, NotificationType.NO_PERMISSION, "mcMMO.NoPermission");
return; return;
} }
@ -160,7 +160,7 @@ public class RepairManager extends SkillManager {
inventory.removeItem(toRemove); inventory.removeItem(toRemove);
// Give out XP like candy // 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 // BWONG BWONG BWONG
if (mcMMO.getConfigManager().getConfigRepair().getRepairGeneral().isAnvilUseSounds()) { if (mcMMO.getConfigManager().getConfigRepair().getRepairGeneral().isAnvilUseSounds()) {

View File

@ -2,7 +2,7 @@
package com.gmail.nossr50.skills.repair.repairables; package com.gmail.nossr50.skills.repair.repairables;
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.ItemMaterialCategory;
import org.bukkit.Material; import org.bukkit.Material;
@ -41,7 +41,7 @@ public interface Repairable {
* @return the RepairMaterialType for this repairable * @return the RepairMaterialType for this repairable
*//* *//*
public MaterialType getRepairMaterialType(); public ItemMaterialCategory getRepairItemMaterialCategory();
*/ */
/** /**

View File

@ -1,7 +1,7 @@
package com.gmail.nossr50.skills.repair.repairables; 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.ItemType;
import com.gmail.nossr50.datatypes.skills.MaterialType;
import com.gmail.nossr50.util.ItemUtils; import com.gmail.nossr50.util.ItemUtils;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -16,7 +16,7 @@ public class SimpleRepairable {
private final int minimumQuantity, minimumLevel; private final int minimumQuantity, minimumLevel;
private final short maximumDurability, baseRepairDurability; private final short maximumDurability, baseRepairDurability;
private final ItemType repairItemType; private final ItemType repairItemType;
private final MaterialType repairMaterialType; private final ItemMaterialCategory repairItemMaterialCategory;
private final double xpMultiplier; private final double xpMultiplier;
public SimpleRepairable(Material itemMaterial, Material repairMaterial, int minimumQuantity, int minimumLevel, 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.baseRepairDurability = (short) (maximumDurability / minimumQuantity);
this.repairItemType = determineItemType(this.itemMaterial); 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) { switch (material) {
case STRING: case STRING:
return MaterialType.STRING; return ItemMaterialCategory.STRING;
case LEATHER: case LEATHER:
return MaterialType.LEATHER; return ItemMaterialCategory.LEATHER;
case ACACIA_PLANKS: case ACACIA_PLANKS:
case BIRCH_PLANKS: case BIRCH_PLANKS:
@ -55,22 +55,22 @@ public class SimpleRepairable {
case JUNGLE_PLANKS: case JUNGLE_PLANKS:
case OAK_PLANKS: case OAK_PLANKS:
case SPRUCE_PLANKS: case SPRUCE_PLANKS:
return MaterialType.WOOD; return ItemMaterialCategory.WOOD;
case STONE: case STONE:
return MaterialType.STONE; return ItemMaterialCategory.STONE;
case IRON_INGOT: case IRON_INGOT:
return MaterialType.IRON; return ItemMaterialCategory.IRON;
case GOLD_INGOT: case GOLD_INGOT:
return MaterialType.GOLD; return ItemMaterialCategory.GOLD;
case DIAMOND: case DIAMOND:
return MaterialType.DIAMOND; return ItemMaterialCategory.DIAMOND;
default: default:
return MaterialType.OTHER; return ItemMaterialCategory.OTHER;
} }
} }
@ -103,8 +103,8 @@ public class SimpleRepairable {
return repairItemType; return repairItemType;
} }
public MaterialType getRepairMaterialType() { public ItemMaterialCategory getRepairItemMaterialCategory() {
return repairMaterialType; return repairItemMaterialCategory;
} }
public int getMinimumQuantity() { public int getMinimumQuantity() {

View File

@ -75,7 +75,7 @@ public class SalvageManager extends SkillManager {
return; return;
} }
if (!Permissions.salvageMaterialType(player, salvageable.getSalvageMaterialType())) { if (!Permissions.salvageMaterialType(player, salvageable.getSalvageItemMaterialCategory())) {
NotificationManager.sendPlayerInformation(player, NotificationType.NO_PERMISSION, "mcMMO.NoPermission"); NotificationManager.sendPlayerInformation(player, NotificationType.NO_PERMISSION, "mcMMO.NoPermission");
return; return;
} }

View File

@ -1,7 +1,7 @@
package com.gmail.nossr50.skills.salvage.salvageables; 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.ItemType;
import com.gmail.nossr50.datatypes.skills.MaterialType;
import org.bukkit.Material; import org.bukkit.Material;
public interface Salvageable { public interface Salvageable {
@ -34,11 +34,11 @@ public interface Salvageable {
public ItemType getSalvageItemType(); 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 * Gets the maximum quantity of salvage materials ignoring all other salvage bonuses

View File

@ -1,16 +1,16 @@
package com.gmail.nossr50.skills.salvage.salvageables; 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.ItemType;
import com.gmail.nossr50.datatypes.skills.MaterialType;
import org.bukkit.Material; import org.bukkit.Material;
public class SalvageableFactory { public class SalvageableFactory {
public static Salvageable getSalvageable(Material itemMaterial, Material repairMaterial, byte repairMetadata, int maximumQuantity, short maximumDurability) { 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. // 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);
} }
} }

View File

@ -1,7 +1,7 @@
package com.gmail.nossr50.skills.salvage.salvageables; 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.ItemType;
import com.gmail.nossr50.datatypes.skills.MaterialType;
import org.bukkit.Material; import org.bukkit.Material;
@ -11,15 +11,15 @@ public class SimpleSalvageable implements Salvageable {
private final short maximumDurability, baseSalvageDurability; private final short maximumDurability, baseSalvageDurability;
private final byte salvageMetadata; private final byte salvageMetadata;
private final ItemType salvageItemType; private final ItemType salvageItemType;
private final MaterialType salvageMaterialType; private final ItemMaterialCategory salvageItemMaterialCategory;
private final double xpMultiplier; 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.itemMaterial = type;
this.salvageMaterial = salvageMaterial; this.salvageMaterial = salvageMaterial;
this.salvageMetadata = salvageMetadata; this.salvageMetadata = salvageMetadata;
this.salvageItemType = salvageItemType; this.salvageItemType = salvageItemType;
this.salvageMaterialType = salvageMaterialType; this.salvageItemMaterialCategory = salvageItemMaterialCategory;
this.minimumLevel = minimumLevel; this.minimumLevel = minimumLevel;
this.maximumQuantity = maximumQuantity; this.maximumQuantity = maximumQuantity;
this.maximumDurability = maximumDurability; this.maximumDurability = maximumDurability;
@ -48,8 +48,8 @@ public class SimpleSalvageable implements Salvageable {
} }
@Override @Override
public MaterialType getSalvageMaterialType() { public ItemMaterialCategory getSalvageItemMaterialCategory() {
return salvageMaterialType; return salvageItemMaterialCategory;
} }
@Override @Override

View File

@ -1,8 +1,8 @@
package com.gmail.nossr50.util; package com.gmail.nossr50.util;
import com.gmail.nossr50.commands.party.PartySubcommandType; 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.ItemType;
import com.gmail.nossr50.datatypes.skills.MaterialType;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill; import com.gmail.nossr50.datatypes.skills.subskills.AbstractSubSkill;
@ -169,14 +169,14 @@ public final class Permissions {
/* REPAIR */ /* REPAIR */
public static boolean repairItemType(Permissible permissible, ItemType repairItemType) { return permissible.hasPermission("mcmmo.ability.repair." + repairItemType.toString().toLowerCase() + "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 */ /* SALVAGE */
public static boolean advancedSalvage(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.salvage.advancedsalvage"); } 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 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 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 */ /* SMELTING */
public static boolean fluxMining(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.smelting.fluxmining"); } public static boolean fluxMining(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.smelting.fluxmining"); }

View File

@ -10,7 +10,7 @@
## Valid values are ARMOR, TOOL, and OTHER. ## Valid values are ARMOR, TOOL, and OTHER.
## This defaults to 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 ## Valid values are STRING, LEATHER, WOOD, STONE, IRON, GOLD, DIAMOND, and OTHER
## This defaults to OTHER. ## This defaults to OTHER.
# #

View File

@ -10,7 +10,7 @@
## Valid values are ARMOR, TOOL, and OTHER. ## Valid values are ARMOR, TOOL, and OTHER.
## This defaults to 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 ## Valid values are STRING, LEATHER, WOOD, STONE, IRON, GOLD, DIAMOND, and OTHER
## This defaults to OTHER. ## This defaults to OTHER.
# #