Fixed an almost 6 year old bug involving salvage materials smh

Updated the new ExperienceAPI methods to check for level ups
This commit is contained in:
nossr50 2019-02-02 07:15:12 -08:00
parent 14e5998aa0
commit 84b3cfc309
5 changed files with 47 additions and 6 deletions

View File

@ -7,6 +7,7 @@ Key:
! Change ! Change
- Removal - Removal
Version 2.1.7 Version 2.1.7
Fixed an almost 6 year old bug where Salvage materials did not have a defined material count so they defaulted to 2 (which could lead to shovels giving back more diamonds than normal)
(API) Added addXpFromBlocks to ExperienceAPI to help make adding XP for a player easier (API) Added addXpFromBlocks to ExperienceAPI to help make adding XP for a player easier
(API) Added addXpFromBlocksBySkill to ExperienceAPI to help make adding XP for a player easier (API) Added addXpFromBlocksBySkill to ExperienceAPI to help make adding XP for a player easier
(API) Added addXpFromBlock to ExperienceAPI to help make adding XP for a player easier (API) Added addXpFromBlock to ExperienceAPI to help make adding XP for a player easier

View File

@ -1026,7 +1026,7 @@ public final class ExperienceAPI {
{ {
if(ExperienceConfig.getInstance().getXp(skillType, bs.getType()) > 0) if(ExperienceConfig.getInstance().getXp(skillType, bs.getType()) > 0)
{ {
mcMMOPlayer.addXp(skillType, ExperienceConfig.getInstance().getXp(skillType, bs.getType())); mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, bs.getType()), XPGainReason.PVE, XPGainSource.SELF);
} }
} }
} }
@ -1044,7 +1044,7 @@ public final class ExperienceAPI {
{ {
if(ExperienceConfig.getInstance().getXp(skillType, bs.getType()) > 0) if(ExperienceConfig.getInstance().getXp(skillType, bs.getType()) > 0)
{ {
mcMMOPlayer.addXp(skillType, ExperienceConfig.getInstance().getXp(skillType, bs.getType())); mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, bs.getType()), XPGainReason.PVE, XPGainSource.SELF);
} }
} }
} }
@ -1060,7 +1060,7 @@ public final class ExperienceAPI {
{ {
if(ExperienceConfig.getInstance().getXp(skillType, blockState.getType()) > 0) if(ExperienceConfig.getInstance().getXp(skillType, blockState.getType()) > 0)
{ {
mcMMOPlayer.addXp(skillType, ExperienceConfig.getInstance().getXp(skillType, blockState.getType())); mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, blockState.getType()), XPGainReason.PVE, XPGainSource.SELF);
} }
} }
} }
@ -1075,7 +1075,7 @@ public final class ExperienceAPI {
{ {
if(ExperienceConfig.getInstance().getXp(skillType, blockState.getType()) > 0) if(ExperienceConfig.getInstance().getXp(skillType, blockState.getType()) > 0)
{ {
mcMMOPlayer.addXp(skillType, ExperienceConfig.getInstance().getXp(skillType, blockState.getType())); mcMMOPlayer.applyXpGain(skillType, ExperienceConfig.getInstance().getXp(skillType, blockState.getType()), XPGainReason.PVE, XPGainSource.SELF);
} }
} }

View File

@ -125,7 +125,7 @@ public class SalvageConfig extends ConfigLoader {
int maximumQuantity = (itemMaterial != null ? SkillUtils.getRepairAndSalvageQuantities(new ItemStack(itemMaterial), salvageMaterial, salvageMetadata) : config.getInt("Salvageables." + key + ".MaximumQuantity", 2)); int maximumQuantity = (itemMaterial != null ? SkillUtils.getRepairAndSalvageQuantities(new ItemStack(itemMaterial), salvageMaterial, salvageMetadata) : config.getInt("Salvageables." + key + ".MaximumQuantity", 2));
if (maximumQuantity <= 0 && itemMaterial != null) { if (maximumQuantity <= 0 && itemMaterial != null) {
maximumQuantity = config.getInt("Salvageables." + key + ".MaximumQuantity", 2); maximumQuantity = config.getInt("Salvageables." + key + ".MaximumQuantity", 1);
} }
int configMaximumQuantity = config.getInt("Salvageables." + key + ".MaximumQuantity", -1); int configMaximumQuantity = config.getInt("Salvageables." + key + ".MaximumQuantity", -1);

View File

@ -455,7 +455,6 @@ Skills:
# MaxBonusLevel: On this level, the chance to cause Gore will be <ChanceMax> # MaxBonusLevel: On this level, the chance to cause Gore will be <ChanceMax>
ChanceMax: 100.0 ChanceMax: 100.0
MaxBonusLevel: 100 MaxBonusLevel: 100
# BleedTicks: Determines the length of the bleeding effect
# Modifier: Damage will get multiplied by this modifier # Modifier: Damage will get multiplied by this modifier
Modifier: 2.0 Modifier: 2.0
FastFoodService: FastFoodService:

View File

@ -49,18 +49,23 @@ Salvageables:
WOODEN_SWORD: WOODEN_SWORD:
MinimumLevel: 0 MinimumLevel: 0
XpMultiplier: .25 XpMultiplier: .25
MaximumQuantity: 2
WOODEN_SHOVEL: WOODEN_SHOVEL:
MinimumLevel: 0 MinimumLevel: 0
XpMultiplier: .16 XpMultiplier: .16
MaximumQuantity: 1
WOODEN_PICKAXE: WOODEN_PICKAXE:
MinimumLevel: 0 MinimumLevel: 0
XpMultiplier: .5 XpMultiplier: .5
MaximumQuantity: 3
WOODEN_AXE: WOODEN_AXE:
MinimumLevel: 0 MinimumLevel: 0
XpMultiplier: .5 XpMultiplier: .5
MaximumQuantity: 2
WOODEN_HOE: WOODEN_HOE:
MinimumLevel: 0 MinimumLevel: 0
XpMultiplier: .25 XpMultiplier: .25
MaximumQuantity: 2
# #
# Stone salvageables # Stone salvageables
### ###
@ -68,18 +73,23 @@ Salvageables:
STONE_SWORD: STONE_SWORD:
MinimumLevel: 0 MinimumLevel: 0
XpMultiplier: .25 XpMultiplier: .25
MaximumQuantity: 2
STONE_SHOVEL: STONE_SHOVEL:
MinimumLevel: 0 MinimumLevel: 0
XpMultiplier: .16 XpMultiplier: .16
MaximumQuantity: 1
STONE_PICKAXE: STONE_PICKAXE:
MinimumLevel: 0 MinimumLevel: 0
XpMultiplier: .5 XpMultiplier: .5
MaximumQuantity: 3
STONE_AXE: STONE_AXE:
MinimumLevel: 0 MinimumLevel: 0
XpMultiplier: .5 XpMultiplier: .5
MaximumQuantity: 2
STONE_HOE: STONE_HOE:
MinimumLevel: 0 MinimumLevel: 0
XpMultiplier: .25 XpMultiplier: .25
MaximumQuantity: 2
# #
# Iron salvageables # Iron salvageables
### ###
@ -87,18 +97,23 @@ Salvageables:
IRON_SWORD: IRON_SWORD:
MinimumLevel: 0 MinimumLevel: 0
XpMultiplier: .5 XpMultiplier: .5
MaximumQuantity: 2
IRON_SHOVEL: IRON_SHOVEL:
MinimumLevel: 0 MinimumLevel: 0
XpMultiplier: .3 XpMultiplier: .3
MaximumQuantity: 1
IRON_PICKAXE: IRON_PICKAXE:
MinimumLevel: 0 MinimumLevel: 0
XpMultiplier: 1 XpMultiplier: 1
MaximumQuantity: 3
IRON_AXE: IRON_AXE:
MinimumLevel: 0 MinimumLevel: 0
XpMultiplier: 1 XpMultiplier: 1
MaximumQuantity: 2
IRON_HOE: IRON_HOE:
MinimumLevel: 0 MinimumLevel: 0
XpMultiplier: .5 XpMultiplier: .5
MaximumQuantity: 2
SHEARS: SHEARS:
MinimumLevel: 0 MinimumLevel: 0
XpMultiplier: .5 XpMultiplier: .5
@ -109,15 +124,19 @@ Salvageables:
IRON_HELMET: IRON_HELMET:
MinimumLevel: 0 MinimumLevel: 0
XpMultiplier: 2 XpMultiplier: 2
MaximumQuantity: 5
IRON_CHESTPLATE: IRON_CHESTPLATE:
MinimumLevel: 0 MinimumLevel: 0
XpMultiplier: 2 XpMultiplier: 2
MaximumQuantity: 8
IRON_LEGGINGS: IRON_LEGGINGS:
MinimumLevel: 0 MinimumLevel: 0
XpMultiplier: 2 XpMultiplier: 2
MaximumQuantity: 7
IRON_BOOTS: IRON_BOOTS:
MinimumLevel: 0 MinimumLevel: 0
XpMultiplier: 2 XpMultiplier: 2
MaximumQuantity: 4
# #
# Gold salvageables # Gold salvageables
### ###
@ -125,31 +144,40 @@ Salvageables:
GOLDEN_SWORD: GOLDEN_SWORD:
MinimumLevel: 0 MinimumLevel: 0
XpMultiplier: 4 XpMultiplier: 4
MaximumQuantity: 2
GOLDEN_SHOVEL: GOLDEN_SHOVEL:
MinimumLevel: 0 MinimumLevel: 0
XpMultiplier: 2.6 XpMultiplier: 2.6
MaximumQuantity: 1
GOLDEN_PICKAXE: GOLDEN_PICKAXE:
MinimumLevel: 0 MinimumLevel: 0
XpMultiplier: 8 XpMultiplier: 8
MaximumQuantity: 3
GOLDEN_AXE: GOLDEN_AXE:
MinimumLevel: 0 MinimumLevel: 0
XpMultiplier: 8 XpMultiplier: 8
MaximumQuantity: 2
GOLDEN_HOE: GOLDEN_HOE:
MinimumLevel: 0 MinimumLevel: 0
XpMultiplier: 4 XpMultiplier: 4
MaximumQuantity: 2
# Armor # Armor
GOLDEN_HELMET: GOLDEN_HELMET:
MinimumLevel: 0 MinimumLevel: 0
XpMultiplier: 4 XpMultiplier: 4
MaximumQuantity: 5
GOLDEN_CHESTPLATE: GOLDEN_CHESTPLATE:
MinimumLevel: 0 MinimumLevel: 0
XpMultiplier: 4 XpMultiplier: 4
MaximumQuantity: 8
GOLDEN_LEGGINGS: GOLDEN_LEGGINGS:
MinimumLevel: 0 MinimumLevel: 0
XpMultiplier: 4 XpMultiplier: 4
MaximumQuantity: 7
GOLDEN_BOOTS: GOLDEN_BOOTS:
MinimumLevel: 0 MinimumLevel: 0
XpMultiplier: 4 XpMultiplier: 4
MaximumQuantity: 4
# #
# Diamond salvageables # Diamond salvageables
### ###
@ -157,31 +185,40 @@ Salvageables:
DIAMOND_SWORD: DIAMOND_SWORD:
MinimumLevel: 50 MinimumLevel: 50
XpMultiplier: .5 XpMultiplier: .5
MaximumQuantity: 2
DIAMOND_SHOVEL: DIAMOND_SHOVEL:
MinimumLevel: 50 MinimumLevel: 50
XpMultiplier: .3 XpMultiplier: .3
MaximumQuantity: 1
DIAMOND_PICKAXE: DIAMOND_PICKAXE:
MinimumLevel: 50 MinimumLevel: 50
XpMultiplier: 1 XpMultiplier: 1
MaximumQuantity: 3
DIAMOND_AXE: DIAMOND_AXE:
MinimumLevel: 50 MinimumLevel: 50
XpMultiplier: 1 XpMultiplier: 1
MaximumQuantity: 2
DIAMOND_HOE: DIAMOND_HOE:
MinimumLevel: 50 MinimumLevel: 50
XpMultiplier: .5 XpMultiplier: .5
MaximumQuantity: 2
# Armor # Armor
DIAMOND_HELMET: DIAMOND_HELMET:
MinimumLevel: 50 MinimumLevel: 50
XpMultiplier: 6 XpMultiplier: 6
MaximumQuantity: 5
DIAMOND_CHESTPLATE: DIAMOND_CHESTPLATE:
MinimumLevel: 50 MinimumLevel: 50
XpMultiplier: 6 XpMultiplier: 6
MaximumQuantity: 8
DIAMOND_LEGGINGS: DIAMOND_LEGGINGS:
MinimumLevel: 50 MinimumLevel: 50
XpMultiplier: 6 XpMultiplier: 6
MaximumQuantity: 7
DIAMOND_BOOTS: DIAMOND_BOOTS:
MinimumLevel: 50 MinimumLevel: 50
XpMultiplier: 6 XpMultiplier: 6
MaximumQuantity: 4
# #
# Leather salvageables # Leather salvageables
### ###
@ -189,15 +226,19 @@ Salvageables:
LEATHER_HELMET: LEATHER_HELMET:
MinimumLevel: 0 MinimumLevel: 0
XpMultiplier: 1 XpMultiplier: 1
MaximumQuantity: 5
LEATHER_CHESTPLATE: LEATHER_CHESTPLATE:
MinimumLevel: 0 MinimumLevel: 0
XpMultiplier: 1 XpMultiplier: 1
MaximumQuantity: 8
LEATHER_LEGGINGS: LEATHER_LEGGINGS:
MinimumLevel: 0 MinimumLevel: 0
XpMultiplier: 1 XpMultiplier: 1
MaximumQuantity: 7
LEATHER_BOOTS: LEATHER_BOOTS:
MinimumLevel: 0 MinimumLevel: 0
XpMultiplier: 1 XpMultiplier: 1
MaximumQuantity: 4
# #
# String salvageables # String salvageables
### ###