diff --git a/pom.xml b/pom.xml index 422561e..b758783 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ world.bentobox level - 0.3.0-SNAPSHOT + 0.4.0-SNAPSHOT Level Level is an add-on for BentoBox, an expandable Minecraft Bukkit plugin for island-type games like SkyBlock or AcidIsland. diff --git a/src/main/java/world/bentobox/level/Level.java b/src/main/java/world/bentobox/level/Level.java index b8e3240..6105cc2 100644 --- a/src/main/java/world/bentobox/level/Level.java +++ b/src/main/java/world/bentobox/level/Level.java @@ -6,19 +6,19 @@ import java.util.UUID; import org.bukkit.World; -import world.bentobox.level.commands.admin.AdminLevelCommand; -import world.bentobox.level.commands.admin.AdminTopCommand; -import world.bentobox.level.commands.island.IslandLevelCommand; -import world.bentobox.level.commands.island.IslandTopCommand; -import world.bentobox.level.config.Settings; -import world.bentobox.level.objects.LevelsData; -import world.bentobox.level.listeners.JoinLeaveListener; -import world.bentobox.level.listeners.NewIslandListener; import world.bentobox.bentobox.api.addons.Addon; import world.bentobox.bentobox.api.commands.CompositeCommand; import world.bentobox.bentobox.api.user.User; import world.bentobox.bentobox.database.Database; import world.bentobox.bentobox.database.objects.Island; +import world.bentobox.level.commands.admin.AdminLevelCommand; +import world.bentobox.level.commands.admin.AdminTopCommand; +import world.bentobox.level.commands.island.IslandLevelCommand; +import world.bentobox.level.commands.island.IslandTopCommand; +import world.bentobox.level.config.Settings; +import world.bentobox.level.listeners.JoinLeaveListener; +import world.bentobox.level.listeners.NewIslandListener; +import world.bentobox.level.objects.LevelsData; import world.bentobox.level.requests.LevelRequestHandler; /** @@ -185,7 +185,6 @@ public class Level extends Addon { levelsCache.get(island.getOwner()).setInitialIslandLevel(level); } - public Database getHandler() { return handler; } diff --git a/src/main/java/world/bentobox/level/calculators/CalcIslandLevel.java b/src/main/java/world/bentobox/level/calculators/CalcIslandLevel.java index 0577f96..36e3683 100644 --- a/src/main/java/world/bentobox/level/calculators/CalcIslandLevel.java +++ b/src/main/java/world/bentobox/level/calculators/CalcIslandLevel.java @@ -148,11 +148,7 @@ public class CalcIslandLevel { /** * Checks if a block has been limited or not and whether a block has any value or not -<<<<<<< HEAD * @param md Material -======= - * @param md - Material to check ->>>>>>> branch 'develop' of https://github.com/BentoBoxWorld/addon-level.git * @return value of the block if can be counted */ private int limitCount(Material md) { @@ -176,11 +172,7 @@ public class CalcIslandLevel { /** * Get value of a material * World blocks trump regular block values -<<<<<<< HEAD - * @param md Material -======= * @param md - Material to check ->>>>>>> branch 'develop' of https://github.com/BentoBoxWorld/addon-level.git * @return value of a material */ private int getValue(Material md) { @@ -193,11 +185,7 @@ public class CalcIslandLevel { /** * Get a set of all the chunks in island * @param island - island -<<<<<<< HEAD - * @return - set of all the chunks in the island to scan -======= * @return - set of pairs of x,z coordinates to check ->>>>>>> branch 'develop' of https://github.com/BentoBoxWorld/addon-level.git */ private Set> getChunksToScan(Island island) { Set> chunkSnapshot = new HashSet<>(); @@ -227,25 +215,26 @@ public class CalcIslandLevel { else { this.result.deathHandicap = - this.addon.getPlayers().getDeaths(this.world, this.island.getOwner()); + this.addon.getPlayers().getDeaths(this.world, this.island.getOwner()); } // Just lazy check for min death count. - this.result.deathHandicap = Math.min(this.result.deathHandicap, this.addon.getSettings().getMaxDeaths()); + this.result.deathHandicap = Math.min(this.result.deathHandicap, this.addon.getSettings().getMaxDeaths()); - long blockAndDeathPoints = this.result.rawBlockCount; + long blockAndDeathPoints = this.result.rawBlockCount; if (this.addon.getSettings().getDeathPenalty() > 0) - { - // Proper death penalty calculation. - blockAndDeathPoints -= this.result.deathHandicap * this.addon.getSettings().getDeathPenalty(); - } + { + // Proper death penalty calculation. + blockAndDeathPoints -= this.result.deathHandicap * this.addon.getSettings().getDeathPenalty(); + } + + this.result.level = blockAndDeathPoints / this.addon.getSettings().getLevelCost() - this.island.getLevelHandicap(); - this.result.level = blockAndDeathPoints / this.addon.getSettings().getLevelCost() - this.island.getLevelHandicap(); // Calculate how many points are required to get to the next level this.result.pointsToNextLevel = this.addon.getSettings().getLevelCost() - - (blockAndDeathPoints % this.addon.getSettings().getLevelCost()); + (blockAndDeathPoints % this.addon.getSettings().getLevelCost()); // Report result.report = getReport(); diff --git a/src/main/java/world/bentobox/level/listeners/NewIslandListener.java b/src/main/java/world/bentobox/level/listeners/NewIslandListener.java index 9b9e463..3e1d3a8 100644 --- a/src/main/java/world/bentobox/level/listeners/NewIslandListener.java +++ b/src/main/java/world/bentobox/level/listeners/NewIslandListener.java @@ -7,11 +7,11 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; -import world.bentobox.level.Level; -import world.bentobox.level.calculators.CalcIslandLevel; import world.bentobox.bentobox.api.events.island.IslandEvent.IslandCreatedEvent; import world.bentobox.bentobox.api.events.island.IslandEvent.IslandResettedEvent; import world.bentobox.bentobox.database.objects.Island; +import world.bentobox.level.Level; +import world.bentobox.level.calculators.CalcIslandLevel; /** * Listens for new islands and sets the level to zero automatically