mirror of
https://github.com/BentoBoxWorld/Level.git
synced 2024-11-23 18:45:17 +01:00
Fixes issue with initial level calculations and reporting.
https://github.com/BentoBoxWorld/Level/issues/189
This commit is contained in:
parent
b5e161d59e
commit
0d1a10ff6f
@ -165,6 +165,8 @@ public class IslandLevelCalculator {
|
||||
duration = System.currentTimeMillis();
|
||||
chunksToCheck = getChunksToScan(island);
|
||||
this.limitCount = new HashMap<>(addon.getBlockConfig().getBlockLimits());
|
||||
// Get the initial island level
|
||||
results.initialLevel.set(addon.getInitialIslandLevel(island));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -175,7 +177,7 @@ public class IslandLevelCalculator {
|
||||
private long calculateLevel(long blockAndDeathPoints) {
|
||||
String calcString = addon.getSettings().getLevelCalc();
|
||||
String withValues = calcString.replace("blocks", String.valueOf(blockAndDeathPoints)).replace("level_cost", String.valueOf(this.addon.getSettings().getLevelCost()));
|
||||
return (long)eval(withValues) - this.island.getLevelHandicap() - results.initialLevel.get();
|
||||
return (long)eval(withValues) - this.island.getLevelHandicap() - (addon.getSettings().isZeroNewIslandLevels() ? results.initialLevel.get() : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -242,11 +244,7 @@ public class IslandLevelCalculator {
|
||||
reportLines.add("Initial island level = " + (0L - addon.getManager().getInitialLevel(island)));
|
||||
}
|
||||
reportLines.add("Previous level = " + addon.getManager().getIslandLevel(island.getWorld(), island.getOwner()));
|
||||
if (addon.getSettings().isZeroNewIslandLevels()) {
|
||||
reportLines.add("New level = " + (results.getLevel() - addon.getManager().getInitialLevel(island)));
|
||||
} else {
|
||||
reportLines.add("New level = " + results.getLevel());
|
||||
}
|
||||
reportLines.add("New level = " + results.getLevel());
|
||||
reportLines.add(LINE_BREAK);
|
||||
int total = 0;
|
||||
if (!results.uwCount.isEmpty()) {
|
||||
@ -531,12 +529,6 @@ public class IslandLevelCalculator {
|
||||
}
|
||||
this.results.level.set(calculateLevel(blockAndDeathPoints));
|
||||
|
||||
// Adjust for initial level
|
||||
if (addon.getSettings().isZeroNewIslandLevels()) {
|
||||
long oldLevel = this.results.level.get();
|
||||
this.results.level.set(oldLevel - this.results.initialLevel.get());
|
||||
}
|
||||
|
||||
// Calculate how many points are required to get to the next level
|
||||
long nextLevel = this.results.level.get();
|
||||
long blocks = blockAndDeathPoints;
|
||||
|
@ -36,8 +36,8 @@ public class ConfigSettings implements ConfigObject {
|
||||
@ConfigComment("")
|
||||
@ConfigComment("Zero island levels on new island or island reset")
|
||||
@ConfigComment("If true, Level will calculate the starter island's level and remove it from any future level calculations.")
|
||||
@ConfigComment("If false, the player's starter island and will count towards their level.")
|
||||
@ConfigComment("This will reduce CPU if it isn't used.")
|
||||
@ConfigComment("If false, the player's starter island blocks will count towards their level.")
|
||||
@ConfigComment("This will reduce CPU if false.")
|
||||
@ConfigEntry(path = "zero-new-island-levels")
|
||||
private boolean zeroNewIslandLevels = true;
|
||||
|
||||
|
@ -17,8 +17,8 @@ calculation-timeout: 5
|
||||
#
|
||||
# Zero island levels on new island or island reset
|
||||
# If true, Level will calculate the starter island's level and remove it from any future level calculations.
|
||||
# If this is false, the player's starter island and will count towards their level.
|
||||
# This will reduce CPU if it isn't used.
|
||||
# If this is false, the player's starter island blocks will count towards their level.
|
||||
# This will reduce CPU if false.
|
||||
zero-new-island-levels: true
|
||||
#
|
||||
# Calculate island level on login
|
||||
|
Loading…
Reference in New Issue
Block a user