mirror of
https://github.com/BentoBoxWorld/Level.git
synced 2024-11-23 18:45:17 +01:00
Fixes points to next level bug.
https://github.com/BentoBoxWorld/addon-level/issues/17
This commit is contained in:
parent
c8e753af16
commit
4c7a6a710c
2
pom.xml
2
pom.xml
@ -70,7 +70,7 @@
|
||||
<dependency>
|
||||
<groupId>world.bentobox</groupId>
|
||||
<artifactId>bentobox</artifactId>
|
||||
<version>FC-1</version>
|
||||
<version>0.9.0-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -207,9 +207,7 @@ public class CalcIslandLevel {
|
||||
// Set final score
|
||||
result.level = (result.rawBlockCount / addon.getSettings().getLevelCost()) - result.deathHandicap - island.getLevelHandicap();
|
||||
// Calculate how many points are required to get to the next level
|
||||
result.pointsToNextLevel = (addon.getSettings().getLevelCost() * (result.level + 1 + island.getLevelHandicap())) - (result.rawBlockCount - (result.deathHandicap * addon.getSettings().getDeathPenalty()));
|
||||
// Sometimes it will return 0, so calculate again to make sure it will display a good value
|
||||
if(result.pointsToNextLevel == 0) result.pointsToNextLevel = (addon.getSettings().getLevelCost() * (result.level + 2 + island.getLevelHandicap()) - (result.rawBlockCount - (result.deathHandicap * addon.getSettings().getDeathPenalty())));
|
||||
result.pointsToNextLevel = addon.getSettings().getLevelCost() - (result.rawBlockCount % addon.getSettings().getLevelCost());
|
||||
// Report
|
||||
result.report = getReport();
|
||||
// All done.
|
||||
|
@ -71,7 +71,7 @@ public class PlayerLevel {
|
||||
}
|
||||
// Send player how many points are required to reach next island level
|
||||
if (results.getPointsToNextLevel() >= 0) {
|
||||
asker.sendMessage("island.level.required-points-to-next-level", "[points]", String.valueOf(addon.getIslandLevel(world, targetPlayer)));
|
||||
asker.sendMessage("island.level.required-points-to-next-level", "[points]", String.valueOf(results.getPointsToNextLevel()));
|
||||
}
|
||||
// Tell other team members
|
||||
if (addon.getIslandLevel(world, targetPlayer) != oldLevel) {
|
||||
|
Loading…
Reference in New Issue
Block a user