mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-06-25 10:14:43 +02:00
Fixed a bug where Tree Feller only rewarded 1 XP per block
This commit is contained in:
@ -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());
|
||||
|
Reference in New Issue
Block a user