Repair no longer consumes items with item lore + Fixing logic errors in repair.

This commit is contained in:
nossr50 2019-04-16 11:17:56 -07:00
parent bbd43e156a
commit 30bc73be7d
4 changed files with 28 additions and 5 deletions

View File

@ -13,6 +13,8 @@ Version 2.2.0
mcMMO will now warn you in the console if it thinks you are running incompatible server software
Parties no longer have a cap, you can level them forever for bragging rights
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)
Repair no longer consumes materials with item lore, players are informed that they cannot repair with that material if its the only matching repair material in their inventory
Added new locale string - Repair.NoBasicRepairMatsFound
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

View File

@ -32,9 +32,9 @@ public class ConfigExperienceRepair {
@Setting(value = "Repair-XP-Base", comment = "The base amount of XP for repairing an item." +
"\nThe repair XP formula is a simple multiplication of these 4 values in this order" +
"\nThe amount repair (0.0 to 1.0)" +
"\nThe item XP multiplier defined in the Repair config" +
"\nThe Base Repair XP defined here (default 1000.0D)" +
"\nThe % amount repaired (0.0 to 1.0)" +
"\nThe Item XP multiplier defined in the Repair config (not this config)" +
"\nThe Base Repair XP defined here (default 1000.0)" +
"\nAnd finally, the XP multiplier of the item material category defined in this config." +
"\nDefault value: "+REPAIR_XP_BASE_DEFAULT)
private double repairXPBase = REPAIR_XP_BASE_DEFAULT;

View File

@ -94,14 +94,34 @@ public class RepairManager extends SkillManager {
PlayerInventory inventory = player.getInventory();
Material repairMaterial = null;
boolean foundNonBasicMaterial = false;
//Find the first compatible repair material
for(Material repairMaterialCandidate : repairable.getRepairMaterials())
{
if(player.getInventory().contains(new ItemStack(repairMaterialCandidate)))
repairMaterial = repairMaterialCandidate;
for(ItemStack is : player.getInventory().getContents())
{
if(is.getType() == repairMaterialCandidate)
{
if(is.getItemMeta().getLore().isEmpty())
{
repairMaterial = repairMaterialCandidate;
break;
} else {
foundNonBasicMaterial = true;
}
}
}
}
/* Abort the repair if no compatible basic repairing item found */
if(repairMaterial == null && foundNonBasicMaterial == true)
{
player.sendMessage(LocaleLoader.getString("Repair.NoBasicRepairMatsFound"));
return;
}
//byte repairMaterialMetadata = repairable.getRepairMaterialMetadata();
ItemStack toRemove = new ItemStack(repairMaterial);

View File

@ -364,6 +364,7 @@ Repair.Skills.Adept=[[RED]]You must be level [[YELLOW]]{0}[[RED]] to repair [[YE
Repair.Skills.FeltEasy=[[GRAY]]That felt easy.
Repair.Skills.FullDurability=[[GRAY]]That is at full durability.
Repair.Skills.StackedItems=[[DARK_RED]]You can't repair stacked items.
Repair.NoBasicRepairMatsFound=[[RED]]You can only repair using basic materials.
Repair.Pretty.Name=Repair
#Arcane Forging
Repair.Arcane.Downgrade=Arcane power has decreased for this item.