diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..be52336 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +github: tastybento diff --git a/src/main/java/world/bentobox/level/calculators/CalcIslandLevel.java b/src/main/java/world/bentobox/level/calculators/CalcIslandLevel.java index 398f8ef..6882eb2 100644 --- a/src/main/java/world/bentobox/level/calculators/CalcIslandLevel.java +++ b/src/main/java/world/bentobox/level/calculators/CalcIslandLevel.java @@ -12,6 +12,7 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; import org.bukkit.Bukkit; +import org.bukkit.Chunk; import org.bukkit.ChunkSnapshot; import org.bukkit.Material; import org.bukkit.Tag; @@ -45,10 +46,13 @@ public class CalcIslandLevel { // Copy the limits hash map private final HashMap limitCount; + private final List worlds; private final World world; private int count; + private int total; + /** * Calculate the island's level @@ -63,6 +67,9 @@ public class CalcIslandLevel { this.world = island.getWorld(); this.limitCount = new HashMap<>(addon.getSettings().getBlockLimits()); this.onExit = onExit; + this.worlds = new ArrayList<>(); + this.worlds.add(world); + // Results go here result = new Results(); @@ -73,17 +80,38 @@ public class CalcIslandLevel { // Get chunks to scan chunksToScan = getChunksToScan(island); count = 0; - chunksToScan.forEach(c -> Util.getChunkAtAsync(world, c.x, c.z).thenAccept(ch -> { - ChunkSnapshot snapShot = ch.getChunkSnapshot(); - Bukkit.getScheduler().runTaskAsynchronously(addon.getPlugin(), () -> { - this.scanChunk(snapShot); - count++; - if (count == chunksToScan.size()) { - this.tidyUp(); - } - }); - })); + // Total number of chunks to scan + total = chunksToScan.size(); + // Add nether world scanning + if (addon.getSettings().isNether()) { + World netherWorld = addon.getPlugin().getIWM().getNetherWorld(world); + if (netherWorld != null) { + this.worlds.add(netherWorld); + total += chunksToScan.size(); + } + } + // Add End world scanning + if (addon.getSettings().isEnd()) { + World endWorld = addon.getPlugin().getIWM().getEndWorld(world); + if (endWorld != null) { + this.worlds.add(endWorld); + total += chunksToScan.size(); + } + } + chunksToScan.forEach(c -> worlds.forEach(w -> Util.getChunkAtAsync(w, c.x, c.z).thenAccept(this::getChunk))); + + } + + private void getChunk(Chunk ch) { + ChunkSnapshot snapShot = ch.getChunkSnapshot(); + Bukkit.getScheduler().runTaskAsynchronously(addon.getPlugin(), () -> { + this.scanChunk(snapShot); + count++; + if (count == total) { + this.tidyUp(); + } + }); } private void scanChunk(ChunkSnapshot chunk) { @@ -447,20 +475,20 @@ public class CalcIslandLevel { String func = str.substring(startPos, this.pos); x = parseFactor(); switch (func) { - case "sqrt": - x = Math.sqrt(x); - break; - case "sin": - x = Math.sin(Math.toRadians(x)); - break; - case "cos": - x = Math.cos(Math.toRadians(x)); - break; - case "tan": - x = Math.tan(Math.toRadians(x)); - break; - default: - throw new RuntimeException("Unknown function: " + func); + case "sqrt": + x = Math.sqrt(x); + break; + case "sin": + x = Math.sin(Math.toRadians(x)); + break; + case "cos": + x = Math.cos(Math.toRadians(x)); + break; + case "tan": + x = Math.tan(Math.toRadians(x)); + break; + default: + throw new RuntimeException("Unknown function: " + func); } } else { throw new RuntimeException("Unexpected: " + (char)ch); diff --git a/src/main/resources/locales/de.yml b/src/main/resources/locales/de.yml new file mode 100644 index 0000000..950b8c0 --- /dev/null +++ b/src/main/resources/locales/de.yml @@ -0,0 +1,34 @@ +--- +admin: + level: + parameters: "" + description: Berechne das Insel Level für den Spieler + top: + remove: + description: entferne Spieler von Top-10 + parameters: "" + description: Zeige die Top-10 Liste + unknown-world: "&cUnbekannte Welt!" + display: "&f[rank]. &a[name] &7- &b[level]" +island: + level: + parameters: "[Spieler]" + description: Berechne dein Insel Level oder zeige das Level von [Spieler] + required-points-to-next-level: "&a[points] Punkte werden für das nächste Level + benötigt" + calculating: "&aBerechne Level..." + island-level-is: "&aInsel Level: &b[level]" + deaths: "&c([number] Tode)" + cooldown: "&cDu musst &b[time] &csekunden warten bevor du das erneut machen kannst." + value: + description: Zeige den Wert jedes Blockes + success-underwater: "&7Wert des Blockes Unterwasser: &e[value]" + success: "&7Wert: &e[value]" + empty-hand: "&cDu hast keinen Block in der Hand" + no-value: "&cDas Item hat kein wert!" + top: + description: Zeige die Top-10 + gui-title: "&aTop Zehn" + gui-heading: "&6[name]: &B[rank]" + island-level: "&BLevel [level]" + warp-to: "&ATeleportiere zu [name]'s Insel" diff --git a/src/main/resources/locales/fr.yml b/src/main/resources/locales/fr.yml index 740436c..3f906c0 100644 --- a/src/main/resources/locales/fr.yml +++ b/src/main/resources/locales/fr.yml @@ -1,41 +1,37 @@ -########################################################################################### -# This is a YML file. Be careful when editing. Check your edits in a YAML checker like # -# the one at http://yaml-online-parser.appspot.com # -########################################################################################### - +--- +admin: + level: + description: calcule le niveau d'île d'un joueur + parameters: "" + top: + description: affiche le top 10 des îles + display: "&f[rank]. &a[name] &7- &b[level]" + unknown-world: "&cMonde inconnu." + remove: + description: retire le joueur du top 10 + parameters: "" +island: + level: + calculating: "&aCalcul du niveau en cours..." + deaths: "&c([number] morts)" + description: calcule le niveau de votre île ou affiche le niveau d'un [joueur] + island-level-is: "&aLe niveau d'île est &b[level]" + parameters: "[joueur]" + required-points-to-next-level: "&a[points] points avant le prochain niveau" + cooldown: "&cVous devez attendre &b[time] &csecondes avant de pouvoir refaire + cette action" + top: + description: affiche le top 10 + gui-heading: "&6[name]: &B[rank]" + gui-title: "&aTop 10" + island-level: "&BNiveau [level]" + warp-to: "&ATéléportation vers l'île de [name]" + value: + description: affiche la valeur d'un bloc + success: "&7Valeur de ce bloc : &e[value]" + success-underwater: "&7Valeur de ce bloc en dessous du niveau de la mer : &e[value]" + empty-hand: "&cIl n'y a aucun bloc dans votre main" + no-value: "&cCet objet n'a pas de valeur." meta: authors: - plagoutte - -admin: - level: - parameters: "" - description: "calcule le niveau d'île d'un joueur" - top: - description: "affiche le top 10 des îles" - unknown-world: "&cMonde inconnu." - display: "&f[rank]. &a[name] &7- &b[level]" - -island: - level: - parameters: "[joueur]" - description: "calcule le niveau de votre île ou affiche le niveau d'un [joueur]" - calculating: "&aCalcul du niveau en cours..." - island-level-is: "&aLe niveau d'île est &b[level]" - required-points-to-next-level: "&a[points] points avant le prochain niveau" - deaths: "&c([number] morts)" - cooldown: "&cVous devez attendre &b[time] &csecondes avant de pouvoir re-faire cette action" - - top: - description: "affiche le top 10" - gui-title: "&aTop 10" - gui-heading: "&6[name]: &B[rank]" - island-level: "&BNiveau [level]" - warp-to: "&ATéléportation vers l'île de [name]" - - value: - description: "affiche la valeur d'un bloc" - success: "§7Valeur de ce bloc : §e[value]" - success-underwater: "§7Valeur de ce bloc en dessous du niveau de la mer : §e[value]" - empty-hand: "§cIl n'y a aucun bloc dans votre main" - no-value: "§cCet objet n'a pas de valeur."