From 6f2f9c4ed1828db1ec59fc161e3cefaabe2c2835 Mon Sep 17 00:00:00 2001 From: Efnilite Date: Sat, 23 Apr 2022 13:54:57 +0200 Subject: [PATCH] Fix StackOverflowException and release hotfix --- pom.xml | 2 +- witp/pom.xml | 6 +-- .../java/dev/efnilite/ip/ParkourCommand.java | 13 ++--- .../ip/generator/DefaultGenerator.java | 2 +- .../dev/efnilite/ip/menu/SettingsMenu.java | 51 ++++++++++--------- witp/src/main/resources/plugin.yml | 2 +- 6 files changed, 39 insertions(+), 37 deletions(-) diff --git a/pom.xml b/pom.xml index 7d29160d..b0cfdf39 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ dev.efnilite WITP pom - 3.2.3 + 3.2.4 witp diff --git a/witp/pom.xml b/witp/pom.xml index 0433fe4b..11c28a40 100644 --- a/witp/pom.xml +++ b/witp/pom.xml @@ -5,12 +5,12 @@ WITP dev.efnilite - 3.2.3 + 3.2.4 4.0.0 witp - 3.2.3 + 3.2.4 11 @@ -143,7 +143,7 @@ com.github.ViStudios vilib - e3fd4c381b + 04af827647 compile diff --git a/witp/src/main/java/dev/efnilite/ip/ParkourCommand.java b/witp/src/main/java/dev/efnilite/ip/ParkourCommand.java index 50aadfb0..600ee24a 100644 --- a/witp/src/main/java/dev/efnilite/ip/ParkourCommand.java +++ b/witp/src/main/java/dev/efnilite/ip/ParkourCommand.java @@ -2,7 +2,6 @@ import dev.efnilite.ip.menu.GamemodeMenu; import dev.efnilite.ip.menu.LeaderboardMenu; -import dev.efnilite.ip.menu.MainMenu; import dev.efnilite.ip.player.ParkourPlayer; import dev.efnilite.ip.player.ParkourUser; import dev.efnilite.ip.player.data.InventoryData; @@ -55,11 +54,13 @@ public boolean execute(CommandSender sender, String[] args) { if (args.length == 0) { // Main menu - if (player == null) { - sendHelpMessages(sender); - } else if (ParkourOption.MENU.check(player)) { - MainMenu.open(player); - } + sendHelpMessages(sender); + +// if (player == null) { +// sendHelpMessages(sender); +// } else if (ParkourOption.MENU.check(player)) { +// MainMenu.open(player); +// } return true; } else if (args.length == 1) { switch (args[0].toLowerCase()) { diff --git a/witp/src/main/java/dev/efnilite/ip/generator/DefaultGenerator.java b/witp/src/main/java/dev/efnilite/ip/generator/DefaultGenerator.java index f84a7ef5..c27b892e 100644 --- a/witp/src/main/java/dev/efnilite/ip/generator/DefaultGenerator.java +++ b/witp/src/main/java/dev/efnilite/ip/generator/DefaultGenerator.java @@ -1,12 +1,12 @@ package dev.efnilite.ip.generator; import dev.efnilite.ip.IP; -import dev.efnilite.ip.menu.SettingsMenu; import dev.efnilite.ip.events.BlockGenerateEvent; import dev.efnilite.ip.events.PlayerFallEvent; import dev.efnilite.ip.events.PlayerScoreEvent; import dev.efnilite.ip.generator.base.DefaultGeneratorBase; import dev.efnilite.ip.generator.base.GeneratorOption; +import dev.efnilite.ip.menu.SettingsMenu; import dev.efnilite.ip.player.ParkourPlayer; import dev.efnilite.ip.reward.RewardReader; import dev.efnilite.ip.reward.RewardString; diff --git a/witp/src/main/java/dev/efnilite/ip/menu/SettingsMenu.java b/witp/src/main/java/dev/efnilite/ip/menu/SettingsMenu.java index 2b66eb50..8b7a7bd7 100644 --- a/witp/src/main/java/dev/efnilite/ip/menu/SettingsMenu.java +++ b/witp/src/main/java/dev/efnilite/ip/menu/SettingsMenu.java @@ -4,6 +4,7 @@ import dev.efnilite.ip.ParkourOption; import dev.efnilite.ip.api.StyleType; import dev.efnilite.ip.player.ParkourPlayer; +import dev.efnilite.ip.player.ParkourUser; import dev.efnilite.ip.util.Util; import dev.efnilite.ip.util.config.Configuration; import dev.efnilite.ip.util.config.Option; @@ -259,31 +260,31 @@ public static void open(ParkourPlayer user, ParkourOption... disabledOptions) { })); } -// if (checkOptions(player, ParkourOption.GAMEMODE, disabledOptions)) { -// Item item = config.getFromItemData(user.getLocale(), "options." + ParkourOption.GAMEMODE.getName()); -// -// main.item(19, item.click(event -> GamemodeMenu.open(user))); -// } -// -// if (checkOptions(player, ParkourOption.LEADERBOARD, disabledOptions)) { -// Item item = config.getFromItemData(user.getLocale(), "options." + ParkourOption.LEADERBOARD.getName()) -// .modifyLore(line -> // #%n (%s) -// line.replace("%s", "#" + ParkourUser.getRank(user.getUUID()) + " (" + -// user.highScore.toString()) + ")"); -// -// main.item(20, item.click(event -> { -// player.closeInventory(); -// LeaderboardMenu.open(player); -// })); -// } -// -// if (checkOptions(player, ParkourOption.LANGUAGE, disabledOptions)) { -// Item item = config.getFromItemData(user.getLocale(), "options." + ParkourOption.LANGUAGE.getName()) -// .modifyLore(line -> -// line.replace("%s", user.getLocale())); -// -// main.item(21, item.click(event -> LangMenu.open(user, disabledOptions))); -// } todo remove/transfer + if (checkOptions(player, ParkourOption.GAMEMODE, disabledOptions)) { + Item item = config.getFromItemData(user.getLocale(), "options." + ParkourOption.GAMEMODE.getName()); + + main.item(19, item.click(event -> GamemodeMenu.open(user))); + } + + if (checkOptions(player, ParkourOption.LEADERBOARD, disabledOptions)) { + Item item = config.getFromItemData(user.getLocale(), "options." + ParkourOption.LEADERBOARD.getName()) + .modifyLore(line -> // #%n (%s) + line.replace("%s", "#" + ParkourUser.getRank(user.getUUID()) + " (" + + user.highScore.toString()) + ")"); + + main.item(20, item.click(event -> { + player.closeInventory(); + LeaderboardMenu.open(player); + })); + } + + if (checkOptions(player, ParkourOption.LANGUAGE, disabledOptions)) { + Item item = config.getFromItemData(user.getLocale(), "options." + ParkourOption.LANGUAGE.getName()) + .modifyLore(line -> + line.replace("%s", user.getLocale())); + + main.item(21, item.click(event -> LangMenu.open(user, disabledOptions))); + } // opens the menu main diff --git a/witp/src/main/resources/plugin.yml b/witp/src/main/resources/plugin.yml index 74fcf167..4f7b32c6 100644 --- a/witp/src/main/resources/plugin.yml +++ b/witp/src/main/resources/plugin.yml @@ -1,7 +1,7 @@ name: 'WITP' description: 'Infinitely automatically generating parkour plugin.' author: Efnilite, Ice_Pancake -version: 3.2.3 +version: 3.2.4 api-version: 1.16 main: dev.efnilite.ip.IP softdepend: [Vault, PlaceholderAPI, ProtocolAPI, Multiverse-Core, HolographicDisplays, NoteBlockAPI, WVoidGen, VoidGen]