From 9bea2620a1f785a68635436531968846cd30b739 Mon Sep 17 00:00:00 2001 From: tastybento Date: Mon, 10 Jul 2023 21:33:07 -0700 Subject: [PATCH 1/7] Update Jacoco --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1f80faa..a191ad6 100644 --- a/pom.xml +++ b/pom.xml @@ -293,7 +293,7 @@ org.jacoco jacoco-maven-plugin - 0.8.3 + 0.8.11 true From ccc03f5008494a24fd1ebb157b40f2fc2118c3d3 Mon Sep 17 00:00:00 2001 From: tastybento Date: Mon, 10 Jul 2023 21:37:49 -0700 Subject: [PATCH 2/7] Update pom.xml --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a191ad6..5a887c6 100644 --- a/pom.xml +++ b/pom.xml @@ -293,7 +293,7 @@ org.jacoco jacoco-maven-plugin - 0.8.11 + 0.8.10 true From 301e2dbb2654cbc2f9bf24e2eaee5db13b5f68bc Mon Sep 17 00:00:00 2001 From: tastybento Date: Mon, 4 Sep 2023 12:21:43 -0700 Subject: [PATCH 3/7] Remove debug. Clean up code. --- .../managers/SubmissionsManager.java | 1 - .../panels/ViewSubmissionsPanel.java | 245 +++++++++--------- 2 files changed, 120 insertions(+), 126 deletions(-) diff --git a/src/main/java/world/bentobox/checkmeout/managers/SubmissionsManager.java b/src/main/java/world/bentobox/checkmeout/managers/SubmissionsManager.java index 709561e..88637c5 100644 --- a/src/main/java/world/bentobox/checkmeout/managers/SubmissionsManager.java +++ b/src/main/java/world/bentobox/checkmeout/managers/SubmissionsManager.java @@ -76,7 +76,6 @@ public SubmissionsManager(CheckMeOut addon, BentoBox plugin) { * @return true if successful, false if not */ public boolean addSubmission(final UUID playerUUID, final Location loc) { - BentoBox.getInstance().logDebug("add ing submittion " + playerUUID + " " + loc); // Do not allow null players to set submissions if (playerUUID == null || loc == null) { return false; diff --git a/src/main/java/world/bentobox/checkmeout/panels/ViewSubmissionsPanel.java b/src/main/java/world/bentobox/checkmeout/panels/ViewSubmissionsPanel.java index e4e1aa4..27d05ce 100644 --- a/src/main/java/world/bentobox/checkmeout/panels/ViewSubmissionsPanel.java +++ b/src/main/java/world/bentobox/checkmeout/panels/ViewSubmissionsPanel.java @@ -34,9 +34,9 @@ */ public class ViewSubmissionsPanel { -// --------------------------------------------------------------------- -// Section: Constructor -// --------------------------------------------------------------------- + // --------------------------------------------------------------------- + // Section: Constructor + // --------------------------------------------------------------------- /** @@ -47,8 +47,8 @@ public class ViewSubmissionsPanel * @param user User who opens panel */ private ViewSubmissionsPanel(CheckMeOut addon, - World world, - User user) + World world, + User user) { this.addon = addon; this.user = user; @@ -58,9 +58,9 @@ private ViewSubmissionsPanel(CheckMeOut addon, } -// --------------------------------------------------------------------- -// Section: Methods -// --------------------------------------------------------------------- + // --------------------------------------------------------------------- + // Section: Methods + // --------------------------------------------------------------------- /** @@ -98,9 +98,9 @@ private void build() } -// --------------------------------------------------------------------- -// Section: Buttons -// --------------------------------------------------------------------- + // --------------------------------------------------------------------- + // Section: Buttons + // --------------------------------------------------------------------- /** @@ -116,7 +116,7 @@ private PanelItem createNextButton(@NonNull ItemTemplateRecord template, Templat int size = this.elementList.size(); if (size <= slot.amountMap().getOrDefault("ISLAND", 1) || - 1.0 * size / slot.amountMap().getOrDefault("ISLAND", 1) <= this.pageIndex + 1) + 1.0 * size / slot.amountMap().getOrDefault("ISLAND", 1) <= this.pageIndex + 1) { // There are no next elements return null; @@ -146,7 +146,7 @@ private PanelItem createNextButton(@NonNull ItemTemplateRecord template, Templat if (template.description() != null) { builder.description(this.user.getTranslation(this.world, template.description(), - "[number]", String.valueOf(nextPageIndex))); + "[number]", String.valueOf(nextPageIndex))); } // Add ClickHandler @@ -170,10 +170,10 @@ private PanelItem createNextButton(@NonNull ItemTemplateRecord template, Templat // Collect tooltips. List tooltips = template.actions().stream(). - filter(action -> action.tooltip() != null). - map(action -> this.user.getTranslation(this.world, action.tooltip())). - filter(text -> !text.isBlank()). - collect(Collectors.toCollection(() -> new ArrayList<>(template.actions().size()))); + filter(action -> action.tooltip() != null). + map(action -> this.user.getTranslation(this.world, action.tooltip())). + filter(text -> !text.isBlank()). + collect(Collectors.toCollection(() -> new ArrayList<>(template.actions().size()))); // Add tooltips. if (!tooltips.isEmpty()) @@ -227,7 +227,7 @@ private PanelItem createPreviousButton(@NonNull ItemTemplateRecord template, Tem if (template.description() != null) { builder.description(this.user.getTranslation(this.world, template.description(), - "[number]", String.valueOf(previousPageIndex))); + "[number]", String.valueOf(previousPageIndex))); } // Add ClickHandler @@ -252,10 +252,10 @@ private PanelItem createPreviousButton(@NonNull ItemTemplateRecord template, Tem // Collect tooltips. List tooltips = template.actions().stream(). - filter(action -> action.tooltip() != null). - map(action -> this.user.getTranslation(this.world, action.tooltip())). - filter(text -> !text.isBlank()). - collect(Collectors.toCollection(() -> new ArrayList<>(template.actions().size()))); + filter(action -> action.tooltip() != null). + map(action -> this.user.getTranslation(this.world, action.tooltip())). + filter(text -> !text.isBlank()). + collect(Collectors.toCollection(() -> new ArrayList<>(template.actions().size()))); // Add tooltips. if (!tooltips.isEmpty()) @@ -314,9 +314,9 @@ private PanelItem createRandomButton(ItemTemplateRecord template, TemplatedPanel } -// --------------------------------------------------------------------- -// Section: Other methods -// --------------------------------------------------------------------- + // --------------------------------------------------------------------- + // Section: Other methods + // --------------------------------------------------------------------- /** @@ -355,8 +355,8 @@ private PanelItem createIslandButton(ItemTemplateRecord template, UUID ownerUUID { // Check owner for a specific icon Material material = Material.matchMaterial( - Utils.getPermissionValue(owner, "checkmeout.icon", - this.addon.getSettings().getIslandIcon().name())); + Utils.getPermissionValue(owner, "checkmeout.icon", + this.addon.getSettings().getIslandIcon().name())); if (material == null) { @@ -377,21 +377,21 @@ private PanelItem createIslandButton(ItemTemplateRecord template, UUID ownerUUID if (template.title() != null) { builder.name(this.user.getTranslation(this.world, template.title(), - "[name]", island.getName() != null ? - island.getName() : owner.getName())); + "[name]", island.getName() != null ? + island.getName() : owner.getName())); } else { builder.name(this.user.getTranslation(reference + "name", - "[name]", island.getName() != null ? - island.getName() : owner.getName())); + "[name]", island.getName() != null ? + island.getName() : owner.getName())); } // Process Description of the button. // Generate [owner] text. String ownerText = this.user.getTranslationOrNothing(reference + "owner", - "[player]", owner.getName()); + "[player]", owner.getName()); // Generate [members] text String memberText; @@ -399,20 +399,20 @@ private PanelItem createIslandButton(ItemTemplateRecord template, UUID ownerUUID if (island.getMemberSet().size() > 1) { StringBuilder memberBuilder = new StringBuilder( - this.user.getTranslationOrNothing(reference + "members-title")); + this.user.getTranslationOrNothing(reference + "members-title")); island.getMemberSet().stream(). - map(this.addon.getPlayers()::getName). - forEach(user -> { - if (memberBuilder.length() > 0) - { - memberBuilder.append("\n"); - } + map(this.addon.getPlayers()::getName). + forEach(user -> { + if (memberBuilder.length() > 0) + { + memberBuilder.append("\n"); + } - memberBuilder.append( + memberBuilder.append( this.user.getTranslationOrNothing(reference + "member", - "[player]", user)); - }); + "[player]", user)); + }); memberText = memberBuilder.toString(); } @@ -436,22 +436,22 @@ private PanelItem createIslandButton(ItemTemplateRecord template, UUID ownerUUID "[members]", memberText, "[level]", levelText, "[likes]", likesText). - replaceAll("(?m)^[ \\t]*\\r?\\n", ""). - replaceAll("(? { - switch (action.actionType().toUpperCase()) - { - case "WARP" -> { - return island.getOwner() == null || - this.addon.getWarpAddon() == null || - !this.addon.getWarpAddon().getWarpSignsManager().hasWarp(this.world, island.getOwner()); - } - case "VISIT" -> { - return island.getOwner() == null || - this.addon.getVisitAddon() == null || - !this.addon.getVisitAddon().getAddonManager().preprocessTeleportation(this.user, island, true); - } - case "CHECK" -> { - String gamemode = Utils.getGameMode(this.world); + return switch (action.actionType().toUpperCase()) + { + case "WARP" -> island.getOwner() == null || + this.addon.getWarpAddon() == null || + !this.addon.getWarpAddon().getWarpSignsManager().hasWarp(this.world, island.getOwner()); - return gamemode.isBlank() || !this.user.hasPermission(gamemode + ".checkmeout.admin.check"); - } - default -> { - return false; - } - } + case "VISIT" -> island.getOwner() == null || + this.addon.getVisitAddon() == null || + !this.addon.getVisitAddon().getAddonManager().preprocessTeleportation(this.user, island, true); + + case "CHECK" -> { + String gamemode = Utils.getGameMode(this.world); + yield gamemode.isBlank() || !this.user.hasPermission(gamemode + ".checkmeout.admin.check"); + } + default -> false; + }; }); // Remove duplicated actions @@ -510,25 +505,25 @@ private PanelItem createIslandButton(ItemTemplateRecord template, UUID ownerUUID { switch (action.actionType().toUpperCase()) { - case "WARP" -> { - this.user.closeInventory(); - this.addon.getWarpAddon().getWarpSignsManager().warpPlayer(this.world, this.user, island.getOwner()); - } - case "VISIT" -> { - // Use Visit command because of delay. Delay is implemented via command executing. - String visitCommand = this.addon.getVisitAddon().getSettings().getPlayerMainCommand().split(" ")[0]; - - this.addon.getPlugin().getIWM().getAddon(this.world). - flatMap(GameModeAddon::getPlayerCommand).ifPresent(command -> - { - this.user.performCommand(command.getTopLabel() + " " + visitCommand + " " + island.getOwner()); - this.user.closeInventory(); - }); - } - case "CHECK" -> { + case "WARP" -> { + this.user.closeInventory(); + this.addon.getWarpAddon().getWarpSignsManager().warpPlayer(this.world, this.user, island.getOwner()); + } + case "VISIT" -> { + // Use Visit command because of delay. Delay is implemented via command executing. + String visitCommand = this.addon.getVisitAddon().getSettings().getPlayerMainCommand().split(" ")[0]; + + this.addon.getPlugin().getIWM().getAddon(this.world). + flatMap(GameModeAddon::getPlayerCommand).ifPresent(command -> + { + this.user.performCommand(command.getTopLabel() + " " + visitCommand + " " + island.getOwner()); this.user.closeInventory(); - this.addon.getSubmissionsManager().warpPlayer(this.world, user, ownerUUID); - } + }); + } + case "CHECK" -> { + this.user.closeInventory(); + this.addon.getSubmissionsManager().warpPlayer(this.world, user, ownerUUID); + } } } } @@ -538,10 +533,10 @@ private PanelItem createIslandButton(ItemTemplateRecord template, UUID ownerUUID // Collect tooltips. List tooltips = activeActions.stream(). - filter(action -> action.tooltip() != null). - map(action -> this.user.getTranslation(this.world, action.tooltip())). - filter(text -> !text.isBlank()). - collect(Collectors.toCollection(() -> new ArrayList<>(template.actions().size()))); + filter(action -> action.tooltip() != null). + map(action -> this.user.getTranslation(this.world, action.tooltip())). + filter(text -> !text.isBlank()). + collect(Collectors.toCollection(() -> new ArrayList<>(template.actions().size()))); // Add tooltips. if (!tooltips.isEmpty()) @@ -571,8 +566,8 @@ private String generateLevelText(UUID ownerUUID) int place = this.addon.getLevelAddon().getManager().getRank(this.world, ownerUUID); levelText = this.user.getTranslationOrNothing(reference, - "[level]", String.valueOf(level), - "[place]", String.valueOf(place)); + "[level]", String.valueOf(level), + "[place]", String.valueOf(place)); } else { @@ -604,42 +599,42 @@ private String generateLikesText(Island island) { switch (likesAddon.getSettings().getMode()) { - case LIKES -> { - long likes = existingIslandLikes.getLikes(); - int place = likesAddon.getAddonManager().getIslandRankByLikes(this.world, existingIslandLikes); + case LIKES -> { + long likes = existingIslandLikes.getLikes(); + int place = likesAddon.getAddonManager().getIslandRankByLikes(this.world, existingIslandLikes); - likesText = this.user.getTranslationOrNothing(reference + "likes", + likesText = this.user.getTranslationOrNothing(reference + "likes", "[likes]", String.valueOf(likes), "[place]", String.valueOf(place)); - } - case LIKES_DISLIKES -> { - long likes = existingIslandLikes.getLikes(); - long dislikes = existingIslandLikes.getDislikes(); - long rank = existingIslandLikes.getRank(); + } + case LIKES_DISLIKES -> { + long likes = existingIslandLikes.getLikes(); + long dislikes = existingIslandLikes.getDislikes(); + long rank = existingIslandLikes.getRank(); - int placeLikes = likesAddon.getAddonManager().getIslandRankByLikes(this.world, existingIslandLikes); - int placeDislikes = likesAddon.getAddonManager().getIslandRankByDislikes(this.world, existingIslandLikes); - int placeRank = likesAddon.getAddonManager().getIslandRankByRank(this.world, existingIslandLikes); + int placeLikes = likesAddon.getAddonManager().getIslandRankByLikes(this.world, existingIslandLikes); + int placeDislikes = likesAddon.getAddonManager().getIslandRankByDislikes(this.world, existingIslandLikes); + int placeRank = likesAddon.getAddonManager().getIslandRankByRank(this.world, existingIslandLikes); - likesText = this.user.getTranslationOrNothing(reference + "likes_dislikes", + likesText = this.user.getTranslationOrNothing(reference + "likes_dislikes", "[likes]", String.valueOf(likes), "[dislikes]", String.valueOf(dislikes), "[rank]", String.valueOf(rank), "[place_likes]", String.valueOf(placeLikes), "[place_dislikes]", String.valueOf(placeDislikes), "[place_rank]", String.valueOf(placeRank)); - } - case STARS -> { - double stars = existingIslandLikes.getStarsValue(); - int place = likesAddon.getAddonManager().getIslandRankByStars(this.world, existingIslandLikes); + } + case STARS -> { + double stars = existingIslandLikes.getStarsValue(); + int place = likesAddon.getAddonManager().getIslandRankByStars(this.world, existingIslandLikes); - likesText = this.user.getTranslationOrNothing(reference + "stars", + likesText = this.user.getTranslationOrNothing(reference + "stars", "[stars]", String.valueOf(stars), "[place]", String.valueOf(place)); - } - default -> { - likesText = ""; - } + } + default -> { + likesText = ""; + } } } else @@ -656,9 +651,9 @@ private String generateLikesText(Island island) } -// --------------------------------------------------------------------- -// Section: Static methods -// --------------------------------------------------------------------- + // --------------------------------------------------------------------- + // Section: Static methods + // --------------------------------------------------------------------- /** @@ -670,16 +665,16 @@ private String generateLikesText(Island island) * @param user User who opens panel */ public static void openPanel(CheckMeOut addon, - World world, - User user) + World world, + User user) { new ViewSubmissionsPanel(addon, world, user).build(); } -// --------------------------------------------------------------------- -// Section: Variables -// --------------------------------------------------------------------- + // --------------------------------------------------------------------- + // Section: Variables + // --------------------------------------------------------------------- /** From a8109e2fa6295c4e3391bf7200eac7083cc0559c Mon Sep 17 00:00:00 2001 From: BONNe Date: Wed, 3 Jan 2024 14:55:05 +0200 Subject: [PATCH 4/7] Upgrade dependencies. --- pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index 5a887c6..ea3621c 100644 --- a/pom.xml +++ b/pom.xml @@ -58,12 +58,12 @@ 2.0.2 - 1.16.4-R0.1-SNAPSHOT + 1.20-R0.1-SNAPSHOT 1.7 - 1.20.0 + 2.0.0-SNAPSHOT 1.12.0 @@ -73,7 +73,7 @@ 2.1.1 - 1.0.0 + 1.2.0 ${build.version}-SNAPSHOT From 2972bd60413b482a85675291978067bd782a8d9e Mon Sep 17 00:00:00 2001 From: tastybento Date: Sun, 21 Jan 2024 09:16:06 -0800 Subject: [PATCH 5/7] Update tipped arrows in GUI Panel --- src/main/resources/panels/view_panel.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/panels/view_panel.yml b/src/main/resources/panels/view_panel.yml index ba0eb6a..a08b7db 100644 --- a/src/main/resources/panels/view_panel.yml +++ b/src/main/resources/panels/view_panel.yml @@ -19,7 +19,7 @@ view_panel: 8: island_button 3: 1: - icon: TIPPED_ARROW:INSTANT_HEAL::::1 + icon: tipped_arrow{CustomPotionColor:11546150} title: checkmeout.gui.buttons.previous.name description: checkmeout.gui.buttons.previous.description data: @@ -37,7 +37,7 @@ view_panel: 7: island_button 8: island_button 9: - icon: TIPPED_ARROW:JUMP::::1 + icon: tipped_arrow{CustomPotionColor:8439583} title: checkmeout.gui.buttons.next.name description: checkmeout.gui.buttons.next.description data: From 7edcb4f50152306502918446ed4bfc5be56dc175 Mon Sep 17 00:00:00 2001 From: tastybento Date: Tue, 2 Jul 2024 11:17:56 -0700 Subject: [PATCH 6/7] Return the pladdon that was created --- .../java/world/bentobox/checkmeout/CheckMeOutPladdon.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/world/bentobox/checkmeout/CheckMeOutPladdon.java b/src/main/java/world/bentobox/checkmeout/CheckMeOutPladdon.java index d4b0843..e9f1ea6 100644 --- a/src/main/java/world/bentobox/checkmeout/CheckMeOutPladdon.java +++ b/src/main/java/world/bentobox/checkmeout/CheckMeOutPladdon.java @@ -10,8 +10,13 @@ */ public class CheckMeOutPladdon extends Pladdon { + private Addon addon; + @Override public Addon getAddon() { - return new CheckMeOut(); + if (addon == null) { + addon = new CheckMeOut(); + } + return addon; } } From a3214524fb4f7f71a59e2c7e0b562cea847ab3fd Mon Sep 17 00:00:00 2001 From: tastybento Date: Sat, 9 Nov 2024 15:26:36 -0800 Subject: [PATCH 7/7] CodeMC update --- pom.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index ea3621c..5beb31e 100644 --- a/pom.xml +++ b/pom.xml @@ -41,13 +41,9 @@ - - codemc-snapshots - https://repo.codemc.org/repository/maven-snapshots - - codemc-releases - https://repo.codemc.org/repository/maven-releases + bentoboxworld + https://repo.codemc.org/repository/bentoboxworld/ @@ -58,12 +54,12 @@ 2.0.2 - 1.20-R0.1-SNAPSHOT + 1.21.3-R0.1-SNAPSHOT 1.7 - 2.0.0-SNAPSHOT + 2.7.1-SNAPSHOT 1.12.0 @@ -128,6 +124,10 @@ spigot-repo https://hub.spigotmc.org/nexus/content/repositories/snapshots + + bentoboxworld + https://repo.codemc.org/repository/bentoboxworld/ + codemc https://repo.codemc.org/repository/maven-snapshots/