From e4700b0e0495becbe4030f893ef26b910cdd6e63 Mon Sep 17 00:00:00 2001 From: Efnilite Date: Thu, 14 Oct 2021 20:48:27 +0200 Subject: [PATCH] Update to v2.6c --- pom.xml | 2 +- .../witp/generator/DefaultGenerator.java | 32 +++++++++++++------ .../efnilite/witp/player/ParkourPlayer.java | 17 +++++++--- src/main/resources/plugin.yml | 2 +- 4 files changed, 37 insertions(+), 16 deletions(-) diff --git a/pom.xml b/pom.xml index 780b6163..c126a7b1 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ dev.efnilite WITP - 2.6b + 2.6c diff --git a/src/main/java/dev/efnilite/witp/generator/DefaultGenerator.java b/src/main/java/dev/efnilite/witp/generator/DefaultGenerator.java index 887f0584..c97dbd27 100644 --- a/src/main/java/dev/efnilite/witp/generator/DefaultGenerator.java +++ b/src/main/java/dev/efnilite/witp/generator/DefaultGenerator.java @@ -165,25 +165,37 @@ public void run() { if (!stopwatch.hasStarted()) { stopwatch.start(); } - // update scores - score++; - totalScore++; - score(); - checkRewards(); latestLocation = current.getLocation(); - new PlayerScoreEvent(player).call(); List locations = new ArrayList<>(buildLog.keySet()); int lastIndex = locations.indexOf(last) + 1; int size = locations.size(); - for (int i = lastIndex; i < size; i++) { - Block block = Util.parseLocation(locations.get(i)).getBlock(); - if (block.getType() != Material.AIR) { + if (Option.ALL_POINTS) { + if (score == 0) { score++; - block.setType(Material.AIR); + totalScore++; + score(); + checkRewards(); } + for (int i = lastIndex; i < size; i++) { + Block block = Util.parseLocation(locations.get(i)).getBlock(); + if (block.getType() != Material.AIR) { + score++; + totalScore++; + score(); + checkRewards(); + block.setType(Material.AIR); + } + } + } else { + score++; + totalScore++; + score(); + checkRewards(); } + + new PlayerScoreEvent(player).call(); if (deleteStructure) { deleteStructure(); } diff --git a/src/main/java/dev/efnilite/witp/player/ParkourPlayer.java b/src/main/java/dev/efnilite/witp/player/ParkourPlayer.java index be8ce41b..77c5db21 100644 --- a/src/main/java/dev/efnilite/witp/player/ParkourPlayer.java +++ b/src/main/java/dev/efnilite/witp/player/ParkourPlayer.java @@ -365,7 +365,7 @@ public void menu() { } builder.setItem(18, WITP.getConfiguration().getFromItemData(locale, "options.gamemode"), (t2, e2) -> { - if (checkOptions("gamemode", "witp.gamemode")) { + if (alertCheckOptions("gamemode", "witp.gamemode")) { gamemode(); } }); @@ -373,13 +373,13 @@ public void menu() { builder.setItem(19, WITP.getConfiguration().getFromItemData(locale, "options.leaderboard", getTranslated("your-rank", Integer.toString(getRank(uuid)), Integer.toString(score == null ? 0 : score))), (t2, e2) -> { - if (checkOptions("leaderboard", "witp.leaderboard")) { + if (alertCheckOptions("leaderboard", "witp.leaderboard")) { leaderboard(this, player, 1); player.closeInventory(); } }); builder.setItem(22, WITP.getConfiguration().getFromItemData(locale, "options.language", locale), (t2, e2) -> { - if (checkOptions("language", "witp.language")) { + if (alertCheckOptions("language", "witp.language")) { List langs = Option.LANGUAGES; InventoryBuilder.DynamicInventory dynamic1 = new InventoryBuilder.DynamicInventory(langs.size(), 1); for (String langName : langs) { @@ -500,7 +500,7 @@ public void confirmReset(String item) { return possibleStyles; } - private boolean checkOptions(String option, @Nullable String perm) { + private boolean alertCheckOptions(String option, @Nullable String perm) { boolean enabled = WITP.getConfiguration().getFile("items").getBoolean("items.options." + option + ".enabled"); if (!enabled) { sendTranslated("cant-do"); @@ -510,6 +510,15 @@ private boolean checkOptions(String option, @Nullable String perm) { } } + private boolean checkOptions(String option, @Nullable String perm) { + boolean enabled = WITP.getConfiguration().getFile("items").getBoolean("items.options." + option + ".enabled"); + if (!enabled) { + return false; + } else { + return checkPermission(perm); + } + } + private void saveStats() { save(true); } diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 30ade1d5..740d4c64 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,7 +1,7 @@ name: 'WITP' description: 'Automatically generating, infinitely long parkour plugin. The sky, and your time, is the limit. The further you go, the harder it gets. Should be a walk in the park, right?' author: Efnilite, Ice_Pancake -version: 2.6b +version: 2.6c api-version: 1.16 main: dev.efnilite.witp.WITP softdepend: [Vault, PlaceholderAPI, ProtocolAPI, Multiverse-Core, WVoidGen, VoidGen]