mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
Fixed a bug where Tree Feller only rewarded 1 XP per block
This commit is contained in:
parent
40118d570c
commit
77ffee2515
@ -1,4 +1,5 @@
|
||||
Version 2.1.103
|
||||
Fixed a bug where Tree Feller was only rewarding 1 XP per log broken no matter the circumstances
|
||||
Fixed an issue with salvage checking the incorrect level requirement
|
||||
Updated Italian locale (thanks Leomixer17)
|
||||
Fixed grammar in one of the Salvage strings (thanks QuantumToasted)
|
||||
|
@ -266,6 +266,7 @@ public class WoodcuttingManager extends SkillManager {
|
||||
int processedLogCount = 0;
|
||||
|
||||
for (BlockState blockState : treeFellerBlocks) {
|
||||
int beforeXP = xp;
|
||||
Block block = blockState.getBlock();
|
||||
|
||||
if (!EventUtils.simulateBlockBreak(block, player, true)) {
|
||||
@ -295,12 +296,21 @@ public class WoodcuttingManager extends SkillManager {
|
||||
|
||||
blockState.setType(Material.AIR);
|
||||
blockState.update(true);
|
||||
processedLogCount+=1;
|
||||
|
||||
//Update only when XP changes
|
||||
processedLogCount = updateProcessedLogCount(xp, processedLogCount, beforeXP);
|
||||
}
|
||||
|
||||
applyXpGain(xp, XPGainReason.PVE);
|
||||
}
|
||||
|
||||
private int updateProcessedLogCount(int xp, int processedLogCount, int beforeXP) {
|
||||
if(beforeXP != xp)
|
||||
processedLogCount+=1;
|
||||
|
||||
return processedLogCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the experience reward from logging via Tree Feller
|
||||
* Experience is reduced per log processed so far
|
||||
@ -318,8 +328,8 @@ public class WoodcuttingManager extends SkillManager {
|
||||
return 0;
|
||||
|
||||
if(ExperienceConfig.getInstance().isTreeFellerXPReduced()) {
|
||||
int reducedXP = 1 + (woodCount * 5);
|
||||
rawXP = Math.max(1, rawXP - reducedXP);
|
||||
int reducedXP = rawXP - (woodCount * 5);
|
||||
rawXP = Math.max(1, reducedXP);
|
||||
return rawXP;
|
||||
} else {
|
||||
return ExperienceConfig.getInstance().getXp(PrimarySkillType.WOODCUTTING, blockState.getType());
|
||||
|
Loading…
Reference in New Issue
Block a user