From d93f0608ec9da298c6f496fb4f81a551b7587aad Mon Sep 17 00:00:00 2001 From: tastybento Date: Fri, 31 Dec 2021 15:29:29 -0800 Subject: [PATCH] Release 1.11.2 (#101) * Version 1.11.2 * Renamed plugin Pladdon * Update es.yml (#98) * Build to BentoBox 1.18 API * Fix plugin.yml * Fix null player on removeWarp (#100) Co-authored-by: KrazyxWolf <68208993+KrazyxWolf@users.noreply.github.com> Co-authored-by: Huynh Tien --- pom.xml | 32 ++++++++++++++++-- .../bentobox/warps/WarpSignsManager.java | 9 +++-- src/main/resources/locales/es.yml | 33 ++++++++++--------- src/main/resources/plugin.yml | 4 +-- .../bentobox/warps/WarpSignsManagerTest.java | 1 + .../listeners/WarpSignsListenerTest.java | 1 + 6 files changed, 54 insertions(+), 26 deletions(-) diff --git a/pom.xml b/pom.xml index 3f946aa..049b07a 100644 --- a/pom.xml +++ b/pom.xml @@ -59,14 +59,14 @@ 2.0.9 1.17-R0.1-SNAPSHOT - 1.17.0 + 1.18.0-SNAPSHOT 2.7.0-SNAPSHOT ${build.version}-SNAPSHOT -LOCAL - 1.11.1 + 1.11.2 BentoBoxWorld_Warps bentobox-world @@ -229,7 +229,33 @@ 3.0.0-M5 - --illegal-access=permit + --add-opens java.base/java.lang=ALL-UNNAMED + --add-opens java.base/java.math=ALL-UNNAMED + --add-opens java.base/java.io=ALL-UNNAMED + --add-opens java.base/java.util=ALL-UNNAMED + --add-opens + java.base/java.util.stream=ALL-UNNAMED + --add-opens java.base/java.text=ALL-UNNAMED + --add-opens + java.base/java.util.regex=ALL-UNNAMED + --add-opens + java.base/java.nio.channels.spi=ALL-UNNAMED + --add-opens java.base/sun.nio.ch=ALL-UNNAMED + --add-opens java.base/java.net=ALL-UNNAMED + --add-opens + java.base/java.util.concurrent=ALL-UNNAMED + --add-opens java.base/sun.nio.fs=ALL-UNNAMED + --add-opens java.base/sun.nio.cs=ALL-UNNAMED + --add-opens java.base/java.nio.file=ALL-UNNAMED + --add-opens + java.base/java.nio.charset=ALL-UNNAMED + --add-opens + java.base/java.lang.reflect=ALL-UNNAMED + --add-opens + java.logging/java.util.logging=ALL-UNNAMED + --add-opens java.base/java.lang.ref=ALL-UNNAMED + --add-opens java.base/java.util.jar=ALL-UNNAMED + --add-opens java.base/java.util.zip=ALL-UNNAMED diff --git a/src/main/java/world/bentobox/warps/WarpSignsManager.java b/src/main/java/world/bentobox/warps/WarpSignsManager.java index 9164886..b4686f2 100644 --- a/src/main/java/world/bentobox/warps/WarpSignsManager.java +++ b/src/main/java/world/bentobox/warps/WarpSignsManager.java @@ -25,6 +25,7 @@ import org.bukkit.World; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.block.Sign; +import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; import org.bukkit.permissions.PermissionAttachmentInfo; import org.eclipse.jdt.annotation.NonNull; @@ -241,11 +242,9 @@ public class WarpSignsManager { Entry en = it.next(); if (en.getValue().equals(loc)) { // Inform player - User user = User.getInstance(addon.getServer().getPlayer(en.getKey())); - if (user != null) { - // Inform the player - user.sendMessage("warps.sign-removed"); - } + Optional.ofNullable(addon.getServer().getPlayer(en.getKey())) + .map(User::getInstance) + .ifPresent(user -> user.sendMessage("warps.sign-removed")); // Remove sign from warp panel cache addon.getWarpPanelManager().removeWarp(loc.getWorld(), en.getKey()); it.remove(); diff --git a/src/main/resources/locales/es.yml b/src/main/resources/locales/es.yml index 5e64759..eab36e9 100644 --- a/src/main/resources/locales/es.yml +++ b/src/main/resources/locales/es.yml @@ -6,25 +6,26 @@ warp: help: description: "Teletransportarte hacia el warp del jugador" - parameters: + parameters: warps: - deactivate: "&cViejo cartel a sido desactivado!" + deactivate: "&c¡El cartel viejo ha sido desactivado!" error: - does-not-exist: "&cOh snap! Ese warp ya no existe!" - no-permission: "&CNo tienes permiso para hacer eso!" - no-remove: "&CNo puedes quitar ese cartel!" - no-warps-yet: "&CNo hay warps disponibles aun" - not-enough-level: "&CTu nivel de isla no es lo suficientemente alto!" - not-on-island: "&CDebes estar en tu isla para hacer eso!" - not-safe: "&cEse warp no es seguro!" + does-not-exist: "&c¡Oh vaya! !Ese warp ya no existe!" + no-permission: "&c¡No tienes permiso para hacer eso!" + no-remove: "&c¡No puedes quitar ese cartel!" + no-warps-yet: "&cNo hay warps disponibles aún" + not-enough-level: "&c¡Tu nivel de isla no es lo suficientemente alto!" + not-on-island: "&c¡Debes estar en tu isla para hacer eso!" + not-safe: "&c¡Ese warp no es seguro!" your-level-is: "&cTu nivel de isla es solo [level] y debe ser mayor que [required]" help: description: "Abre el panel de warps" next: "&6Siguiente página" - player-warped: "&2[name] teletransportarte a tu warp!" - previous: "&6Pagina anterior" - sign-removed: "&CCartel removido!" - success: "&AExito!" - title: "Carteles de Warps" - warpTip: "&6Coloca un cartel con este texto [text] arriba" - warpToPlayersSign: "&6Teletransportandote al warp de [player]" \ No newline at end of file + player-warped: "&2[name] ¡se ha teletransportado a tu warp!" + previous: "&6Página anterior" + random: "&4Teletransporte aleatorio" + sign-removed: "&c¡Cartel removido!" + success: "&a¡Éxito!" + title: "Carteles de Warps" + warpTip: "&6Coloca un cartel que contenga el texto [text] arriba" + warpToPlayersSign: "&6Teletransportandote al warp de [player]" diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 8e0bfec..f26fe60 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -1,7 +1,7 @@ -name: Warps +name: Pladdon main: world.bentobox.warps.WarpsPladdon version: ${version} -api-version: 1.17 +api-version: 1.16 description: A Warp Pladdon for BentoBox author: tastybento depend: diff --git a/src/test/java/world/bentobox/warps/WarpSignsManagerTest.java b/src/test/java/world/bentobox/warps/WarpSignsManagerTest.java index bbb8efc..44a47f9 100644 --- a/src/test/java/world/bentobox/warps/WarpSignsManagerTest.java +++ b/src/test/java/world/bentobox/warps/WarpSignsManagerTest.java @@ -157,6 +157,7 @@ public class WarpSignsManagerTest { PowerMockito.mockStatic(Util.class); when(Util.getWorld(any())).thenAnswer((Answer) invocation -> invocation.getArgument(0, World.class)); when(Util.sameWorld(any(), any())).thenReturn(true); + when(Util.translateColorCodes(any())).thenAnswer((Answer) invocation -> invocation.getArgument(0, String.class)); // Location when(location.getWorld()).thenReturn(world); diff --git a/src/test/java/world/bentobox/warps/listeners/WarpSignsListenerTest.java b/src/test/java/world/bentobox/warps/listeners/WarpSignsListenerTest.java index 978c3d8..3e09509 100644 --- a/src/test/java/world/bentobox/warps/listeners/WarpSignsListenerTest.java +++ b/src/test/java/world/bentobox/warps/listeners/WarpSignsListenerTest.java @@ -166,6 +166,7 @@ public class WarpSignsListenerTest { PowerMockito.mockStatic(Util.class); when(Util.getWorld(any())).thenReturn(world); when(Util.stripSpaceAfterColorCodes(anyString())).thenAnswer(invocation -> invocation.getArgument(0, String.class)); + when(Util.translateColorCodes(any())).thenAnswer((Answer) invocation -> invocation.getArgument(0, String.class)); // Locales when(lm.get(any(User.class), anyString())).thenAnswer(answer);