From 805bde1891b3a229f50362a80ccde1a4242aa2f1 Mon Sep 17 00:00:00 2001 From: Maddy Miller Date: Mon, 6 Jan 2025 02:11:38 +1000 Subject: [PATCH] [Sponge] 1.21.4 (#2687) * [Sponge] 1.21.4 * Fix an error on launch --- gradle/libs.versions.toml | 6 +++--- .../com/sk89q/worldedit/sponge/SpongeWorldEdit.java | 12 +++++++----- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 636ab719f8..75372c385c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -15,10 +15,10 @@ fabric-api = "0.110.5+1.21.4" neogradle = "7.0.171" neoforge-minecraft = "1.21.4" -sponge-minecraft = "1.21.3" +sponge-minecraft = "1.21.4" # https://repo.spongepowered.org/service/rest/repository/browse/maven-public/org/spongepowered/spongeapi/ -sponge-api = "13.0.0-20241025.155029-3" -sponge-api-major = "13" +sponge-api = "14.0.0-20241229.134205-2" +sponge-api-major = "14" # https://parchmentmc.org/docs/getting-started; note that we use older MC versions some times which is OK parchment-minecraft = "1.21" diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorldEdit.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorldEdit.java index 9134274ee6..d7b08818f1 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorldEdit.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorldEdit.java @@ -80,6 +80,7 @@ import org.spongepowered.plugin.PluginContainer; import org.spongepowered.plugin.builtin.jvm.Plugin; +import java.lang.invoke.MethodHandles; import java.nio.file.Files; import java.nio.file.Path; import java.util.Collections; @@ -142,7 +143,8 @@ public void onPluginConstruction(ConstructPluginEvent event) { event.game().eventManager().registerListeners( container, - new CUIChannelHandler.RegistrationHandler() + new CUIChannelHandler.RegistrationHandler(), + MethodHandles.lookup() ); logger.info("WorldEdit for Sponge (version " + getInternalVersion() + ") is loaded"); } @@ -440,8 +442,8 @@ SpongeConfiguration getConfig() { public Actor wrapCommandCause(CommandCause cause) { Object rootCause = cause.root(); - if (rootCause instanceof ServerPlayer) { - return SpongeAdapter.adapt((ServerPlayer) rootCause); + if (rootCause instanceof ServerPlayer serverPlayer) { + return SpongeAdapter.adapt(serverPlayer); } if (rootCause instanceof LocatableBlock locatableBlock) { Optional optionalBlockEntity = locatableBlock.world().blockEntity(locatableBlock.blockPosition()); @@ -452,8 +454,8 @@ public Actor wrapCommandCause(CommandCause cause) { } } } - if (rootCause instanceof Audience) { - return new SpongeCommandSender((Audience) rootCause); + if (rootCause instanceof Audience audience) { + return new SpongeCommandSender(audience); } throw new UnsupportedOperationException("Cannot wrap " + rootCause.getClass());