From 99adc51d65d63da5b39ccc1217b9a4e946707a13 Mon Sep 17 00:00:00 2001 From: tastybento Date: Mon, 12 Mar 2018 04:06:31 +0900 Subject: [PATCH] Updated to latest BSkyBlock --- pom.xml | 2 +- src/main/java/bskyblock/addon/level/Level.java | 2 +- src/main/java/bskyblock/addon/level/LevelCalcByChunk.java | 8 ++++---- src/main/java/bskyblock/addon/level/TopTen.java | 2 +- .../bskyblock/addon/level/database/object/LevelsData.java | 5 +++++ .../bskyblock/addon/level/database/object/TopTenData.java | 8 ++++++-- 6 files changed, 18 insertions(+), 9 deletions(-) diff --git a/pom.xml b/pom.xml index 6910eab..f6ba910 100644 --- a/pom.xml +++ b/pom.xml @@ -43,7 +43,6 @@ org.bukkit bukkit - 1.12.2-R0.1-SNAPSHOT provided @@ -55,6 +54,7 @@ bskyblock.addon WelcomeWarpSigns 0.0.1-SNAPSHOT + provided diff --git a/src/main/java/bskyblock/addon/level/Level.java b/src/main/java/bskyblock/addon/level/Level.java index 8d85ccf..672f0c8 100644 --- a/src/main/java/bskyblock/addon/level/Level.java +++ b/src/main/java/bskyblock/addon/level/Level.java @@ -18,8 +18,8 @@ import us.tastybento.bskyblock.Constants; import us.tastybento.bskyblock.api.addons.Addon; import us.tastybento.bskyblock.api.commands.CompositeCommand; import us.tastybento.bskyblock.api.commands.User; +import us.tastybento.bskyblock.database.AbstractDatabaseHandler; import us.tastybento.bskyblock.database.BSBDatabase; -import us.tastybento.bskyblock.database.managers.AbstractDatabaseHandler; /** * Addon to BSkyBlock that enables island level scoring and top ten functionality diff --git a/src/main/java/bskyblock/addon/level/LevelCalcByChunk.java b/src/main/java/bskyblock/addon/level/LevelCalcByChunk.java index ee3822e..28e0277 100644 --- a/src/main/java/bskyblock/addon/level/LevelCalcByChunk.java +++ b/src/main/java/bskyblock/addon/level/LevelCalcByChunk.java @@ -117,12 +117,12 @@ public class LevelCalcByChunk { private void scanChunk(ChunkSnapshot chunk) { for (int x = 0; x< 16; x++) { // Check if the block coord is inside the protection zone and if not, don't count it - if (chunk.getX() * 16 + x < island.getMinProtectedX() || chunk.getX() * 16 + x >= island.getMinProtectedX() + island.getProtectionRange()) { + if (chunk.getX() * 16 + x < island.getMinProtectedX() || chunk.getX() * 16 + x >= island.getMinProtectedX() + island.getProtectionRange() * 2) { continue; } for (int z = 0; z < 16; z++) { // Check if the block coord is inside the protection zone and if not, don't count it - if (chunk.getZ() * 16 + z < island.getMinProtectedZ() || chunk.getZ() * 16 + z >= island.getMinProtectedZ() + island.getProtectionRange()) { + if (chunk.getZ() * 16 + z < island.getMinProtectedZ() || chunk.getZ() * 16 + z >= island.getMinProtectedZ() + island.getProtectionRange() * 2) { continue; } @@ -196,8 +196,8 @@ public class LevelCalcByChunk { */ private Set> getChunksToScan(Island island) { Set> chunkSnapshot = new HashSet<>(); - for (int x = island.getMinProtectedX(); x < (island.getMinProtectedX() + island.getProtectionRange() + 16); x += 16) { - for (int z = island.getMinProtectedZ(); z < (island.getMinProtectedZ() + island.getProtectionRange() + 16); z += 16) { + for (int x = island.getMinProtectedX(); x < (island.getMinProtectedX() + island.getProtectionRange() * 2 + 16); x += 16) { + for (int z = island.getMinProtectedZ(); z < (island.getMinProtectedZ() + island.getProtectionRange() * 2 + 16); z += 16) { Pair pair = new Pair<>(world.getBlockAt(x, 0, z).getChunk().getX(), world.getBlockAt(x, 0, z).getChunk().getZ()); chunkSnapshot.add(pair); } diff --git a/src/main/java/bskyblock/addon/level/TopTen.java b/src/main/java/bskyblock/addon/level/TopTen.java index 5eecdb3..f7ff587 100644 --- a/src/main/java/bskyblock/addon/level/TopTen.java +++ b/src/main/java/bskyblock/addon/level/TopTen.java @@ -24,8 +24,8 @@ import us.tastybento.bskyblock.api.panels.PanelItem; import us.tastybento.bskyblock.api.panels.PanelItem.ClickHandler; import us.tastybento.bskyblock.api.panels.builders.PanelBuilder; import us.tastybento.bskyblock.api.panels.builders.PanelItemBuilder; +import us.tastybento.bskyblock.database.AbstractDatabaseHandler; import us.tastybento.bskyblock.database.BSBDatabase; -import us.tastybento.bskyblock.database.managers.AbstractDatabaseHandler; /** * Handles all Top Ten List functions diff --git a/src/main/java/bskyblock/addon/level/database/object/LevelsData.java b/src/main/java/bskyblock/addon/level/database/object/LevelsData.java index 0bd79f8..7ec4bc4 100644 --- a/src/main/java/bskyblock/addon/level/database/object/LevelsData.java +++ b/src/main/java/bskyblock/addon/level/database/object/LevelsData.java @@ -1,10 +1,15 @@ package bskyblock.addon.level.database.object; +import com.google.gson.annotations.Expose; + import us.tastybento.bskyblock.database.objects.DataObject; public class LevelsData implements DataObject { + @Expose private String uniqueId = ""; + + @Expose private long level = 0; public String getUniqueId() { diff --git a/src/main/java/bskyblock/addon/level/database/object/TopTenData.java b/src/main/java/bskyblock/addon/level/database/object/TopTenData.java index 44c3d1e..0f86490 100644 --- a/src/main/java/bskyblock/addon/level/database/object/TopTenData.java +++ b/src/main/java/bskyblock/addon/level/database/object/TopTenData.java @@ -6,6 +6,8 @@ import java.util.Map; import java.util.UUID; import java.util.stream.Collectors; +import com.google.gson.annotations.Expose; + import us.tastybento.bskyblock.database.objects.DataObject; /** @@ -15,10 +17,12 @@ import us.tastybento.bskyblock.database.objects.DataObject; */ public class TopTenData implements DataObject { + @Expose private String uniqueId = "topten"; - private HashMap topTen = new HashMap<>(); + @Expose + private Map topTen = new HashMap<>(); - public HashMap getTopTen() { + public Map getTopTen() { return topTen; }