diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 095eca217c..c4ff0808fe 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -46,16 +46,28 @@ val mixinVersion: String = properties.getProperty("mixin.version") dependencies { implementation(gradleApi()) implementation("gradle.plugin.org.cadixdev.gradle:licenser:0.6.1") - implementation("org.ajoberstar.grgit:grgit-gradle:5.2.1") - implementation("me.champeau.gradle:japicmp-gradle-plugin:0.4.0") + implementation("org.ajoberstar.grgit:grgit-gradle:5.2.2") + implementation("me.champeau.gradle:japicmp-gradle-plugin:0.4.2") implementation("com.github.johnrengelman:shadow:8.1.1") - implementation("org.jfrog.buildinfo:build-info-extractor-gradle:5.1.14") + implementation("org.jfrog.buildinfo:build-info-extractor-gradle:5.2.0") implementation("org.spongepowered:spongegradle-plugin-development:2.2.0") implementation("org.spongepowered:vanillagradle:0.2.1-20231105.223944-69") implementation("net.minecraftforge.gradle:ForgeGradle:6.0.21") implementation("net.fabricmc:fabric-loom:$loomVersion") implementation("net.fabricmc:sponge-mixin:$mixinVersion") implementation("org.enginehub.gradle:gradle-codecov-plugin:0.2.0") - implementation("io.papermc.paperweight.userdev:io.papermc.paperweight.userdev.gradle.plugin:1.5.11") + implementation("io.papermc.paperweight.userdev:io.papermc.paperweight.userdev.gradle.plugin:1.5.13") implementation("org.spongepowered:mixingradle:0.7.38") + constraints { + val asmVersion = "[9.7,)" + implementation("org.ow2.asm:asm:$asmVersion") { + because("Need Java 21 support in shadow") + } + implementation("org.ow2.asm:asm-commons:$asmVersion") { + because("Need Java 21 support in shadow") + } + implementation("org.vafer:jdependency:[2.10,)") { + because("Need Java 21 support in shadow") + } + } } diff --git a/buildSrc/src/main/kotlin/AdapterConfig.kt b/buildSrc/src/main/kotlin/AdapterConfig.kt index 04b30cbc7e..c940cb51d4 100644 --- a/buildSrc/src/main/kotlin/AdapterConfig.kt +++ b/buildSrc/src/main/kotlin/AdapterConfig.kt @@ -4,7 +4,7 @@ import org.gradle.kotlin.dsl.dependencies // For specific version pinning, see // https://repo.papermc.io/service/rest/repository/browse/maven-public/io/papermc/paper/dev-bundle/ -fun Project.applyPaperweightAdapterConfiguration(javaRelease: Int = 17) { +fun Project.applyPaperweightAdapterConfiguration(javaRelease: Int = 21) { applyCommonConfiguration() apply(plugin = "java-library") applyCommonJavaConfiguration( @@ -16,6 +16,11 @@ fun Project.applyPaperweightAdapterConfiguration(javaRelease: Int = 17) { dependencies { "implementation"(project(":worldedit-bukkit")) + constraints { + "remapper"("net.fabricmc:tiny-remapper:[0.8.11,)") { + because("Need remapper to support Java 21") + } + } } tasks.named("assemble") { diff --git a/buildSrc/src/main/kotlin/CommonConfig.kt b/buildSrc/src/main/kotlin/CommonConfig.kt index ba0f6bde87..e8bd844bbb 100644 --- a/buildSrc/src/main/kotlin/CommonConfig.kt +++ b/buildSrc/src/main/kotlin/CommonConfig.kt @@ -35,7 +35,7 @@ fun Project.applyCommonConfiguration() { plugins.withId("java") { the().toolchain { - languageVersion.set(JavaLanguageVersion.of(17)) + languageVersion.set(JavaLanguageVersion.of(21)) } } diff --git a/buildSrc/src/main/kotlin/CommonJavaConfig.kt b/buildSrc/src/main/kotlin/CommonJavaConfig.kt index c71ec265f6..5df3fb4f20 100644 --- a/buildSrc/src/main/kotlin/CommonJavaConfig.kt +++ b/buildSrc/src/main/kotlin/CommonJavaConfig.kt @@ -21,8 +21,9 @@ fun Project.applyCommonJavaConfiguration(sourcesJar: Boolean, javaRelease: Int = .withType() .matching { it.name == "compileJava" || it.name == "compileTestJava" } .configureEach { + // TODO: re-enable this-escape when ANTLR suppresses it properly val disabledLint = listOf( - "processing", "path", "fallthrough", "serial", "overloads", + "processing", "path", "fallthrough", "serial", "overloads", "this-escape", ) options.release.set(javaRelease) options.compilerArgs.addAll(listOf("-Xlint:all") + disabledLint.map { "-Xlint:-$it" }) diff --git a/buildSrc/src/main/kotlin/PlatformConfig.kt b/buildSrc/src/main/kotlin/PlatformConfig.kt index b39ee71939..cdf30b7a8f 100644 --- a/buildSrc/src/main/kotlin/PlatformConfig.kt +++ b/buildSrc/src/main/kotlin/PlatformConfig.kt @@ -11,7 +11,7 @@ import org.gradle.kotlin.dsl.named import org.gradle.kotlin.dsl.register import kotlin.collections.set -fun Project.applyPlatformAndCoreConfiguration(javaRelease: Int = 17) { +fun Project.applyPlatformAndCoreConfiguration(javaRelease: Int = 21) { applyCommonConfiguration() apply(plugin = "java") apply(plugin = "maven-publish") diff --git a/gradle.properties b/gradle.properties index b9fb782bcf..1642c4490e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,5 +4,5 @@ version=7.3.1-SNAPSHOT org.gradle.jvmargs=-Xmx2G org.gradle.parallel=true -loom.version=1.5.6 -mixin.version=0.12.5+mixin.0.8.5 +loom.version=1.6.6 +mixin.version=0.13.2+mixin.0.8.5 diff --git a/settings.gradle.kts b/settings.gradle.kts index 0ae0b6bc14..0b145f0b92 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -16,11 +16,11 @@ rootProject.name = "worldedit" include("worldedit-libs") -listOf("1.18.2", "1.19.4", "1.20", "1.20.2", "1.20.4").forEach { +listOf("1.19.4", "1.20", "1.20.2", "1.20.4").forEach { include("worldedit-bukkit:adapters:adapter-$it") } -listOf("bukkit", "core", "sponge", "fabric", "forge", "cli").forEach { +listOf("bukkit", "core", "fabric", "forge", "cli").forEach { include("worldedit-libs:$it") include("worldedit-$it") } diff --git a/verification/build.gradle.kts b/verification/build.gradle.kts index 98aea05f62..d855e6208a 100644 --- a/verification/build.gradle.kts +++ b/verification/build.gradle.kts @@ -43,7 +43,7 @@ tasks.check { // Generic setup for all tasks // Pull the version before our current version. val baseVersion = "(,${rootProject.version.toString().substringBefore("-SNAPSHOT")}[" -for (projectFragment in listOf("bukkit", "cli", "core", "fabric", "forge", "sponge")) { +for (projectFragment in listOf("bukkit", "cli", "core", "fabric", "forge")) { val capitalizedFragment = projectFragment.replaceFirstChar { if (it.isLowerCase()) it.titlecase(Locale.ROOT) else it.toString() } val proj = project(":worldedit-$projectFragment") diff --git a/worldedit-core/build.gradle.kts b/worldedit-core/build.gradle.kts index 17a8a7cf46..96f859cba5 100644 --- a/worldedit-core/build.gradle.kts +++ b/worldedit-core/build.gradle.kts @@ -57,7 +57,7 @@ dependencies { "implementation"("it.unimi.dsi:fastutil") - val antlrVersion = "4.9.1" + val antlrVersion = "4.13.1" "antlr"("org.antlr:antlr4:$antlrVersion") "implementation"("org.antlr:antlr4-runtime:$antlrVersion") diff --git a/worldedit-core/doctools/build.gradle.kts b/worldedit-core/doctools/build.gradle.kts index 6f2123f20f..f51cc415ea 100644 --- a/worldedit-core/doctools/build.gradle.kts +++ b/worldedit-core/doctools/build.gradle.kts @@ -1,16 +1,10 @@ -import org.jetbrains.kotlin.gradle.tasks.KotlinCompile - plugins { - kotlin("jvm") version "1.8.20" + kotlin("jvm") version "1.9.23" application } applyCommonConfiguration() -tasks.withType { - kotlinOptions.jvmTarget = "17" -} - application.mainClass.set("com.sk89q.worldedit.internal.util.DocumentationPrinter") tasks.named("run") { workingDir = rootProject.projectDir diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEditManifest.java b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEditManifest.java index 8d8de2af7b..2132f727e9 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEditManifest.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/WorldEditManifest.java @@ -22,6 +22,7 @@ import java.io.IOException; import java.io.UncheckedIOException; import java.net.JarURLConnection; +import java.net.URI; import java.net.URL; import java.util.function.Supplier; import java.util.jar.Attributes; @@ -72,8 +73,7 @@ public static WorldEditManifest load() { } try { - URL url = new URL(classPath); - JarURLConnection jarConnection = (JarURLConnection) url.openConnection(); + JarURLConnection jarConnection = (JarURLConnection) URI.create(classPath).toURL().openConnection(); Manifest manifest = jarConnection.getManifest(); return manifest.getMainAttributes(); } catch (IOException e) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/BaseEntity.java b/worldedit-core/src/main/java/com/sk89q/worldedit/entity/BaseEntity.java index 74cc77738b..36935125af 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/BaseEntity.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/entity/BaseEntity.java @@ -55,6 +55,7 @@ public class BaseEntity implements NbtValued { * @param nbtData NBT data * @deprecated Use {@link BaseEntity#BaseEntity(EntityType, LazyReference)} */ + @SuppressWarnings("this-escape") @Deprecated public BaseEntity(EntityType type, CompoundTag nbtData) { this(type); @@ -67,6 +68,7 @@ public BaseEntity(EntityType type, CompoundTag nbtData) { * @param type the entity type * @param nbtData NBT data */ + @SuppressWarnings("this-escape") public BaseEntity(EntityType type, LazyReference nbtData) { this(type); setNbtReference(nbtData); @@ -86,6 +88,7 @@ public BaseEntity(EntityType type) { * * @param other the object to clone */ + @SuppressWarnings("this-escape") public BaseEntity(BaseEntity other) { checkNotNull(other); this.type = other.getType(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/BlockChangeLimiter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/BlockChangeLimiter.java index dd93c8527d..91a64ba38b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/BlockChangeLimiter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/validation/BlockChangeLimiter.java @@ -43,6 +43,7 @@ public class BlockChangeLimiter extends AbstractDelegateExtent { * @param extent the extent * @param limit the limit (>= 0) or -1 for no limit */ + @SuppressWarnings("this-escape") // Unlikely anyone is extending this in practice public BlockChangeLimiter(Extent extent, int limit) { super(extent); setLimit(limit); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Polygonal2DRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Polygonal2DRegion.java index 30fde408ce..b54baed6e0 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Polygonal2DRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Polygonal2DRegion.java @@ -276,17 +276,13 @@ public void contract(BlockVector3... changes) throws RegionOperationException { @Override public void shift(BlockVector3 change) throws RegionOperationException { - final double changeX = change.x(); - final double changeY = change.y(); - final double changeZ = change.z(); - for (int i = 0; i < points.size(); ++i) { BlockVector2 point = points.get(i); - points.set(i, BlockVector2.at(point.x() + changeX, point.z() + changeZ)); + points.set(i, BlockVector2.at(point.x() + change.x(), point.z() + change.z())); } - minY += changeY; - maxY += changeY; + minY += change.y(); + maxY += change.y(); recalculate(); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/io/ForwardSeekableInputStream.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/io/ForwardSeekableInputStream.java index 3fb87bde35..328bfdb8cf 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/io/ForwardSeekableInputStream.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/io/ForwardSeekableInputStream.java @@ -60,7 +60,7 @@ public boolean markSupported() { @Override public int read(byte[] b, int off, int len) throws IOException { - int read = super.read(b, off, len); + int read = parent.read(b, off, len); position += read; return read; } @@ -86,6 +86,7 @@ public long skip(long n) throws IOException { public void seek(long n) throws IOException { long diff = n - position; + System.err.println("Seek to " + n + " from position " + position + " using " + diff); if (diff < 0) { throw new IOException("Can't seek backwards"); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/net/HttpRequest.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/net/HttpRequest.java index cdcb894ead..b06e81f826 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/net/HttpRequest.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/net/HttpRequest.java @@ -353,7 +353,7 @@ public static HttpRequest request(String method, URL url) { */ public static URL url(String url) { try { - return new URL(url); + return URI.create(url).toURL(); } catch (MalformedURLException e) { throw new RuntimeException(e); } @@ -367,12 +367,7 @@ public static URL url(String url) { */ private static URL reformat(URL existing) { try { - URL url = new URL(existing.toString()); - URI uri = new URI( - url.getProtocol(), url.getUserInfo(), url.getHost(), url.getPort(), - url.getPath(), url.getQuery(), url.getRef()); - url = uri.toURL(); - return url; + return existing.toURI().toURL(); } catch (MalformedURLException | URISyntaxException e) { return existing; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/paste/EngineHubPaste.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/paste/EngineHubPaste.java index a5bf59e4f7..0e66ac24cb 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/paste/EngineHubPaste.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/paste/EngineHubPaste.java @@ -24,6 +24,7 @@ import com.sk89q.worldedit.util.net.HttpRequest; import java.io.IOException; +import java.net.URI; import java.net.URL; import java.util.Map; import java.util.concurrent.Callable; @@ -82,7 +83,7 @@ public URL call() throws IOException, InterruptedException { .execute() .expectResponseCode(200, 204); - return new URL(response.viewUrl); + return URI.create(response.viewUrl).toURL(); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/task/FutureForwardingTask.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/task/FutureForwardingTask.java index 07cde87f10..a30b523dd5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/task/FutureForwardingTask.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/task/FutureForwardingTask.java @@ -82,21 +82,22 @@ public V get(long timeout, TimeUnit unit) throws InterruptedException, Execution return future.get(timeout, unit); } + // TODO: consider deprecating in favor of Future.State? @Override - public State getState() { + public Task.State getState() { if (isCancelled()) { - return State.CANCELLED; + return Task.State.CANCELLED; } else if (isDone()) { try { get(); - return State.SUCCEEDED; + return Task.State.SUCCEEDED; } catch (InterruptedException e) { - return State.CANCELLED; + return Task.State.CANCELLED; } catch (ExecutionException e) { - return State.FAILED; + return Task.State.FAILED; } } else { - return State.RUNNING; + return Task.State.RUNNING; } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/translation/TranslationManager.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/translation/TranslationManager.java index ddeecbcced..432383fb87 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/translation/TranslationManager.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/translation/TranslationManager.java @@ -158,7 +158,7 @@ private MessageFormat getTranslation(Locale locale, String key) { // Recurse into other options if not already at the base condition (defaultLocale) if (!locale.getCountry().isEmpty()) { // try without country modifier - return getTranslation(new Locale(locale.getLanguage()), key); + return getTranslation(Locale.of(locale.getLanguage()), key); } // otherwise, try the default locale return getTranslation(defaultLocale, key); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java index 331c110374..27cfe95270 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java @@ -49,21 +49,28 @@ public class BlockType implements Keyed { private final Function values; private final LazyReference defaultState = LazyReference.from(this::computeDefaultState); + @SuppressWarnings("this-escape") private final LazyReference emptyFuzzy = LazyReference.from(() -> new FuzzyBlockState(this)); + @SuppressWarnings("this-escape") private final LazyReference>> properties = LazyReference.from(() -> ImmutableMap.copyOf(WorldEdit.getInstance().getPlatformManager() .queryCapability(Capability.GAME_HOOKS).getRegistries().getBlockRegistry().getProperties(this))); + @SuppressWarnings("this-escape") private final LazyReference blockMaterial = LazyReference.from(() -> WorldEdit.getInstance().getPlatformManager() .queryCapability(Capability.GAME_HOOKS).getRegistries().getBlockRegistry().getMaterial(this)); + @SuppressWarnings("this-escape") private final LazyReference, Object>, BlockState>> blockStatesMap = LazyReference.from(() -> BlockState.generateStateMap(this)); + @SuppressWarnings("this-escape") @Deprecated private final LazyReference name = LazyReference.from(() -> WorldEdit.getInstance().getPlatformManager() .queryCapability(Capability.GAME_HOOKS).getRegistries().getBlockRegistry().getName(this)); + @SuppressWarnings("this-escape") private final LazyReference legacyId = LazyReference.from(() -> computeLegacy(0)); + @SuppressWarnings("this-escape") private final LazyReference legacyData = LazyReference.from(() -> computeLegacy(1)); public BlockType(String id) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk13.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk13.java index 687607c454..dcb9979802 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk13.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk13.java @@ -156,7 +156,7 @@ protected void readBlockStates(BlockState[] palette, long[] blockStatesSerialize throw new InvalidFormatException("Too short block state table"); } currentSerializedValue = blockStatesSerialized[nextSerializedItem++]; - localBlockId |= (currentSerializedValue & ((1L << bitsNextLong) - 1)) << remainingBits; + localBlockId |= (int) (currentSerializedValue & ((1L << bitsNextLong) - 1)) << remainingBits; currentSerializedValue >>>= bitsNextLong; remainingBits = 64 - bitsNextLong; } else { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemType.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemType.java index fc838c3968..29e44fd916 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemType.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemType.java @@ -37,7 +37,7 @@ public class ItemType implements Keyed { public static final NamespacedRegistry REGISTRY = new NamespacedRegistry<>("item type", true); private final String id; - @SuppressWarnings("deprecation") + @SuppressWarnings({"deprecation", "this-escape"}) private final LazyReference name = LazyReference.from(() -> { String name = GuavaUtil.firstNonNull( WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS) @@ -46,10 +46,12 @@ public class ItemType implements Keyed { ); return name.isEmpty() ? id() : name; }); + @SuppressWarnings("this-escape") private final LazyReference richName = LazyReference.from(() -> WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS) .getRegistries().getItemRegistry().getRichName(this) ); + @SuppressWarnings("this-escape") private final LazyReference itemMaterial = LazyReference.from(() -> WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS) .getRegistries().getItemRegistry().getMaterial(this) diff --git a/worldedit-fabric/build.gradle.kts b/worldedit-fabric/build.gradle.kts index 00e2b8b4f1..357d81066d 100644 --- a/worldedit-fabric/build.gradle.kts +++ b/worldedit-fabric/build.gradle.kts @@ -2,13 +2,14 @@ import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar import net.fabricmc.loom.api.LoomGradleExtensionAPI import net.fabricmc.loom.configuration.FabricApiExtension import net.fabricmc.loom.task.RemapJarTask +import net.fabricmc.loom.task.RunGameTask plugins { id("fabric-loom") `java-library` } -applyPlatformAndCoreConfiguration(javaRelease = 17) +applyPlatformAndCoreConfiguration() applyShadowConfiguration() val minecraftVersion = "1.20.4" @@ -20,6 +21,10 @@ configure { accessWidenerPath.set(project.file("src/main/resources/worldedit.accesswidener")) } +tasks.withType().configureEach { + javaLauncher.set(javaToolchains.launcherFor(java.toolchain)) +} + repositories { maven { name = "Fabric" diff --git a/worldedit-forge/build.gradle.kts b/worldedit-forge/build.gradle.kts index 84c5c694ad..522d21da28 100644 --- a/worldedit-forge/build.gradle.kts +++ b/worldedit-forge/build.gradle.kts @@ -10,7 +10,7 @@ plugins { `java-library` } -applyPlatformAndCoreConfiguration(javaRelease = 17) +applyPlatformAndCoreConfiguration() applyShadowConfiguration() val minecraftVersion = "1.20.4" diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeResourceLoader.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeResourceLoader.java index 043ffb24c7..cb480efdb2 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeResourceLoader.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeResourceLoader.java @@ -23,6 +23,7 @@ import com.sk89q.worldedit.util.io.WorldEditResourceLoader; import java.io.IOException; +import java.net.URI; import java.net.URL; public class ForgeResourceLoader extends WorldEditResourceLoader { @@ -33,9 +34,9 @@ public ForgeResourceLoader(WorldEdit worldEdit) { private static URL getResourceForgeHack(String location) throws IOException { try { - URL url = new URL("modjar://worldedit/" + location); + URL url = URI.create("modjar://worldedit/" + location).toURL(); try { - url.openStream(); + url.openStream().close(); } catch (IOException e) { // doesn't actually exist return null; diff --git a/worldedit-sponge/build.gradle.kts b/worldedit-sponge/build.gradle.kts index 2844f523e8..3debe99bad 100644 --- a/worldedit-sponge/build.gradle.kts +++ b/worldedit-sponge/build.gradle.kts @@ -7,7 +7,7 @@ plugins { id("org.spongepowered.gradle.vanilla") } -applyPlatformAndCoreConfiguration(javaRelease = 17) +applyPlatformAndCoreConfiguration() applyShadowConfiguration() repositories {