From e13a8ac6ba5c8d4afa4d372b8c1424a115bd0d39 Mon Sep 17 00:00:00 2001 From: david Date: Thu, 26 Dec 2024 17:32:26 +0100 Subject: [PATCH 1/6] Replace `@NotNull` annotations with `@NullMarked` globally. Replaced the existing null-safety annotations with `@NullMarked` across all API files to unify nullability handling. Removed redundant `package-info.java` files which served no functional purpose after the switch. --- api/build.gradle.kts | 11 ++++--- .../thenextlvl/worlds/api/WorldsProvider.java | 2 ++ .../worlds/api/event/WorldDeleteEvent.java | 2 ++ .../api/event/WorldRegenerateEvent.java | 2 ++ .../worlds/api/event/package-info.java | 10 ------ .../api/exception/GeneratorException.java | 4 ++- .../worlds/api/exception/package-info.java | 10 ------ .../worlds/api/link/LinkController.java | 2 ++ .../thenextlvl/worlds/api/link/Relative.java | 2 ++ .../worlds/api/model/Generator.java | 4 ++- .../thenextlvl/worlds/api/model/Level.java | 7 ++-- .../worlds/api/model/LevelBuilder.java | 32 ++++++++++++------- .../worlds/api/model/LevelExtras.java | 4 ++- .../worlds/api/model/WorldPreset.java | 2 ++ .../worlds/api/model/package-info.java | 10 ------ .../thenextlvl/worlds/api/preset/Biome.java | 2 ++ .../thenextlvl/worlds/api/preset/Layer.java | 2 ++ .../thenextlvl/worlds/api/preset/Preset.java | 2 ++ .../worlds/api/preset/PresetFile.java | 5 +-- .../thenextlvl/worlds/api/preset/Presets.java | 2 ++ .../worlds/api/preset/Structure.java | 7 ++-- .../api/preset/adapter/BiomeTypeAdapter.java | 10 +++++- .../preset/adapter/StructureTypeAdapter.java | 10 +++++- .../api/preset/adapter/package-info.java | 10 ------ .../worlds/api/preset/package-info.java | 10 ------ .../worlds/api/view/GeneratorView.java | 2 ++ .../thenextlvl/worlds/api/view/LevelView.java | 2 ++ .../worlds/api/view/package-info.java | 10 ------ 28 files changed, 89 insertions(+), 89 deletions(-) delete mode 100644 api/src/main/java/net/thenextlvl/worlds/api/event/package-info.java delete mode 100644 api/src/main/java/net/thenextlvl/worlds/api/exception/package-info.java delete mode 100644 api/src/main/java/net/thenextlvl/worlds/api/model/package-info.java delete mode 100644 api/src/main/java/net/thenextlvl/worlds/api/preset/adapter/package-info.java delete mode 100644 api/src/main/java/net/thenextlvl/worlds/api/preset/package-info.java delete mode 100644 api/src/main/java/net/thenextlvl/worlds/api/view/package-info.java diff --git a/api/build.gradle.kts b/api/build.gradle.kts index 92578e8c..8d57a36f 100644 --- a/api/build.gradle.kts +++ b/api/build.gradle.kts @@ -4,25 +4,26 @@ plugins { } java { + toolchain.languageVersion = JavaLanguageVersion.of(21) withSourcesJar() withJavadocJar() - sourceCompatibility = JavaVersion.VERSION_21 - targetCompatibility = JavaVersion.VERSION_21 +} + +tasks.compileJava { + options.release.set(21) } group = "net.thenextlvl.worlds" -version = "2.0.3" +version = "2.0.4" repositories { mavenCentral() maven("https://repo.thenextlvl.net/releases") - maven("https://repo.thenextlvl.net/snapshots") maven("https://repo.papermc.io/repository/maven-public/") } dependencies { compileOnly("org.projectlombok:lombok:1.18.36") - compileOnly("net.thenextlvl.core:annotations:2.0.1") compileOnly("io.papermc.paper:paper-api:1.21.4-R0.1-SNAPSHOT") implementation("net.thenextlvl.core:nbt:2.2.14") diff --git a/api/src/main/java/net/thenextlvl/worlds/api/WorldsProvider.java b/api/src/main/java/net/thenextlvl/worlds/api/WorldsProvider.java index 3dcb1981..28c542bd 100644 --- a/api/src/main/java/net/thenextlvl/worlds/api/WorldsProvider.java +++ b/api/src/main/java/net/thenextlvl/worlds/api/WorldsProvider.java @@ -5,9 +5,11 @@ import net.thenextlvl.worlds.api.view.GeneratorView; import net.thenextlvl.worlds.api.view.LevelView; import org.bukkit.plugin.Plugin; +import org.jspecify.annotations.NullMarked; import java.io.File; +@NullMarked public interface WorldsProvider extends Plugin { GeneratorView generatorView(); diff --git a/api/src/main/java/net/thenextlvl/worlds/api/event/WorldDeleteEvent.java b/api/src/main/java/net/thenextlvl/worlds/api/event/WorldDeleteEvent.java index fb947221..6538b353 100644 --- a/api/src/main/java/net/thenextlvl/worlds/api/event/WorldDeleteEvent.java +++ b/api/src/main/java/net/thenextlvl/worlds/api/event/WorldDeleteEvent.java @@ -4,7 +4,9 @@ import org.bukkit.World; import org.bukkit.event.HandlerList; import org.bukkit.event.world.WorldEvent; +import org.jspecify.annotations.NullMarked; +@NullMarked public class WorldDeleteEvent extends WorldEvent { private static final @Getter HandlerList handlerList = new HandlerList(); diff --git a/api/src/main/java/net/thenextlvl/worlds/api/event/WorldRegenerateEvent.java b/api/src/main/java/net/thenextlvl/worlds/api/event/WorldRegenerateEvent.java index a759da78..0033f504 100644 --- a/api/src/main/java/net/thenextlvl/worlds/api/event/WorldRegenerateEvent.java +++ b/api/src/main/java/net/thenextlvl/worlds/api/event/WorldRegenerateEvent.java @@ -1,7 +1,9 @@ package net.thenextlvl.worlds.api.event; import org.bukkit.World; +import org.jspecify.annotations.NullMarked; +@NullMarked public class WorldRegenerateEvent extends WorldDeleteEvent { public WorldRegenerateEvent(World world) { super(world); diff --git a/api/src/main/java/net/thenextlvl/worlds/api/event/package-info.java b/api/src/main/java/net/thenextlvl/worlds/api/event/package-info.java deleted file mode 100644 index 74d0fc35..00000000 --- a/api/src/main/java/net/thenextlvl/worlds/api/event/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -@TypesAreNotNullByDefault -@FieldsAreNotNullByDefault -@ParametersAreNotNullByDefault -@MethodsReturnNotNullByDefault -package net.thenextlvl.worlds.api.event; - -import core.annotation.FieldsAreNotNullByDefault; -import core.annotation.MethodsReturnNotNullByDefault; -import core.annotation.ParametersAreNotNullByDefault; -import core.annotation.TypesAreNotNullByDefault; \ No newline at end of file diff --git a/api/src/main/java/net/thenextlvl/worlds/api/exception/GeneratorException.java b/api/src/main/java/net/thenextlvl/worlds/api/exception/GeneratorException.java index addaa534..1e475ef3 100644 --- a/api/src/main/java/net/thenextlvl/worlds/api/exception/GeneratorException.java +++ b/api/src/main/java/net/thenextlvl/worlds/api/exception/GeneratorException.java @@ -1,13 +1,15 @@ package net.thenextlvl.worlds.api.exception; import lombok.Getter; -import org.jetbrains.annotations.Nullable; +import org.jspecify.annotations.NullMarked; +import org.jspecify.annotations.Nullable; /** * The GeneratorException class is a custom exception that is thrown when a requested plugin as a generator * cannot be found, is disabled, or doesn't provide a chunk generator or biome provider. */ @Getter +@NullMarked public class GeneratorException extends RuntimeException { private final String plugin; private final @Nullable String id; diff --git a/api/src/main/java/net/thenextlvl/worlds/api/exception/package-info.java b/api/src/main/java/net/thenextlvl/worlds/api/exception/package-info.java deleted file mode 100644 index 89eb0b20..00000000 --- a/api/src/main/java/net/thenextlvl/worlds/api/exception/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -@TypesAreNotNullByDefault -@FieldsAreNotNullByDefault -@ParametersAreNotNullByDefault -@MethodsReturnNotNullByDefault -package net.thenextlvl.worlds.api.exception; - -import core.annotation.FieldsAreNotNullByDefault; -import core.annotation.MethodsReturnNotNullByDefault; -import core.annotation.ParametersAreNotNullByDefault; -import core.annotation.TypesAreNotNullByDefault; \ No newline at end of file diff --git a/api/src/main/java/net/thenextlvl/worlds/api/link/LinkController.java b/api/src/main/java/net/thenextlvl/worlds/api/link/LinkController.java index 15a46020..fe541a59 100644 --- a/api/src/main/java/net/thenextlvl/worlds/api/link/LinkController.java +++ b/api/src/main/java/net/thenextlvl/worlds/api/link/LinkController.java @@ -3,9 +3,11 @@ import org.bukkit.NamespacedKey; import org.bukkit.PortalType; import org.bukkit.World; +import org.jspecify.annotations.NullMarked; import java.util.Optional; +@NullMarked public interface LinkController { Optional getTarget(World world, PortalType type); diff --git a/api/src/main/java/net/thenextlvl/worlds/api/link/Relative.java b/api/src/main/java/net/thenextlvl/worlds/api/link/Relative.java index 7ce61c2d..500be588 100644 --- a/api/src/main/java/net/thenextlvl/worlds/api/link/Relative.java +++ b/api/src/main/java/net/thenextlvl/worlds/api/link/Relative.java @@ -7,11 +7,13 @@ import net.kyori.adventure.key.Keyed; import org.bukkit.NamespacedKey; import org.bukkit.World; +import org.jspecify.annotations.NullMarked; import java.util.Arrays; import java.util.Optional; @Getter +@NullMarked @RequiredArgsConstructor @Accessors(fluent = true) public enum Relative implements Keyed { diff --git a/api/src/main/java/net/thenextlvl/worlds/api/model/Generator.java b/api/src/main/java/net/thenextlvl/worlds/api/model/Generator.java index 933e5239..fc82d374 100644 --- a/api/src/main/java/net/thenextlvl/worlds/api/model/Generator.java +++ b/api/src/main/java/net/thenextlvl/worlds/api/model/Generator.java @@ -5,8 +5,10 @@ import org.bukkit.generator.BiomeProvider; import org.bukkit.generator.ChunkGenerator; import org.bukkit.plugin.Plugin; -import org.jetbrains.annotations.Nullable; +import org.jspecify.annotations.NullMarked; +import org.jspecify.annotations.Nullable; +@NullMarked public record Generator(Plugin plugin, @Nullable String id) { public String serialize() { return id != null ? plugin.getName() + ":" + id : plugin.getName(); diff --git a/api/src/main/java/net/thenextlvl/worlds/api/model/Level.java b/api/src/main/java/net/thenextlvl/worlds/api/model/Level.java index 599f3ced..2b3f475f 100644 --- a/api/src/main/java/net/thenextlvl/worlds/api/model/Level.java +++ b/api/src/main/java/net/thenextlvl/worlds/api/model/Level.java @@ -6,12 +6,15 @@ import net.thenextlvl.worlds.api.preset.Preset; import org.bukkit.NamespacedKey; import org.bukkit.World; -import org.jetbrains.annotations.Nullable; +import org.jspecify.annotations.NullMarked; +import org.jspecify.annotations.Nullable; import java.util.Optional; +@NullMarked public interface Level extends Keyed { - @Nullable Generator generator(); + @Nullable + Generator generator(); @Nullable Preset preset(); diff --git a/api/src/main/java/net/thenextlvl/worlds/api/model/LevelBuilder.java b/api/src/main/java/net/thenextlvl/worlds/api/model/LevelBuilder.java index 0467f114..0c036a02 100644 --- a/api/src/main/java/net/thenextlvl/worlds/api/model/LevelBuilder.java +++ b/api/src/main/java/net/thenextlvl/worlds/api/model/LevelBuilder.java @@ -3,32 +3,42 @@ import net.thenextlvl.worlds.api.preset.Preset; import org.bukkit.NamespacedKey; import org.bukkit.World; -import org.jetbrains.annotations.Nullable; +import org.jspecify.annotations.NullMarked; +import org.jspecify.annotations.Nullable; import java.io.File; +@NullMarked public interface LevelBuilder { - @Nullable Boolean hardcore(); + @Nullable + Boolean hardcore(); - @Nullable Boolean structures(); + @Nullable + Boolean structures(); - @Nullable Generator generator(); + @Nullable + Generator generator(); - @Nullable Long seed(); + @Nullable + Long seed(); - @Nullable NamespacedKey key(); + @Nullable + NamespacedKey key(); - @Nullable Preset preset(); + @Nullable + Preset preset(); - @Nullable String name(); + @Nullable + String name(); - @Nullable World.Environment environment(); + World.@Nullable Environment environment(); - @Nullable WorldPreset type(); + @Nullable + WorldPreset type(); File level(); - LevelBuilder environment(@Nullable World.Environment environment); + LevelBuilder environment(World.@Nullable Environment environment); LevelBuilder generator(@Nullable Generator generator); diff --git a/api/src/main/java/net/thenextlvl/worlds/api/model/LevelExtras.java b/api/src/main/java/net/thenextlvl/worlds/api/model/LevelExtras.java index cc7919f0..1cb23d8e 100644 --- a/api/src/main/java/net/thenextlvl/worlds/api/model/LevelExtras.java +++ b/api/src/main/java/net/thenextlvl/worlds/api/model/LevelExtras.java @@ -1,8 +1,10 @@ package net.thenextlvl.worlds.api.model; import org.bukkit.NamespacedKey; -import org.jetbrains.annotations.Nullable; +import org.jspecify.annotations.NullMarked; +import org.jspecify.annotations.Nullable; +@NullMarked public record LevelExtras( @Nullable NamespacedKey key, @Nullable Generator generator, diff --git a/api/src/main/java/net/thenextlvl/worlds/api/model/WorldPreset.java b/api/src/main/java/net/thenextlvl/worlds/api/model/WorldPreset.java index 11df817b..f12e8bdc 100644 --- a/api/src/main/java/net/thenextlvl/worlds/api/model/WorldPreset.java +++ b/api/src/main/java/net/thenextlvl/worlds/api/model/WorldPreset.java @@ -2,7 +2,9 @@ import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Keyed; +import org.jspecify.annotations.NullMarked; +@NullMarked public record WorldPreset(Key key) implements Keyed { public static final WorldPreset AMPLIFIED = new WorldPreset(Key.key("minecraft", "amplified")); public static final WorldPreset CHECKERBOARD = new WorldPreset(Key.key("minecraft", "checkerboard")); diff --git a/api/src/main/java/net/thenextlvl/worlds/api/model/package-info.java b/api/src/main/java/net/thenextlvl/worlds/api/model/package-info.java deleted file mode 100644 index 4c2724f6..00000000 --- a/api/src/main/java/net/thenextlvl/worlds/api/model/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -@TypesAreNotNullByDefault -@FieldsAreNotNullByDefault -@ParametersAreNotNullByDefault -@MethodsReturnNotNullByDefault -package net.thenextlvl.worlds.api.model; - -import core.annotation.FieldsAreNotNullByDefault; -import core.annotation.MethodsReturnNotNullByDefault; -import core.annotation.ParametersAreNotNullByDefault; -import core.annotation.TypesAreNotNullByDefault; \ No newline at end of file diff --git a/api/src/main/java/net/thenextlvl/worlds/api/preset/Biome.java b/api/src/main/java/net/thenextlvl/worlds/api/preset/Biome.java index d3af2bfe..98e24f2d 100644 --- a/api/src/main/java/net/thenextlvl/worlds/api/preset/Biome.java +++ b/api/src/main/java/net/thenextlvl/worlds/api/preset/Biome.java @@ -1,7 +1,9 @@ package net.thenextlvl.worlds.api.preset; import com.google.common.base.Preconditions; +import org.jspecify.annotations.NullMarked; +@NullMarked public record Biome(String provider, String biome) { Biome(org.bukkit.block.Biome biome) { this(biome.key().namespace(), biome.key().value()); diff --git a/api/src/main/java/net/thenextlvl/worlds/api/preset/Layer.java b/api/src/main/java/net/thenextlvl/worlds/api/preset/Layer.java index a08db8f3..4ab16cdc 100644 --- a/api/src/main/java/net/thenextlvl/worlds/api/preset/Layer.java +++ b/api/src/main/java/net/thenextlvl/worlds/api/preset/Layer.java @@ -1,7 +1,9 @@ package net.thenextlvl.worlds.api.preset; import org.bukkit.Material; +import org.jspecify.annotations.NullMarked; +@NullMarked public record Layer(String block, int height) { Layer(Material material, int height) { this(material.key().asString(), height); diff --git a/api/src/main/java/net/thenextlvl/worlds/api/preset/Preset.java b/api/src/main/java/net/thenextlvl/worlds/api/preset/Preset.java index 0d28dc54..6ea8b1e1 100644 --- a/api/src/main/java/net/thenextlvl/worlds/api/preset/Preset.java +++ b/api/src/main/java/net/thenextlvl/worlds/api/preset/Preset.java @@ -13,6 +13,7 @@ import net.thenextlvl.worlds.api.preset.adapter.BiomeTypeAdapter; import net.thenextlvl.worlds.api.preset.adapter.StructureTypeAdapter; import org.bukkit.Material; +import org.jspecify.annotations.NullMarked; import java.io.File; import java.util.LinkedHashSet; @@ -20,6 +21,7 @@ @Getter @Setter +@NullMarked @Accessors(chain = true, fluent = true) public class Preset { private Biome biome = Biome.minecraft("plains"); diff --git a/api/src/main/java/net/thenextlvl/worlds/api/preset/PresetFile.java b/api/src/main/java/net/thenextlvl/worlds/api/preset/PresetFile.java index 0d06bf6a..287e3b6a 100644 --- a/api/src/main/java/net/thenextlvl/worlds/api/preset/PresetFile.java +++ b/api/src/main/java/net/thenextlvl/worlds/api/preset/PresetFile.java @@ -4,14 +4,15 @@ import com.google.gson.JsonObject; import core.file.format.GsonFile; import core.io.IO; -import org.jetbrains.annotations.Nullable; +import org.jspecify.annotations.NullMarked; +import org.jspecify.annotations.Nullable; import java.io.File; import java.util.Collections; import java.util.List; +@NullMarked public record PresetFile(JsonObject settings) { - public static @Nullable PresetFile of(IO io) { if (!io.exists()) return null; var gson = new GsonFile(io, JsonObject.class, new Gson()); diff --git a/api/src/main/java/net/thenextlvl/worlds/api/preset/Presets.java b/api/src/main/java/net/thenextlvl/worlds/api/preset/Presets.java index e078245d..f3a13bed 100644 --- a/api/src/main/java/net/thenextlvl/worlds/api/preset/Presets.java +++ b/api/src/main/java/net/thenextlvl/worlds/api/preset/Presets.java @@ -1,7 +1,9 @@ package net.thenextlvl.worlds.api.preset; import org.bukkit.Material; +import org.jspecify.annotations.NullMarked; +@NullMarked public class Presets { public static final Preset BOTTOMLESS_PIT = new Preset() diff --git a/api/src/main/java/net/thenextlvl/worlds/api/preset/Structure.java b/api/src/main/java/net/thenextlvl/worlds/api/preset/Structure.java index 420bd33a..aabbe3a4 100644 --- a/api/src/main/java/net/thenextlvl/worlds/api/preset/Structure.java +++ b/api/src/main/java/net/thenextlvl/worlds/api/preset/Structure.java @@ -1,10 +1,9 @@ package net.thenextlvl.worlds.api.preset; -public record Structure(String structure) { - Structure(org.bukkit.generator.structure.Structure structure) { - this(structure.key().asString()); - } +import org.jspecify.annotations.NullMarked; +@NullMarked +public record Structure(String structure) { public static Structure minecraft(String structure) { return new Structure("minecraft:" + structure); } diff --git a/api/src/main/java/net/thenextlvl/worlds/api/preset/adapter/BiomeTypeAdapter.java b/api/src/main/java/net/thenextlvl/worlds/api/preset/adapter/BiomeTypeAdapter.java index 1c6fbf13..239f869a 100644 --- a/api/src/main/java/net/thenextlvl/worlds/api/preset/adapter/BiomeTypeAdapter.java +++ b/api/src/main/java/net/thenextlvl/worlds/api/preset/adapter/BiomeTypeAdapter.java @@ -1,10 +1,18 @@ package net.thenextlvl.worlds.api.preset.adapter; -import com.google.gson.*; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonParseException; +import com.google.gson.JsonPrimitive; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; import net.thenextlvl.worlds.api.preset.Biome; +import org.jspecify.annotations.NullMarked; import java.lang.reflect.Type; +@NullMarked public class BiomeTypeAdapter implements JsonSerializer, JsonDeserializer { @Override public Biome deserialize(JsonElement element, Type type, JsonDeserializationContext context) throws JsonParseException { diff --git a/api/src/main/java/net/thenextlvl/worlds/api/preset/adapter/StructureTypeAdapter.java b/api/src/main/java/net/thenextlvl/worlds/api/preset/adapter/StructureTypeAdapter.java index 93322700..fecde3f7 100644 --- a/api/src/main/java/net/thenextlvl/worlds/api/preset/adapter/StructureTypeAdapter.java +++ b/api/src/main/java/net/thenextlvl/worlds/api/preset/adapter/StructureTypeAdapter.java @@ -1,10 +1,18 @@ package net.thenextlvl.worlds.api.preset.adapter; -import com.google.gson.*; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonParseException; +import com.google.gson.JsonPrimitive; +import com.google.gson.JsonSerializationContext; +import com.google.gson.JsonSerializer; import net.thenextlvl.worlds.api.preset.Structure; +import org.jspecify.annotations.NullMarked; import java.lang.reflect.Type; +@NullMarked public class StructureTypeAdapter implements JsonSerializer, JsonDeserializer { @Override public Structure deserialize(JsonElement element, Type type, JsonDeserializationContext context) throws JsonParseException { diff --git a/api/src/main/java/net/thenextlvl/worlds/api/preset/adapter/package-info.java b/api/src/main/java/net/thenextlvl/worlds/api/preset/adapter/package-info.java deleted file mode 100644 index 462923d6..00000000 --- a/api/src/main/java/net/thenextlvl/worlds/api/preset/adapter/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -@TypesAreNotNullByDefault -@FieldsAreNotNullByDefault -@ParametersAreNotNullByDefault -@MethodsReturnNotNullByDefault -package net.thenextlvl.worlds.api.preset.adapter; - -import core.annotation.FieldsAreNotNullByDefault; -import core.annotation.MethodsReturnNotNullByDefault; -import core.annotation.ParametersAreNotNullByDefault; -import core.annotation.TypesAreNotNullByDefault; \ No newline at end of file diff --git a/api/src/main/java/net/thenextlvl/worlds/api/preset/package-info.java b/api/src/main/java/net/thenextlvl/worlds/api/preset/package-info.java deleted file mode 100644 index afced07a..00000000 --- a/api/src/main/java/net/thenextlvl/worlds/api/preset/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -@TypesAreNotNullByDefault -@FieldsAreNotNullByDefault -@ParametersAreNotNullByDefault -@MethodsReturnNotNullByDefault -package net.thenextlvl.worlds.api.preset; - -import core.annotation.FieldsAreNotNullByDefault; -import core.annotation.MethodsReturnNotNullByDefault; -import core.annotation.ParametersAreNotNullByDefault; -import core.annotation.TypesAreNotNullByDefault; \ No newline at end of file diff --git a/api/src/main/java/net/thenextlvl/worlds/api/view/GeneratorView.java b/api/src/main/java/net/thenextlvl/worlds/api/view/GeneratorView.java index 52a9f31b..ead245ee 100644 --- a/api/src/main/java/net/thenextlvl/worlds/api/view/GeneratorView.java +++ b/api/src/main/java/net/thenextlvl/worlds/api/view/GeneratorView.java @@ -1,7 +1,9 @@ package net.thenextlvl.worlds.api.view; import org.bukkit.plugin.Plugin; +import org.jspecify.annotations.NullMarked; +@NullMarked public interface GeneratorView { boolean hasGenerator(Plugin plugin); diff --git a/api/src/main/java/net/thenextlvl/worlds/api/view/LevelView.java b/api/src/main/java/net/thenextlvl/worlds/api/view/LevelView.java index d5f600a8..534b0d2e 100644 --- a/api/src/main/java/net/thenextlvl/worlds/api/view/LevelView.java +++ b/api/src/main/java/net/thenextlvl/worlds/api/view/LevelView.java @@ -6,11 +6,13 @@ import net.thenextlvl.worlds.api.model.WorldPreset; import net.thenextlvl.worlds.api.preset.Preset; import org.bukkit.World; +import org.jspecify.annotations.NullMarked; import java.io.File; import java.util.Optional; import java.util.stream.Stream; +@NullMarked public interface LevelView { NBTFile getLevelDataFile(File level); diff --git a/api/src/main/java/net/thenextlvl/worlds/api/view/package-info.java b/api/src/main/java/net/thenextlvl/worlds/api/view/package-info.java deleted file mode 100644 index 132f3fdc..00000000 --- a/api/src/main/java/net/thenextlvl/worlds/api/view/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -@TypesAreNotNullByDefault -@FieldsAreNotNullByDefault -@ParametersAreNotNullByDefault -@MethodsReturnNotNullByDefault -package net.thenextlvl.worlds.api.view; - -import core.annotation.FieldsAreNotNullByDefault; -import core.annotation.MethodsReturnNotNullByDefault; -import core.annotation.ParametersAreNotNullByDefault; -import core.annotation.TypesAreNotNullByDefault; \ No newline at end of file From 1f41a7f4cf64197c5b31df8ee458841265c46fe1 Mon Sep 17 00:00:00 2001 From: david Date: Thu, 26 Dec 2024 17:33:13 +0100 Subject: [PATCH 2/6] Refactor project structure by merging plugin into main module Merged the "plugin" directory into the main module to simplify the project structure. Updated file paths accordingly, ensuring all resources and code are moved to the primary module structure for improved maintainability and clarity. Adjusted `settings.gradle.kts` to reflect the changes. --- plugin/build.gradle.kts => build.gradle.kts | 0 settings.gradle.kts | 1 - .../main/java/net/thenextlvl/worlds/WorldsPlugin.java | 0 .../net/thenextlvl/worlds/command/WorldCloneCommand.java | 0 .../java/net/thenextlvl/worlds/command/WorldCommand.java | 0 .../net/thenextlvl/worlds/command/WorldCreateCommand.java | 6 +++++- .../net/thenextlvl/worlds/command/WorldDeleteCommand.java | 0 .../net/thenextlvl/worlds/command/WorldImportCommand.java | 0 .../net/thenextlvl/worlds/command/WorldInfoCommand.java | 0 .../net/thenextlvl/worlds/command/WorldLinkCommand.java | 0 .../thenextlvl/worlds/command/WorldLinkCreateCommand.java | 0 .../net/thenextlvl/worlds/command/WorldLinkListCommand.java | 0 .../thenextlvl/worlds/command/WorldLinkRemoveCommand.java | 0 .../net/thenextlvl/worlds/command/WorldListCommand.java | 0 .../net/thenextlvl/worlds/command/WorldLoadCommand.java | 0 .../thenextlvl/worlds/command/WorldRegenerateCommand.java | 0 .../net/thenextlvl/worlds/command/WorldSaveAllCommand.java | 0 .../net/thenextlvl/worlds/command/WorldSaveCommand.java | 0 .../net/thenextlvl/worlds/command/WorldSaveOffCommand.java | 0 .../net/thenextlvl/worlds/command/WorldSaveOnCommand.java | 0 .../net/thenextlvl/worlds/command/WorldSetSpawnCommand.java | 0 .../net/thenextlvl/worlds/command/WorldSpawnCommand.java | 0 .../net/thenextlvl/worlds/command/WorldTeleportCommand.java | 0 .../net/thenextlvl/worlds/command/WorldUnloadCommand.java | 0 .../worlds/command/argument/CommandFlagsArgument.java | 0 .../worlds/command/argument/DimensionArgument.java | 0 .../worlds/command/argument/GeneratorArgument.java | 0 .../worlds/command/argument/RelativeArgument.java | 0 .../thenextlvl/worlds/command/argument/SeedArgument.java | 0 .../worlds/command/argument/WorldPresetArgument.java | 0 .../worlds/command/argument/WorldTypeArgument.java | 0 .../thenextlvl/worlds/command/argument/package-info.java | 0 .../java/net/thenextlvl/worlds/command/package-info.java | 0 .../command/suggestion/DimensionSuggestionProvider.java | 0 .../command/suggestion/GeneratorSuggestionProvider.java | 0 .../worlds/command/suggestion/LevelSuggestionProvider.java | 0 .../command/suggestion/RelativeSuggestionProvider.java | 0 .../command/suggestion/WorldPresetSuggestionProvider.java | 0 .../worlds/command/suggestion/WorldSuggestionProvider.java | 0 .../command/suggestion/WorldTypeSuggestionProvider.java | 0 .../thenextlvl/worlds/command/suggestion/package-info.java | 0 .../thenextlvl/worlds/controller/WorldLinkController.java | 0 .../java/net/thenextlvl/worlds/listener/PortalListener.java | 6 +++++- .../java/net/thenextlvl/worlds/listener/ServerListener.java | 0 .../java/net/thenextlvl/worlds/listener/package-info.java | 0 .../main/java/net/thenextlvl/worlds/model/PaperLevel.java | 6 +++++- .../java/net/thenextlvl/worlds/model/PaperLevelBuilder.java | 0 .../java/net/thenextlvl/worlds/model/PortalCooldown.java | 0 .../main/java/net/thenextlvl/worlds/model/package-info.java | 0 .../net/thenextlvl/worlds/version/PluginVersionChecker.java | 0 .../java/net/thenextlvl/worlds/version/package-info.java | 0 .../java/net/thenextlvl/worlds/view/PaperLevelView.java | 0 .../net/thenextlvl/worlds/view/PluginGeneratorView.java | 0 .../main/java/net/thenextlvl/worlds/view/package-info.java | 0 {plugin/src => src}/main/resources/worlds.properties | 0 {plugin/src => src}/main/resources/worlds_german.properties | 0 56 files changed, 15 insertions(+), 4 deletions(-) rename plugin/build.gradle.kts => build.gradle.kts (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/WorldsPlugin.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/command/WorldCloneCommand.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/command/WorldCommand.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/command/WorldCreateCommand.java (96%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/command/WorldDeleteCommand.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/command/WorldImportCommand.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/command/WorldInfoCommand.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/command/WorldLinkCommand.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/command/WorldLinkCreateCommand.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/command/WorldLinkListCommand.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/command/WorldLinkRemoveCommand.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/command/WorldListCommand.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/command/WorldLoadCommand.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/command/WorldRegenerateCommand.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/command/WorldSaveAllCommand.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/command/WorldSaveCommand.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/command/WorldSaveOffCommand.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/command/WorldSaveOnCommand.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/command/WorldSetSpawnCommand.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/command/WorldSpawnCommand.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/command/WorldTeleportCommand.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/command/WorldUnloadCommand.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/command/argument/CommandFlagsArgument.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/command/argument/DimensionArgument.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/command/argument/GeneratorArgument.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/command/argument/RelativeArgument.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/command/argument/SeedArgument.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/command/argument/WorldPresetArgument.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/command/argument/WorldTypeArgument.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/command/argument/package-info.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/command/package-info.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/command/suggestion/DimensionSuggestionProvider.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/command/suggestion/GeneratorSuggestionProvider.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/command/suggestion/LevelSuggestionProvider.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/command/suggestion/RelativeSuggestionProvider.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/command/suggestion/WorldPresetSuggestionProvider.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/command/suggestion/WorldSuggestionProvider.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/command/suggestion/WorldTypeSuggestionProvider.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/command/suggestion/package-info.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/controller/WorldLinkController.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/listener/PortalListener.java (96%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/listener/ServerListener.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/listener/package-info.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/model/PaperLevel.java (95%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/model/PaperLevelBuilder.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/model/PortalCooldown.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/model/package-info.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/version/PluginVersionChecker.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/version/package-info.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/view/PaperLevelView.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/view/PluginGeneratorView.java (100%) rename {plugin/src => src}/main/java/net/thenextlvl/worlds/view/package-info.java (100%) rename {plugin/src => src}/main/resources/worlds.properties (100%) rename {plugin/src => src}/main/resources/worlds_german.properties (100%) diff --git a/plugin/build.gradle.kts b/build.gradle.kts similarity index 100% rename from plugin/build.gradle.kts rename to build.gradle.kts diff --git a/settings.gradle.kts b/settings.gradle.kts index fdbe2fe7..3c93ab65 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,3 +1,2 @@ rootProject.name = "worlds" include("api") -include("plugin") diff --git a/plugin/src/main/java/net/thenextlvl/worlds/WorldsPlugin.java b/src/main/java/net/thenextlvl/worlds/WorldsPlugin.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/WorldsPlugin.java rename to src/main/java/net/thenextlvl/worlds/WorldsPlugin.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/command/WorldCloneCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldCloneCommand.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/command/WorldCloneCommand.java rename to src/main/java/net/thenextlvl/worlds/command/WorldCloneCommand.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/command/WorldCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldCommand.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/command/WorldCommand.java rename to src/main/java/net/thenextlvl/worlds/command/WorldCommand.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/command/WorldCreateCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldCreateCommand.java similarity index 96% rename from plugin/src/main/java/net/thenextlvl/worlds/command/WorldCreateCommand.java rename to src/main/java/net/thenextlvl/worlds/command/WorldCreateCommand.java index afa61ff8..9f92e887 100644 --- a/plugin/src/main/java/net/thenextlvl/worlds/command/WorldCreateCommand.java +++ b/src/main/java/net/thenextlvl/worlds/command/WorldCreateCommand.java @@ -15,7 +15,11 @@ import net.thenextlvl.worlds.api.model.Generator; import net.thenextlvl.worlds.api.model.WorldPreset; import net.thenextlvl.worlds.api.preset.Preset; -import net.thenextlvl.worlds.command.argument.*; +import net.thenextlvl.worlds.command.argument.DimensionArgument; +import net.thenextlvl.worlds.command.argument.GeneratorArgument; +import net.thenextlvl.worlds.command.argument.SeedArgument; +import net.thenextlvl.worlds.command.argument.WorldPresetArgument; +import net.thenextlvl.worlds.command.argument.WorldTypeArgument; import org.bukkit.NamespacedKey; import org.bukkit.World; import org.bukkit.entity.Entity; diff --git a/plugin/src/main/java/net/thenextlvl/worlds/command/WorldDeleteCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldDeleteCommand.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/command/WorldDeleteCommand.java rename to src/main/java/net/thenextlvl/worlds/command/WorldDeleteCommand.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/command/WorldImportCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldImportCommand.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/command/WorldImportCommand.java rename to src/main/java/net/thenextlvl/worlds/command/WorldImportCommand.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/command/WorldInfoCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldInfoCommand.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/command/WorldInfoCommand.java rename to src/main/java/net/thenextlvl/worlds/command/WorldInfoCommand.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/command/WorldLinkCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldLinkCommand.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/command/WorldLinkCommand.java rename to src/main/java/net/thenextlvl/worlds/command/WorldLinkCommand.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/command/WorldLinkCreateCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldLinkCreateCommand.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/command/WorldLinkCreateCommand.java rename to src/main/java/net/thenextlvl/worlds/command/WorldLinkCreateCommand.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/command/WorldLinkListCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldLinkListCommand.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/command/WorldLinkListCommand.java rename to src/main/java/net/thenextlvl/worlds/command/WorldLinkListCommand.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/command/WorldLinkRemoveCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldLinkRemoveCommand.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/command/WorldLinkRemoveCommand.java rename to src/main/java/net/thenextlvl/worlds/command/WorldLinkRemoveCommand.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/command/WorldListCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldListCommand.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/command/WorldListCommand.java rename to src/main/java/net/thenextlvl/worlds/command/WorldListCommand.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/command/WorldLoadCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldLoadCommand.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/command/WorldLoadCommand.java rename to src/main/java/net/thenextlvl/worlds/command/WorldLoadCommand.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/command/WorldRegenerateCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldRegenerateCommand.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/command/WorldRegenerateCommand.java rename to src/main/java/net/thenextlvl/worlds/command/WorldRegenerateCommand.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/command/WorldSaveAllCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldSaveAllCommand.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/command/WorldSaveAllCommand.java rename to src/main/java/net/thenextlvl/worlds/command/WorldSaveAllCommand.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/command/WorldSaveCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldSaveCommand.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/command/WorldSaveCommand.java rename to src/main/java/net/thenextlvl/worlds/command/WorldSaveCommand.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/command/WorldSaveOffCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldSaveOffCommand.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/command/WorldSaveOffCommand.java rename to src/main/java/net/thenextlvl/worlds/command/WorldSaveOffCommand.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/command/WorldSaveOnCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldSaveOnCommand.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/command/WorldSaveOnCommand.java rename to src/main/java/net/thenextlvl/worlds/command/WorldSaveOnCommand.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/command/WorldSetSpawnCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldSetSpawnCommand.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/command/WorldSetSpawnCommand.java rename to src/main/java/net/thenextlvl/worlds/command/WorldSetSpawnCommand.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/command/WorldSpawnCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldSpawnCommand.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/command/WorldSpawnCommand.java rename to src/main/java/net/thenextlvl/worlds/command/WorldSpawnCommand.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/command/WorldTeleportCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldTeleportCommand.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/command/WorldTeleportCommand.java rename to src/main/java/net/thenextlvl/worlds/command/WorldTeleportCommand.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/command/WorldUnloadCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldUnloadCommand.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/command/WorldUnloadCommand.java rename to src/main/java/net/thenextlvl/worlds/command/WorldUnloadCommand.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/command/argument/CommandFlagsArgument.java b/src/main/java/net/thenextlvl/worlds/command/argument/CommandFlagsArgument.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/command/argument/CommandFlagsArgument.java rename to src/main/java/net/thenextlvl/worlds/command/argument/CommandFlagsArgument.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/command/argument/DimensionArgument.java b/src/main/java/net/thenextlvl/worlds/command/argument/DimensionArgument.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/command/argument/DimensionArgument.java rename to src/main/java/net/thenextlvl/worlds/command/argument/DimensionArgument.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/command/argument/GeneratorArgument.java b/src/main/java/net/thenextlvl/worlds/command/argument/GeneratorArgument.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/command/argument/GeneratorArgument.java rename to src/main/java/net/thenextlvl/worlds/command/argument/GeneratorArgument.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/command/argument/RelativeArgument.java b/src/main/java/net/thenextlvl/worlds/command/argument/RelativeArgument.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/command/argument/RelativeArgument.java rename to src/main/java/net/thenextlvl/worlds/command/argument/RelativeArgument.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/command/argument/SeedArgument.java b/src/main/java/net/thenextlvl/worlds/command/argument/SeedArgument.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/command/argument/SeedArgument.java rename to src/main/java/net/thenextlvl/worlds/command/argument/SeedArgument.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/command/argument/WorldPresetArgument.java b/src/main/java/net/thenextlvl/worlds/command/argument/WorldPresetArgument.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/command/argument/WorldPresetArgument.java rename to src/main/java/net/thenextlvl/worlds/command/argument/WorldPresetArgument.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/command/argument/WorldTypeArgument.java b/src/main/java/net/thenextlvl/worlds/command/argument/WorldTypeArgument.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/command/argument/WorldTypeArgument.java rename to src/main/java/net/thenextlvl/worlds/command/argument/WorldTypeArgument.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/command/argument/package-info.java b/src/main/java/net/thenextlvl/worlds/command/argument/package-info.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/command/argument/package-info.java rename to src/main/java/net/thenextlvl/worlds/command/argument/package-info.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/command/package-info.java b/src/main/java/net/thenextlvl/worlds/command/package-info.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/command/package-info.java rename to src/main/java/net/thenextlvl/worlds/command/package-info.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/command/suggestion/DimensionSuggestionProvider.java b/src/main/java/net/thenextlvl/worlds/command/suggestion/DimensionSuggestionProvider.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/command/suggestion/DimensionSuggestionProvider.java rename to src/main/java/net/thenextlvl/worlds/command/suggestion/DimensionSuggestionProvider.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/command/suggestion/GeneratorSuggestionProvider.java b/src/main/java/net/thenextlvl/worlds/command/suggestion/GeneratorSuggestionProvider.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/command/suggestion/GeneratorSuggestionProvider.java rename to src/main/java/net/thenextlvl/worlds/command/suggestion/GeneratorSuggestionProvider.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/command/suggestion/LevelSuggestionProvider.java b/src/main/java/net/thenextlvl/worlds/command/suggestion/LevelSuggestionProvider.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/command/suggestion/LevelSuggestionProvider.java rename to src/main/java/net/thenextlvl/worlds/command/suggestion/LevelSuggestionProvider.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/command/suggestion/RelativeSuggestionProvider.java b/src/main/java/net/thenextlvl/worlds/command/suggestion/RelativeSuggestionProvider.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/command/suggestion/RelativeSuggestionProvider.java rename to src/main/java/net/thenextlvl/worlds/command/suggestion/RelativeSuggestionProvider.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/command/suggestion/WorldPresetSuggestionProvider.java b/src/main/java/net/thenextlvl/worlds/command/suggestion/WorldPresetSuggestionProvider.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/command/suggestion/WorldPresetSuggestionProvider.java rename to src/main/java/net/thenextlvl/worlds/command/suggestion/WorldPresetSuggestionProvider.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/command/suggestion/WorldSuggestionProvider.java b/src/main/java/net/thenextlvl/worlds/command/suggestion/WorldSuggestionProvider.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/command/suggestion/WorldSuggestionProvider.java rename to src/main/java/net/thenextlvl/worlds/command/suggestion/WorldSuggestionProvider.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/command/suggestion/WorldTypeSuggestionProvider.java b/src/main/java/net/thenextlvl/worlds/command/suggestion/WorldTypeSuggestionProvider.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/command/suggestion/WorldTypeSuggestionProvider.java rename to src/main/java/net/thenextlvl/worlds/command/suggestion/WorldTypeSuggestionProvider.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/command/suggestion/package-info.java b/src/main/java/net/thenextlvl/worlds/command/suggestion/package-info.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/command/suggestion/package-info.java rename to src/main/java/net/thenextlvl/worlds/command/suggestion/package-info.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/controller/WorldLinkController.java b/src/main/java/net/thenextlvl/worlds/controller/WorldLinkController.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/controller/WorldLinkController.java rename to src/main/java/net/thenextlvl/worlds/controller/WorldLinkController.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/listener/PortalListener.java b/src/main/java/net/thenextlvl/worlds/listener/PortalListener.java similarity index 96% rename from plugin/src/main/java/net/thenextlvl/worlds/listener/PortalListener.java rename to src/main/java/net/thenextlvl/worlds/listener/PortalListener.java index 798712f7..b14d20f4 100644 --- a/plugin/src/main/java/net/thenextlvl/worlds/listener/PortalListener.java +++ b/src/main/java/net/thenextlvl/worlds/listener/PortalListener.java @@ -4,7 +4,11 @@ import lombok.RequiredArgsConstructor; import net.thenextlvl.worlds.WorldsPlugin; import net.thenextlvl.worlds.model.PortalCooldown; -import org.bukkit.*; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.PortalType; +import org.bukkit.World; import org.bukkit.block.BlockFace; import org.bukkit.craftbukkit.entity.CraftPlayer; import org.bukkit.event.EventHandler; diff --git a/plugin/src/main/java/net/thenextlvl/worlds/listener/ServerListener.java b/src/main/java/net/thenextlvl/worlds/listener/ServerListener.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/listener/ServerListener.java rename to src/main/java/net/thenextlvl/worlds/listener/ServerListener.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/listener/package-info.java b/src/main/java/net/thenextlvl/worlds/listener/package-info.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/listener/package-info.java rename to src/main/java/net/thenextlvl/worlds/listener/package-info.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/model/PaperLevel.java b/src/main/java/net/thenextlvl/worlds/model/PaperLevel.java similarity index 95% rename from plugin/src/main/java/net/thenextlvl/worlds/model/PaperLevel.java rename to src/main/java/net/thenextlvl/worlds/model/PaperLevel.java index 8b19919e..b43316f2 100644 --- a/plugin/src/main/java/net/thenextlvl/worlds/model/PaperLevel.java +++ b/src/main/java/net/thenextlvl/worlds/model/PaperLevel.java @@ -8,7 +8,11 @@ import lombok.Getter; import lombok.experimental.Accessors; import net.thenextlvl.worlds.WorldsPlugin; -import net.thenextlvl.worlds.api.model.*; +import net.thenextlvl.worlds.api.model.Generator; +import net.thenextlvl.worlds.api.model.Level; +import net.thenextlvl.worlds.api.model.LevelBuilder; +import net.thenextlvl.worlds.api.model.LevelExtras; +import net.thenextlvl.worlds.api.model.WorldPreset; import net.thenextlvl.worlds.api.preset.Preset; import org.bukkit.NamespacedKey; import org.bukkit.World; diff --git a/plugin/src/main/java/net/thenextlvl/worlds/model/PaperLevelBuilder.java b/src/main/java/net/thenextlvl/worlds/model/PaperLevelBuilder.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/model/PaperLevelBuilder.java rename to src/main/java/net/thenextlvl/worlds/model/PaperLevelBuilder.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/model/PortalCooldown.java b/src/main/java/net/thenextlvl/worlds/model/PortalCooldown.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/model/PortalCooldown.java rename to src/main/java/net/thenextlvl/worlds/model/PortalCooldown.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/model/package-info.java b/src/main/java/net/thenextlvl/worlds/model/package-info.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/model/package-info.java rename to src/main/java/net/thenextlvl/worlds/model/package-info.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/version/PluginVersionChecker.java b/src/main/java/net/thenextlvl/worlds/version/PluginVersionChecker.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/version/PluginVersionChecker.java rename to src/main/java/net/thenextlvl/worlds/version/PluginVersionChecker.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/version/package-info.java b/src/main/java/net/thenextlvl/worlds/version/package-info.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/version/package-info.java rename to src/main/java/net/thenextlvl/worlds/version/package-info.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/view/PaperLevelView.java b/src/main/java/net/thenextlvl/worlds/view/PaperLevelView.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/view/PaperLevelView.java rename to src/main/java/net/thenextlvl/worlds/view/PaperLevelView.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/view/PluginGeneratorView.java b/src/main/java/net/thenextlvl/worlds/view/PluginGeneratorView.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/view/PluginGeneratorView.java rename to src/main/java/net/thenextlvl/worlds/view/PluginGeneratorView.java diff --git a/plugin/src/main/java/net/thenextlvl/worlds/view/package-info.java b/src/main/java/net/thenextlvl/worlds/view/package-info.java similarity index 100% rename from plugin/src/main/java/net/thenextlvl/worlds/view/package-info.java rename to src/main/java/net/thenextlvl/worlds/view/package-info.java diff --git a/plugin/src/main/resources/worlds.properties b/src/main/resources/worlds.properties similarity index 100% rename from plugin/src/main/resources/worlds.properties rename to src/main/resources/worlds.properties diff --git a/plugin/src/main/resources/worlds_german.properties b/src/main/resources/worlds_german.properties similarity index 100% rename from plugin/src/main/resources/worlds_german.properties rename to src/main/resources/worlds_german.properties From 49b61c7bbd857d9a456e32b24f195ca1d989f5e0 Mon Sep 17 00:00:00 2001 From: david Date: Thu, 26 Dec 2024 17:42:58 +0100 Subject: [PATCH 3/6] Replace NotNull annotations with JSpecify's NullMarked annotations. Null-safety annotations have been updated across the project to use `@NullMarked` and related annotations from the JSpecify library, replacing the previously used annotations. This ensures better interoperability and alignment with JSpecify's nullness type-checking standards. Additionally, unused dependencies and redundant configurations have been removed for cleanup. --- build.gradle.kts | 2 -- src/main/java/net/thenextlvl/worlds/WorldsPlugin.java | 6 ++---- .../thenextlvl/worlds/command/WorldCloneCommand.java | 5 +++-- .../net/thenextlvl/worlds/command/WorldCommand.java | 3 ++- .../thenextlvl/worlds/command/WorldCreateCommand.java | 5 +++-- .../thenextlvl/worlds/command/WorldDeleteCommand.java | 3 ++- .../thenextlvl/worlds/command/WorldImportCommand.java | 7 ++++--- .../thenextlvl/worlds/command/WorldInfoCommand.java | 3 ++- .../thenextlvl/worlds/command/WorldLinkCommand.java | 3 ++- .../worlds/command/WorldLinkCreateCommand.java | 3 ++- .../worlds/command/WorldLinkListCommand.java | 3 ++- .../worlds/command/WorldLinkRemoveCommand.java | 3 ++- .../thenextlvl/worlds/command/WorldListCommand.java | 3 ++- .../thenextlvl/worlds/command/WorldLoadCommand.java | 3 ++- .../worlds/command/WorldRegenerateCommand.java | 3 ++- .../thenextlvl/worlds/command/WorldSaveAllCommand.java | 3 ++- .../thenextlvl/worlds/command/WorldSaveCommand.java | 3 ++- .../thenextlvl/worlds/command/WorldSaveOffCommand.java | 3 ++- .../thenextlvl/worlds/command/WorldSaveOnCommand.java | 3 ++- .../worlds/command/WorldSetSpawnCommand.java | 3 ++- .../thenextlvl/worlds/command/WorldSpawnCommand.java | 3 ++- .../worlds/command/WorldTeleportCommand.java | 3 ++- .../thenextlvl/worlds/command/WorldUnloadCommand.java | 5 +++-- .../worlds/command/argument/CommandFlagsArgument.java | 5 +++-- .../worlds/command/argument/DimensionArgument.java | 3 ++- .../worlds/command/argument/GeneratorArgument.java | 2 ++ .../worlds/command/argument/RelativeArgument.java | 3 ++- .../worlds/command/argument/SeedArgument.java | 2 ++ .../worlds/command/argument/WorldPresetArgument.java | 2 ++ .../worlds/command/argument/WorldTypeArgument.java | 3 ++- .../worlds/command/argument/package-info.java | 10 ---------- .../net/thenextlvl/worlds/command/package-info.java | 10 ---------- .../suggestion/DimensionSuggestionProvider.java | 3 ++- .../suggestion/GeneratorSuggestionProvider.java | 2 ++ .../command/suggestion/LevelSuggestionProvider.java | 2 ++ .../command/suggestion/RelativeSuggestionProvider.java | 2 ++ .../suggestion/WorldPresetSuggestionProvider.java | 2 ++ .../command/suggestion/WorldSuggestionProvider.java | 2 ++ .../suggestion/WorldTypeSuggestionProvider.java | 3 ++- .../worlds/command/suggestion/package-info.java | 10 ---------- .../worlds/controller/WorldLinkController.java | 2 ++ .../net/thenextlvl/worlds/listener/PortalListener.java | 3 ++- .../net/thenextlvl/worlds/listener/ServerListener.java | 2 ++ .../net/thenextlvl/worlds/listener/package-info.java | 10 ---------- .../java/net/thenextlvl/worlds/model/PaperLevel.java | 4 +++- .../net/thenextlvl/worlds/model/PaperLevelBuilder.java | 6 ++++-- .../net/thenextlvl/worlds/model/PortalCooldown.java | 4 +++- .../java/net/thenextlvl/worlds/model/package-info.java | 10 ---------- .../worlds/version/PluginVersionChecker.java | 4 +++- .../net/thenextlvl/worlds/version/package-info.java | 10 ---------- .../net/thenextlvl/worlds/view/PaperLevelView.java | 3 ++- .../thenextlvl/worlds/view/PluginGeneratorView.java | 2 ++ .../java/net/thenextlvl/worlds/view/package-info.java | 10 ---------- 53 files changed, 101 insertions(+), 116 deletions(-) delete mode 100644 src/main/java/net/thenextlvl/worlds/command/argument/package-info.java delete mode 100644 src/main/java/net/thenextlvl/worlds/command/package-info.java delete mode 100644 src/main/java/net/thenextlvl/worlds/command/suggestion/package-info.java delete mode 100644 src/main/java/net/thenextlvl/worlds/listener/package-info.java delete mode 100644 src/main/java/net/thenextlvl/worlds/model/package-info.java delete mode 100644 src/main/java/net/thenextlvl/worlds/version/package-info.java delete mode 100644 src/main/java/net/thenextlvl/worlds/view/package-info.java diff --git a/build.gradle.kts b/build.gradle.kts index 987debf5..deb84d80 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -34,8 +34,6 @@ dependencies { compileOnly("org.projectlombok:lombok:1.18.36") - compileOnly("net.thenextlvl.core:annotations:2.0.1") - implementation("org.bstats:bstats-bukkit:3.1.0") implementation(project(":api")) diff --git a/src/main/java/net/thenextlvl/worlds/WorldsPlugin.java b/src/main/java/net/thenextlvl/worlds/WorldsPlugin.java index ecc620d4..b1e364ad 100644 --- a/src/main/java/net/thenextlvl/worlds/WorldsPlugin.java +++ b/src/main/java/net/thenextlvl/worlds/WorldsPlugin.java @@ -1,7 +1,5 @@ package net.thenextlvl.worlds; -import core.annotation.FieldsAreNotNullByDefault; -import core.annotation.ParametersAreNotNullByDefault; import core.i18n.file.ComponentBundle; import lombok.Getter; import lombok.experimental.Accessors; @@ -29,6 +27,7 @@ import org.bukkit.entity.Player; import org.bukkit.plugin.ServicePriority; import org.bukkit.plugin.java.JavaPlugin; +import org.jspecify.annotations.NullMarked; import java.io.File; import java.util.Locale; @@ -37,9 +36,8 @@ import static org.bukkit.persistence.PersistentDataType.STRING; @Getter +@NullMarked @Accessors(fluent = true) -@FieldsAreNotNullByDefault -@ParametersAreNotNullByDefault public class WorldsPlugin extends JavaPlugin implements WorldsProvider { private final GeneratorView generatorView = new PluginGeneratorView(); private final LevelView levelView = new PaperLevelView(this); diff --git a/src/main/java/net/thenextlvl/worlds/command/WorldCloneCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldCloneCommand.java index 43855322..f3926cfb 100644 --- a/src/main/java/net/thenextlvl/worlds/command/WorldCloneCommand.java +++ b/src/main/java/net/thenextlvl/worlds/command/WorldCloneCommand.java @@ -14,7 +14,8 @@ import org.bukkit.World; import org.bukkit.WorldCreator; import org.bukkit.entity.Player; -import org.jetbrains.annotations.Nullable; +import org.jspecify.annotations.NullMarked; +import org.jspecify.annotations.Nullable; import java.io.File; import java.io.FileInputStream; @@ -23,8 +24,8 @@ import static org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND; +@NullMarked @RequiredArgsConstructor -@SuppressWarnings("UnstableApiUsage") class WorldCloneCommand { private final WorldsPlugin plugin; diff --git a/src/main/java/net/thenextlvl/worlds/command/WorldCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldCommand.java index 9b3c78b5..7c716281 100644 --- a/src/main/java/net/thenextlvl/worlds/command/WorldCommand.java +++ b/src/main/java/net/thenextlvl/worlds/command/WorldCommand.java @@ -4,9 +4,10 @@ import io.papermc.paper.plugin.lifecycle.event.types.LifecycleEvents; import lombok.RequiredArgsConstructor; import net.thenextlvl.worlds.WorldsPlugin; +import org.jspecify.annotations.NullMarked; +@NullMarked @RequiredArgsConstructor -@SuppressWarnings("UnstableApiUsage") public class WorldCommand { private final WorldsPlugin plugin; diff --git a/src/main/java/net/thenextlvl/worlds/command/WorldCreateCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldCreateCommand.java index 9f92e887..ab4b0b53 100644 --- a/src/main/java/net/thenextlvl/worlds/command/WorldCreateCommand.java +++ b/src/main/java/net/thenextlvl/worlds/command/WorldCreateCommand.java @@ -23,15 +23,16 @@ import org.bukkit.NamespacedKey; import org.bukkit.World; import org.bukkit.entity.Entity; -import org.jetbrains.annotations.Nullable; +import org.jspecify.annotations.NullMarked; +import org.jspecify.annotations.Nullable; import java.io.File; import java.util.concurrent.ThreadLocalRandom; import static org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND; +@NullMarked @RequiredArgsConstructor -@SuppressWarnings("UnstableApiUsage") class WorldCreateCommand { private final WorldsPlugin plugin; diff --git a/src/main/java/net/thenextlvl/worlds/command/WorldDeleteCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldDeleteCommand.java index 8f7ae4b6..4976629f 100644 --- a/src/main/java/net/thenextlvl/worlds/command/WorldDeleteCommand.java +++ b/src/main/java/net/thenextlvl/worlds/command/WorldDeleteCommand.java @@ -12,12 +12,13 @@ import net.thenextlvl.worlds.command.argument.CommandFlagsArgument; import net.thenextlvl.worlds.command.suggestion.WorldSuggestionProvider; import org.bukkit.World; +import org.jspecify.annotations.NullMarked; import java.io.File; import java.util.Set; +@NullMarked @RequiredArgsConstructor -@SuppressWarnings("UnstableApiUsage") class WorldDeleteCommand { private final WorldsPlugin plugin; diff --git a/src/main/java/net/thenextlvl/worlds/command/WorldImportCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldImportCommand.java index 66bb3db3..09dcb25c 100644 --- a/src/main/java/net/thenextlvl/worlds/command/WorldImportCommand.java +++ b/src/main/java/net/thenextlvl/worlds/command/WorldImportCommand.java @@ -18,15 +18,16 @@ import org.bukkit.NamespacedKey; import org.bukkit.World; import org.bukkit.entity.Entity; -import org.jetbrains.annotations.Nullable; +import org.jspecify.annotations.NullMarked; +import org.jspecify.annotations.Nullable; import java.io.File; import java.util.Optional; import static org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND; +@NullMarked @RequiredArgsConstructor -@SuppressWarnings("UnstableApiUsage") class WorldImportCommand { private final WorldsPlugin plugin; @@ -57,7 +58,7 @@ class WorldImportCommand { } private int execute(CommandContext context, @Nullable NamespacedKey key, - @Nullable World.Environment environment, @Nullable Generator generator) { + World.@Nullable Environment environment, @Nullable Generator generator) { var name = context.getArgument("world", String.class); var levelFolder = new File(plugin.getServer().getWorldContainer(), name); diff --git a/src/main/java/net/thenextlvl/worlds/command/WorldInfoCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldInfoCommand.java index 5ec9e215..a0479653 100644 --- a/src/main/java/net/thenextlvl/worlds/command/WorldInfoCommand.java +++ b/src/main/java/net/thenextlvl/worlds/command/WorldInfoCommand.java @@ -16,11 +16,12 @@ import org.bukkit.WorldType; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +import org.jspecify.annotations.NullMarked; import java.util.Optional; +@NullMarked @RequiredArgsConstructor -@SuppressWarnings("UnstableApiUsage") class WorldInfoCommand { private final WorldsPlugin plugin; diff --git a/src/main/java/net/thenextlvl/worlds/command/WorldLinkCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldLinkCommand.java index b775cfaf..913d451e 100644 --- a/src/main/java/net/thenextlvl/worlds/command/WorldLinkCommand.java +++ b/src/main/java/net/thenextlvl/worlds/command/WorldLinkCommand.java @@ -5,9 +5,10 @@ import io.papermc.paper.command.brigadier.Commands; import lombok.RequiredArgsConstructor; import net.thenextlvl.worlds.WorldsPlugin; +import org.jspecify.annotations.NullMarked; +@NullMarked @RequiredArgsConstructor -@SuppressWarnings("UnstableApiUsage") class WorldLinkCommand { private final WorldsPlugin plugin; diff --git a/src/main/java/net/thenextlvl/worlds/command/WorldLinkCreateCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldLinkCreateCommand.java index 627dd5d6..3d33abb0 100644 --- a/src/main/java/net/thenextlvl/worlds/command/WorldLinkCreateCommand.java +++ b/src/main/java/net/thenextlvl/worlds/command/WorldLinkCreateCommand.java @@ -10,9 +10,10 @@ import net.thenextlvl.worlds.WorldsPlugin; import net.thenextlvl.worlds.command.suggestion.WorldSuggestionProvider; import org.bukkit.World; +import org.jspecify.annotations.NullMarked; +@NullMarked @RequiredArgsConstructor -@SuppressWarnings("UnstableApiUsage") public class WorldLinkCreateCommand { private final WorldsPlugin plugin; diff --git a/src/main/java/net/thenextlvl/worlds/command/WorldLinkListCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldLinkListCommand.java index cda92517..d8ec802b 100644 --- a/src/main/java/net/thenextlvl/worlds/command/WorldLinkListCommand.java +++ b/src/main/java/net/thenextlvl/worlds/command/WorldLinkListCommand.java @@ -10,12 +10,13 @@ import net.thenextlvl.worlds.WorldsPlugin; import net.thenextlvl.worlds.api.link.Relative; import org.bukkit.World; +import org.jspecify.annotations.NullMarked; import java.util.Arrays; import java.util.Objects; +@NullMarked @RequiredArgsConstructor -@SuppressWarnings("UnstableApiUsage") public class WorldLinkListCommand { private final WorldsPlugin plugin; diff --git a/src/main/java/net/thenextlvl/worlds/command/WorldLinkRemoveCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldLinkRemoveCommand.java index 9464d562..e494fae7 100644 --- a/src/main/java/net/thenextlvl/worlds/command/WorldLinkRemoveCommand.java +++ b/src/main/java/net/thenextlvl/worlds/command/WorldLinkRemoveCommand.java @@ -12,9 +12,10 @@ import net.thenextlvl.worlds.command.argument.RelativeArgument; import net.thenextlvl.worlds.command.suggestion.WorldSuggestionProvider; import org.bukkit.World; +import org.jspecify.annotations.NullMarked; +@NullMarked @RequiredArgsConstructor -@SuppressWarnings("UnstableApiUsage") public class WorldLinkRemoveCommand { private final WorldsPlugin plugin; diff --git a/src/main/java/net/thenextlvl/worlds/command/WorldListCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldListCommand.java index 25b5ec12..9ca8f43c 100644 --- a/src/main/java/net/thenextlvl/worlds/command/WorldListCommand.java +++ b/src/main/java/net/thenextlvl/worlds/command/WorldListCommand.java @@ -12,9 +12,10 @@ import net.kyori.adventure.text.event.HoverEvent; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import net.thenextlvl.worlds.WorldsPlugin; +import org.jspecify.annotations.NullMarked; +@NullMarked @RequiredArgsConstructor -@SuppressWarnings("UnstableApiUsage") class WorldListCommand { private final WorldsPlugin plugin; diff --git a/src/main/java/net/thenextlvl/worlds/command/WorldLoadCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldLoadCommand.java index 41011401..3f583f45 100644 --- a/src/main/java/net/thenextlvl/worlds/command/WorldLoadCommand.java +++ b/src/main/java/net/thenextlvl/worlds/command/WorldLoadCommand.java @@ -12,14 +12,15 @@ import net.thenextlvl.worlds.api.model.Level; import net.thenextlvl.worlds.command.suggestion.LevelSuggestionProvider; import org.bukkit.entity.Entity; +import org.jspecify.annotations.NullMarked; import java.io.File; import java.util.Optional; import static org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND; +@NullMarked @RequiredArgsConstructor -@SuppressWarnings("UnstableApiUsage") class WorldLoadCommand { private final WorldsPlugin plugin; diff --git a/src/main/java/net/thenextlvl/worlds/command/WorldRegenerateCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldRegenerateCommand.java index 01d09041..43d01f77 100644 --- a/src/main/java/net/thenextlvl/worlds/command/WorldRegenerateCommand.java +++ b/src/main/java/net/thenextlvl/worlds/command/WorldRegenerateCommand.java @@ -13,14 +13,15 @@ import net.thenextlvl.worlds.command.suggestion.WorldSuggestionProvider; import org.bukkit.World; import org.bukkit.WorldCreator; +import org.jspecify.annotations.NullMarked; import java.io.File; import java.util.Set; import static org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND; +@NullMarked @RequiredArgsConstructor -@SuppressWarnings("UnstableApiUsage") class WorldRegenerateCommand { private final WorldsPlugin plugin; diff --git a/src/main/java/net/thenextlvl/worlds/command/WorldSaveAllCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldSaveAllCommand.java index 66c22972..98691a15 100644 --- a/src/main/java/net/thenextlvl/worlds/command/WorldSaveAllCommand.java +++ b/src/main/java/net/thenextlvl/worlds/command/WorldSaveAllCommand.java @@ -8,9 +8,10 @@ import net.thenextlvl.worlds.WorldsPlugin; import org.bukkit.command.ConsoleCommandSender; import org.bukkit.craftbukkit.CraftServer; +import org.jspecify.annotations.NullMarked; +@NullMarked @RequiredArgsConstructor -@SuppressWarnings("UnstableApiUsage") class WorldSaveAllCommand { private final WorldsPlugin plugin; diff --git a/src/main/java/net/thenextlvl/worlds/command/WorldSaveCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldSaveCommand.java index 276c09b4..325b322a 100644 --- a/src/main/java/net/thenextlvl/worlds/command/WorldSaveCommand.java +++ b/src/main/java/net/thenextlvl/worlds/command/WorldSaveCommand.java @@ -11,9 +11,10 @@ import net.thenextlvl.worlds.WorldsPlugin; import net.thenextlvl.worlds.command.suggestion.WorldSuggestionProvider; import org.bukkit.World; +import org.jspecify.annotations.NullMarked; +@NullMarked @RequiredArgsConstructor -@SuppressWarnings("UnstableApiUsage") class WorldSaveCommand { private final WorldsPlugin plugin; diff --git a/src/main/java/net/thenextlvl/worlds/command/WorldSaveOffCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldSaveOffCommand.java index 03bf5781..2d67cbbe 100644 --- a/src/main/java/net/thenextlvl/worlds/command/WorldSaveOffCommand.java +++ b/src/main/java/net/thenextlvl/worlds/command/WorldSaveOffCommand.java @@ -10,9 +10,10 @@ import net.thenextlvl.worlds.command.suggestion.WorldSuggestionProvider; import org.bukkit.World; import org.bukkit.command.CommandSender; +import org.jspecify.annotations.NullMarked; +@NullMarked @RequiredArgsConstructor -@SuppressWarnings("UnstableApiUsage") class WorldSaveOffCommand { private final WorldsPlugin plugin; diff --git a/src/main/java/net/thenextlvl/worlds/command/WorldSaveOnCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldSaveOnCommand.java index fd2d13f1..0c8b96c0 100644 --- a/src/main/java/net/thenextlvl/worlds/command/WorldSaveOnCommand.java +++ b/src/main/java/net/thenextlvl/worlds/command/WorldSaveOnCommand.java @@ -10,9 +10,10 @@ import net.thenextlvl.worlds.command.suggestion.WorldSuggestionProvider; import org.bukkit.World; import org.bukkit.command.CommandSender; +import org.jspecify.annotations.NullMarked; +@NullMarked @RequiredArgsConstructor -@SuppressWarnings("UnstableApiUsage") class WorldSaveOnCommand { private final WorldsPlugin plugin; diff --git a/src/main/java/net/thenextlvl/worlds/command/WorldSetSpawnCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldSetSpawnCommand.java index 5c073315..eff54111 100644 --- a/src/main/java/net/thenextlvl/worlds/command/WorldSetSpawnCommand.java +++ b/src/main/java/net/thenextlvl/worlds/command/WorldSetSpawnCommand.java @@ -12,9 +12,10 @@ import net.thenextlvl.worlds.WorldsPlugin; import org.bukkit.World; import org.bukkit.command.CommandSender; +import org.jspecify.annotations.NullMarked; +@NullMarked @RequiredArgsConstructor -@SuppressWarnings("UnstableApiUsage") class WorldSetSpawnCommand { private final WorldsPlugin plugin; diff --git a/src/main/java/net/thenextlvl/worlds/command/WorldSpawnCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldSpawnCommand.java index ccfe357e..e6579b0c 100644 --- a/src/main/java/net/thenextlvl/worlds/command/WorldSpawnCommand.java +++ b/src/main/java/net/thenextlvl/worlds/command/WorldSpawnCommand.java @@ -8,11 +8,12 @@ import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import net.thenextlvl.worlds.WorldsPlugin; import org.bukkit.entity.Player; +import org.jspecify.annotations.NullMarked; import static org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND; +@NullMarked @RequiredArgsConstructor -@SuppressWarnings("UnstableApiUsage") class WorldSpawnCommand { private final WorldsPlugin plugin; diff --git a/src/main/java/net/thenextlvl/worlds/command/WorldTeleportCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldTeleportCommand.java index 021a9474..da7dcb45 100644 --- a/src/main/java/net/thenextlvl/worlds/command/WorldTeleportCommand.java +++ b/src/main/java/net/thenextlvl/worlds/command/WorldTeleportCommand.java @@ -19,13 +19,14 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; +import org.jspecify.annotations.NullMarked; import java.util.List; import static org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND; +@NullMarked @RequiredArgsConstructor -@SuppressWarnings("UnstableApiUsage") class WorldTeleportCommand { private final WorldsPlugin plugin; diff --git a/src/main/java/net/thenextlvl/worlds/command/WorldUnloadCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldUnloadCommand.java index 25842902..955de277 100644 --- a/src/main/java/net/thenextlvl/worlds/command/WorldUnloadCommand.java +++ b/src/main/java/net/thenextlvl/worlds/command/WorldUnloadCommand.java @@ -10,10 +10,11 @@ import net.thenextlvl.worlds.WorldsPlugin; import net.thenextlvl.worlds.command.suggestion.WorldSuggestionProvider; import org.bukkit.World; -import org.jetbrains.annotations.Nullable; +import org.jspecify.annotations.NullMarked; +import org.jspecify.annotations.Nullable; +@NullMarked @RequiredArgsConstructor -@SuppressWarnings("UnstableApiUsage") class WorldUnloadCommand { private final WorldsPlugin plugin; diff --git a/src/main/java/net/thenextlvl/worlds/command/argument/CommandFlagsArgument.java b/src/main/java/net/thenextlvl/worlds/command/argument/CommandFlagsArgument.java index 09629333..db3e8b85 100644 --- a/src/main/java/net/thenextlvl/worlds/command/argument/CommandFlagsArgument.java +++ b/src/main/java/net/thenextlvl/worlds/command/argument/CommandFlagsArgument.java @@ -2,12 +2,13 @@ import com.mojang.brigadier.arguments.StringArgumentType; import core.paper.command.WrappedArgumentType; -import org.jetbrains.annotations.NotNull; +import org.jspecify.annotations.NullMarked; import java.util.Arrays; import java.util.HashSet; import java.util.Set; +@NullMarked public class CommandFlagsArgument extends WrappedArgumentType { public CommandFlagsArgument(Set flags) { super(StringArgumentType.greedyString(), (reader, type) -> { @@ -27,7 +28,7 @@ public CommandFlagsArgument(Set flags) { } public static class Flags extends HashSet { - private Flags(@NotNull String... flags) { + private Flags(String... flags) { super(Set.of(flags)); } } diff --git a/src/main/java/net/thenextlvl/worlds/command/argument/DimensionArgument.java b/src/main/java/net/thenextlvl/worlds/command/argument/DimensionArgument.java index 34e5ec14..fa745283 100644 --- a/src/main/java/net/thenextlvl/worlds/command/argument/DimensionArgument.java +++ b/src/main/java/net/thenextlvl/worlds/command/argument/DimensionArgument.java @@ -6,8 +6,9 @@ import net.thenextlvl.worlds.WorldsPlugin; import net.thenextlvl.worlds.command.suggestion.DimensionSuggestionProvider; import org.bukkit.World; +import org.jspecify.annotations.NullMarked; -@SuppressWarnings("UnstableApiUsage") +@NullMarked public class DimensionArgument extends WrappedArgumentType { public DimensionArgument(WorldsPlugin plugin) { super(ArgumentTypes.key(), (reader, type) -> switch (type.asString()) { diff --git a/src/main/java/net/thenextlvl/worlds/command/argument/GeneratorArgument.java b/src/main/java/net/thenextlvl/worlds/command/argument/GeneratorArgument.java index b0981ddf..f1f18325 100644 --- a/src/main/java/net/thenextlvl/worlds/command/argument/GeneratorArgument.java +++ b/src/main/java/net/thenextlvl/worlds/command/argument/GeneratorArgument.java @@ -5,7 +5,9 @@ import net.thenextlvl.worlds.WorldsPlugin; import net.thenextlvl.worlds.api.model.Generator; import net.thenextlvl.worlds.command.suggestion.GeneratorSuggestionProvider; +import org.jspecify.annotations.NullMarked; +@NullMarked public class GeneratorArgument extends WrappedArgumentType { public GeneratorArgument(WorldsPlugin plugin) { super(StringArgumentType.string(), (reader, type) -> diff --git a/src/main/java/net/thenextlvl/worlds/command/argument/RelativeArgument.java b/src/main/java/net/thenextlvl/worlds/command/argument/RelativeArgument.java index b31c9d86..f8122bb4 100644 --- a/src/main/java/net/thenextlvl/worlds/command/argument/RelativeArgument.java +++ b/src/main/java/net/thenextlvl/worlds/command/argument/RelativeArgument.java @@ -5,10 +5,11 @@ import net.kyori.adventure.key.Key; import net.thenextlvl.worlds.api.link.Relative; import net.thenextlvl.worlds.command.suggestion.RelativeSuggestionProvider; +import org.jspecify.annotations.NullMarked; import java.util.function.Predicate; -@SuppressWarnings("UnstableApiUsage") +@NullMarked public class RelativeArgument extends WrappedArgumentType { public RelativeArgument(Predicate filter) { super(ArgumentTypes.key(), (reader, type) -> Relative.valueOf(type).orElseThrow(() -> diff --git a/src/main/java/net/thenextlvl/worlds/command/argument/SeedArgument.java b/src/main/java/net/thenextlvl/worlds/command/argument/SeedArgument.java index 069f5deb..162c52c6 100644 --- a/src/main/java/net/thenextlvl/worlds/command/argument/SeedArgument.java +++ b/src/main/java/net/thenextlvl/worlds/command/argument/SeedArgument.java @@ -2,7 +2,9 @@ import com.mojang.brigadier.arguments.StringArgumentType; import core.paper.command.WrappedArgumentType; +import org.jspecify.annotations.NullMarked; +@NullMarked public class SeedArgument extends WrappedArgumentType { public SeedArgument() { super(StringArgumentType.string(), (reader, type) -> { diff --git a/src/main/java/net/thenextlvl/worlds/command/argument/WorldPresetArgument.java b/src/main/java/net/thenextlvl/worlds/command/argument/WorldPresetArgument.java index bff402cb..146060e8 100644 --- a/src/main/java/net/thenextlvl/worlds/command/argument/WorldPresetArgument.java +++ b/src/main/java/net/thenextlvl/worlds/command/argument/WorldPresetArgument.java @@ -8,9 +8,11 @@ import net.thenextlvl.worlds.WorldsPlugin; import net.thenextlvl.worlds.api.preset.Preset; import net.thenextlvl.worlds.command.suggestion.WorldPresetSuggestionProvider; +import org.jspecify.annotations.NullMarked; import java.io.File; +@NullMarked public class WorldPresetArgument extends WrappedArgumentType { public WorldPresetArgument(WorldsPlugin plugin) { super(StringArgumentType.string(), (reader, type) -> { diff --git a/src/main/java/net/thenextlvl/worlds/command/argument/WorldTypeArgument.java b/src/main/java/net/thenextlvl/worlds/command/argument/WorldTypeArgument.java index 25f05a9e..9472c9de 100644 --- a/src/main/java/net/thenextlvl/worlds/command/argument/WorldTypeArgument.java +++ b/src/main/java/net/thenextlvl/worlds/command/argument/WorldTypeArgument.java @@ -6,8 +6,9 @@ import net.thenextlvl.worlds.WorldsPlugin; import net.thenextlvl.worlds.api.model.WorldPreset; import net.thenextlvl.worlds.command.suggestion.WorldTypeSuggestionProvider; +import org.jspecify.annotations.NullMarked; -@SuppressWarnings("UnstableApiUsage") +@NullMarked public class WorldTypeArgument extends WrappedArgumentType { public WorldTypeArgument(WorldsPlugin plugin) { super(ArgumentTypes.key(), (reader, type) -> switch (type.asMinimalString()) { diff --git a/src/main/java/net/thenextlvl/worlds/command/argument/package-info.java b/src/main/java/net/thenextlvl/worlds/command/argument/package-info.java deleted file mode 100644 index 2902104b..00000000 --- a/src/main/java/net/thenextlvl/worlds/command/argument/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -@TypesAreNotNullByDefault -@FieldsAreNotNullByDefault -@MethodsReturnNotNullByDefault -@ParametersAreNotNullByDefault -package net.thenextlvl.worlds.command.argument; - -import core.annotation.FieldsAreNotNullByDefault; -import core.annotation.MethodsReturnNotNullByDefault; -import core.annotation.ParametersAreNotNullByDefault; -import core.annotation.TypesAreNotNullByDefault; \ No newline at end of file diff --git a/src/main/java/net/thenextlvl/worlds/command/package-info.java b/src/main/java/net/thenextlvl/worlds/command/package-info.java deleted file mode 100644 index c1080462..00000000 --- a/src/main/java/net/thenextlvl/worlds/command/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -@TypesAreNotNullByDefault -@FieldsAreNotNullByDefault -@MethodsReturnNotNullByDefault -@ParametersAreNotNullByDefault -package net.thenextlvl.worlds.command; - -import core.annotation.FieldsAreNotNullByDefault; -import core.annotation.MethodsReturnNotNullByDefault; -import core.annotation.ParametersAreNotNullByDefault; -import core.annotation.TypesAreNotNullByDefault; \ No newline at end of file diff --git a/src/main/java/net/thenextlvl/worlds/command/suggestion/DimensionSuggestionProvider.java b/src/main/java/net/thenextlvl/worlds/command/suggestion/DimensionSuggestionProvider.java index 05485924..ce2c0386 100644 --- a/src/main/java/net/thenextlvl/worlds/command/suggestion/DimensionSuggestionProvider.java +++ b/src/main/java/net/thenextlvl/worlds/command/suggestion/DimensionSuggestionProvider.java @@ -7,12 +7,13 @@ import io.papermc.paper.command.brigadier.CommandSourceStack; import lombok.RequiredArgsConstructor; import net.thenextlvl.worlds.WorldsPlugin; +import org.jspecify.annotations.NullMarked; import java.util.Map; import java.util.concurrent.CompletableFuture; +@NullMarked @RequiredArgsConstructor -@SuppressWarnings("UnstableApiUsage") public class DimensionSuggestionProvider implements SuggestionProvider { private final WorldsPlugin plugin; diff --git a/src/main/java/net/thenextlvl/worlds/command/suggestion/GeneratorSuggestionProvider.java b/src/main/java/net/thenextlvl/worlds/command/suggestion/GeneratorSuggestionProvider.java index aebc855b..b99920bc 100644 --- a/src/main/java/net/thenextlvl/worlds/command/suggestion/GeneratorSuggestionProvider.java +++ b/src/main/java/net/thenextlvl/worlds/command/suggestion/GeneratorSuggestionProvider.java @@ -7,10 +7,12 @@ import lombok.RequiredArgsConstructor; import net.thenextlvl.worlds.WorldsPlugin; import org.bukkit.plugin.Plugin; +import org.jspecify.annotations.NullMarked; import java.util.Arrays; import java.util.concurrent.CompletableFuture; +@NullMarked @RequiredArgsConstructor public class GeneratorSuggestionProvider implements SuggestionProvider { private final WorldsPlugin plugin; diff --git a/src/main/java/net/thenextlvl/worlds/command/suggestion/LevelSuggestionProvider.java b/src/main/java/net/thenextlvl/worlds/command/suggestion/LevelSuggestionProvider.java index 26f6d404..561ead31 100644 --- a/src/main/java/net/thenextlvl/worlds/command/suggestion/LevelSuggestionProvider.java +++ b/src/main/java/net/thenextlvl/worlds/command/suggestion/LevelSuggestionProvider.java @@ -7,10 +7,12 @@ import com.mojang.brigadier.suggestion.SuggestionsBuilder; import lombok.RequiredArgsConstructor; import net.thenextlvl.worlds.WorldsPlugin; +import org.jspecify.annotations.NullMarked; import java.io.File; import java.util.concurrent.CompletableFuture; +@NullMarked @RequiredArgsConstructor public class LevelSuggestionProvider implements SuggestionProvider { private final WorldsPlugin plugin; diff --git a/src/main/java/net/thenextlvl/worlds/command/suggestion/RelativeSuggestionProvider.java b/src/main/java/net/thenextlvl/worlds/command/suggestion/RelativeSuggestionProvider.java index 0c39a5e2..c035fa36 100644 --- a/src/main/java/net/thenextlvl/worlds/command/suggestion/RelativeSuggestionProvider.java +++ b/src/main/java/net/thenextlvl/worlds/command/suggestion/RelativeSuggestionProvider.java @@ -6,11 +6,13 @@ import core.paper.command.SuggestionProvider; import lombok.RequiredArgsConstructor; import net.thenextlvl.worlds.api.link.Relative; +import org.jspecify.annotations.NullMarked; import java.util.Arrays; import java.util.concurrent.CompletableFuture; import java.util.function.Predicate; +@NullMarked @RequiredArgsConstructor public class RelativeSuggestionProvider implements SuggestionProvider { private final Predicate filter; diff --git a/src/main/java/net/thenextlvl/worlds/command/suggestion/WorldPresetSuggestionProvider.java b/src/main/java/net/thenextlvl/worlds/command/suggestion/WorldPresetSuggestionProvider.java index 387c7c0a..06cb069f 100644 --- a/src/main/java/net/thenextlvl/worlds/command/suggestion/WorldPresetSuggestionProvider.java +++ b/src/main/java/net/thenextlvl/worlds/command/suggestion/WorldPresetSuggestionProvider.java @@ -7,11 +7,13 @@ import core.paper.command.SuggestionProvider; import lombok.RequiredArgsConstructor; import net.thenextlvl.worlds.WorldsPlugin; +import org.jspecify.annotations.NullMarked; import java.io.File; import java.util.Arrays; import java.util.concurrent.CompletableFuture; +@NullMarked @RequiredArgsConstructor public class WorldPresetSuggestionProvider implements SuggestionProvider { private final WorldsPlugin plugin; diff --git a/src/main/java/net/thenextlvl/worlds/command/suggestion/WorldSuggestionProvider.java b/src/main/java/net/thenextlvl/worlds/command/suggestion/WorldSuggestionProvider.java index 3854ace1..30813de9 100644 --- a/src/main/java/net/thenextlvl/worlds/command/suggestion/WorldSuggestionProvider.java +++ b/src/main/java/net/thenextlvl/worlds/command/suggestion/WorldSuggestionProvider.java @@ -10,10 +10,12 @@ import org.bukkit.Keyed; import org.bukkit.World; import org.bukkit.plugin.Plugin; +import org.jspecify.annotations.NullMarked; import java.util.concurrent.CompletableFuture; import java.util.function.BiPredicate; +@NullMarked @AllArgsConstructor @RequiredArgsConstructor public class WorldSuggestionProvider implements SuggestionProvider { diff --git a/src/main/java/net/thenextlvl/worlds/command/suggestion/WorldTypeSuggestionProvider.java b/src/main/java/net/thenextlvl/worlds/command/suggestion/WorldTypeSuggestionProvider.java index 86231c75..363c1d58 100644 --- a/src/main/java/net/thenextlvl/worlds/command/suggestion/WorldTypeSuggestionProvider.java +++ b/src/main/java/net/thenextlvl/worlds/command/suggestion/WorldTypeSuggestionProvider.java @@ -7,12 +7,13 @@ import io.papermc.paper.command.brigadier.CommandSourceStack; import lombok.RequiredArgsConstructor; import net.thenextlvl.worlds.WorldsPlugin; +import org.jspecify.annotations.NullMarked; import java.util.Map; import java.util.concurrent.CompletableFuture; +@NullMarked @RequiredArgsConstructor -@SuppressWarnings("UnstableApiUsage") public class WorldTypeSuggestionProvider implements SuggestionProvider { private final WorldsPlugin plugin; diff --git a/src/main/java/net/thenextlvl/worlds/command/suggestion/package-info.java b/src/main/java/net/thenextlvl/worlds/command/suggestion/package-info.java deleted file mode 100644 index 88600988..00000000 --- a/src/main/java/net/thenextlvl/worlds/command/suggestion/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -@TypesAreNotNullByDefault -@FieldsAreNotNullByDefault -@MethodsReturnNotNullByDefault -@ParametersAreNotNullByDefault -package net.thenextlvl.worlds.command.suggestion; - -import core.annotation.FieldsAreNotNullByDefault; -import core.annotation.MethodsReturnNotNullByDefault; -import core.annotation.ParametersAreNotNullByDefault; -import core.annotation.TypesAreNotNullByDefault; \ No newline at end of file diff --git a/src/main/java/net/thenextlvl/worlds/controller/WorldLinkController.java b/src/main/java/net/thenextlvl/worlds/controller/WorldLinkController.java index 940ec100..3891bb23 100644 --- a/src/main/java/net/thenextlvl/worlds/controller/WorldLinkController.java +++ b/src/main/java/net/thenextlvl/worlds/controller/WorldLinkController.java @@ -7,11 +7,13 @@ import org.bukkit.NamespacedKey; import org.bukkit.PortalType; import org.bukkit.World; +import org.jspecify.annotations.NullMarked; import java.util.Optional; import static org.bukkit.persistence.PersistentDataType.STRING; +@NullMarked @RequiredArgsConstructor public class WorldLinkController implements LinkController { private final WorldsPlugin plugin; diff --git a/src/main/java/net/thenextlvl/worlds/listener/PortalListener.java b/src/main/java/net/thenextlvl/worlds/listener/PortalListener.java index b14d20f4..9fc40850 100644 --- a/src/main/java/net/thenextlvl/worlds/listener/PortalListener.java +++ b/src/main/java/net/thenextlvl/worlds/listener/PortalListener.java @@ -15,11 +15,13 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityPortalEnterEvent; +import org.jspecify.annotations.NullMarked; import java.util.stream.IntStream; import static org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.END_PORTAL; +@NullMarked @RequiredArgsConstructor public class PortalListener implements Listener { private final PortalCooldown cooldown = new PortalCooldown(); @@ -33,7 +35,6 @@ public void onEntityPortal(EntityPortalReadyEvent event) { event.setTargetWorld(null)); } - @SuppressWarnings("UnstableApiUsage") @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) public void onEntityPortalEnter(EntityPortalEnterEvent event) { if (!event.getPortalType().equals(PortalType.ENDER)) return; diff --git a/src/main/java/net/thenextlvl/worlds/listener/ServerListener.java b/src/main/java/net/thenextlvl/worlds/listener/ServerListener.java index 610b399e..fc8bdd58 100644 --- a/src/main/java/net/thenextlvl/worlds/listener/ServerListener.java +++ b/src/main/java/net/thenextlvl/worlds/listener/ServerListener.java @@ -8,7 +8,9 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.world.WorldLoadEvent; +import org.jspecify.annotations.NullMarked; +@NullMarked @RequiredArgsConstructor public class ServerListener implements Listener { private final WorldsPlugin plugin; diff --git a/src/main/java/net/thenextlvl/worlds/listener/package-info.java b/src/main/java/net/thenextlvl/worlds/listener/package-info.java deleted file mode 100644 index e4c41ffc..00000000 --- a/src/main/java/net/thenextlvl/worlds/listener/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -@TypesAreNotNullByDefault -@FieldsAreNotNullByDefault -@MethodsReturnNotNullByDefault -@ParametersAreNotNullByDefault -package net.thenextlvl.worlds.listener; - -import core.annotation.FieldsAreNotNullByDefault; -import core.annotation.MethodsReturnNotNullByDefault; -import core.annotation.ParametersAreNotNullByDefault; -import core.annotation.TypesAreNotNullByDefault; \ No newline at end of file diff --git a/src/main/java/net/thenextlvl/worlds/model/PaperLevel.java b/src/main/java/net/thenextlvl/worlds/model/PaperLevel.java index b43316f2..39d22c73 100644 --- a/src/main/java/net/thenextlvl/worlds/model/PaperLevel.java +++ b/src/main/java/net/thenextlvl/worlds/model/PaperLevel.java @@ -18,12 +18,14 @@ import org.bukkit.World; import org.bukkit.WorldCreator; import org.bukkit.WorldType; -import org.jetbrains.annotations.Nullable; +import org.jspecify.annotations.NullMarked; +import org.jspecify.annotations.Nullable; import java.util.Optional; import java.util.concurrent.ThreadLocalRandom; @Getter +@NullMarked @Accessors(fluent = true) public class PaperLevel implements Level { private final NBTFile levelData; diff --git a/src/main/java/net/thenextlvl/worlds/model/PaperLevelBuilder.java b/src/main/java/net/thenextlvl/worlds/model/PaperLevelBuilder.java index 45665f22..7667ef11 100644 --- a/src/main/java/net/thenextlvl/worlds/model/PaperLevelBuilder.java +++ b/src/main/java/net/thenextlvl/worlds/model/PaperLevelBuilder.java @@ -12,12 +12,14 @@ import net.thenextlvl.worlds.api.preset.Preset; import org.bukkit.NamespacedKey; import org.bukkit.World; -import org.jetbrains.annotations.Nullable; +import org.jspecify.annotations.NullMarked; +import org.jspecify.annotations.Nullable; import java.io.File; @Getter @Setter +@NullMarked @RequiredArgsConstructor @Accessors(fluent = true) public class PaperLevelBuilder implements LevelBuilder { @@ -31,7 +33,7 @@ public class PaperLevelBuilder implements LevelBuilder { private @Nullable NamespacedKey key; private @Nullable Preset preset; private @Nullable String name; - private @Nullable World.Environment environment; + private World.@Nullable Environment environment; private @Nullable WorldPreset type; @Override diff --git a/src/main/java/net/thenextlvl/worlds/model/PortalCooldown.java b/src/main/java/net/thenextlvl/worlds/model/PortalCooldown.java index 6f6751dc..a4ae84bd 100644 --- a/src/main/java/net/thenextlvl/worlds/model/PortalCooldown.java +++ b/src/main/java/net/thenextlvl/worlds/model/PortalCooldown.java @@ -3,10 +3,12 @@ import io.papermc.paper.threadedregions.scheduler.ScheduledTask; import org.bukkit.entity.Entity; import org.bukkit.plugin.Plugin; -import org.jetbrains.annotations.Nullable; +import org.jspecify.annotations.NullMarked; +import org.jspecify.annotations.Nullable; import java.util.WeakHashMap; +@NullMarked public class PortalCooldown extends WeakHashMap { public boolean isActive(Entity entity) { return containsKey(entity); diff --git a/src/main/java/net/thenextlvl/worlds/model/package-info.java b/src/main/java/net/thenextlvl/worlds/model/package-info.java deleted file mode 100644 index 03e75f4d..00000000 --- a/src/main/java/net/thenextlvl/worlds/model/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -@TypesAreNotNullByDefault -@FieldsAreNotNullByDefault -@MethodsReturnNotNullByDefault -@ParametersAreNotNullByDefault -package net.thenextlvl.worlds.model; - -import core.annotation.FieldsAreNotNullByDefault; -import core.annotation.MethodsReturnNotNullByDefault; -import core.annotation.ParametersAreNotNullByDefault; -import core.annotation.TypesAreNotNullByDefault; \ No newline at end of file diff --git a/src/main/java/net/thenextlvl/worlds/version/PluginVersionChecker.java b/src/main/java/net/thenextlvl/worlds/version/PluginVersionChecker.java index 8bceed06..d18879ea 100644 --- a/src/main/java/net/thenextlvl/worlds/version/PluginVersionChecker.java +++ b/src/main/java/net/thenextlvl/worlds/version/PluginVersionChecker.java @@ -3,8 +3,10 @@ import core.paper.version.PaperHangarVersionChecker; import core.version.SemanticVersion; import org.bukkit.plugin.Plugin; -import org.jetbrains.annotations.Nullable; +import org.jspecify.annotations.NullMarked; +import org.jspecify.annotations.Nullable; +@NullMarked public class PluginVersionChecker extends PaperHangarVersionChecker { public PluginVersionChecker(Plugin plugin) { super(plugin, "TheNextLvl", "Worlds"); diff --git a/src/main/java/net/thenextlvl/worlds/version/package-info.java b/src/main/java/net/thenextlvl/worlds/version/package-info.java deleted file mode 100644 index dc9aa34d..00000000 --- a/src/main/java/net/thenextlvl/worlds/version/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -@TypesAreNotNullByDefault -@FieldsAreNotNullByDefault -@MethodsReturnNotNullByDefault -@ParametersAreNotNullByDefault -package net.thenextlvl.worlds.version; - -import core.annotation.FieldsAreNotNullByDefault; -import core.annotation.MethodsReturnNotNullByDefault; -import core.annotation.ParametersAreNotNullByDefault; -import core.annotation.TypesAreNotNullByDefault; \ No newline at end of file diff --git a/src/main/java/net/thenextlvl/worlds/view/PaperLevelView.java b/src/main/java/net/thenextlvl/worlds/view/PaperLevelView.java index 4b62b04a..1f0e955d 100644 --- a/src/main/java/net/thenextlvl/worlds/view/PaperLevelView.java +++ b/src/main/java/net/thenextlvl/worlds/view/PaperLevelView.java @@ -21,6 +21,7 @@ import org.bukkit.NamespacedKey; import org.bukkit.World; import org.bukkit.craftbukkit.CraftWorld; +import org.jspecify.annotations.NullMarked; import java.io.File; import java.util.Arrays; @@ -29,6 +30,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; +@NullMarked @RequiredArgsConstructor public class PaperLevelView implements LevelView { private final WorldsPlugin plugin; @@ -134,7 +136,6 @@ public Optional getFlatPreset(CompoundTag generator) { } @Override - @SuppressWarnings("UnstableApiUsage") public Optional getGenerator(World world) { if (world.getGenerator() == null) return Optional.empty(); var loader = world.getGenerator().getClass().getClassLoader(); diff --git a/src/main/java/net/thenextlvl/worlds/view/PluginGeneratorView.java b/src/main/java/net/thenextlvl/worlds/view/PluginGeneratorView.java index 58c82a08..3ffcf6f7 100644 --- a/src/main/java/net/thenextlvl/worlds/view/PluginGeneratorView.java +++ b/src/main/java/net/thenextlvl/worlds/view/PluginGeneratorView.java @@ -2,7 +2,9 @@ import net.thenextlvl.worlds.api.view.GeneratorView; import org.bukkit.plugin.Plugin; +import org.jspecify.annotations.NullMarked; +@NullMarked public class PluginGeneratorView implements GeneratorView { @Override public boolean hasGenerator(Plugin plugin) { diff --git a/src/main/java/net/thenextlvl/worlds/view/package-info.java b/src/main/java/net/thenextlvl/worlds/view/package-info.java deleted file mode 100644 index a1c0fbb6..00000000 --- a/src/main/java/net/thenextlvl/worlds/view/package-info.java +++ /dev/null @@ -1,10 +0,0 @@ -@TypesAreNotNullByDefault -@FieldsAreNotNullByDefault -@MethodsReturnNotNullByDefault -@ParametersAreNotNullByDefault -package net.thenextlvl.worlds.view; - -import core.annotation.FieldsAreNotNullByDefault; -import core.annotation.MethodsReturnNotNullByDefault; -import core.annotation.ParametersAreNotNullByDefault; -import core.annotation.TypesAreNotNullByDefault; \ No newline at end of file From 6e73ad29672a010ad352c8a6680e48f1cfabf623 Mon Sep 17 00:00:00 2001 From: david Date: Thu, 26 Dec 2024 17:43:08 +0100 Subject: [PATCH 4/6] Set group and version in root and sync with subproject Moved the group and version definitions to the root project while referencing these values in the API subproject. This ensures consistent versioning and grouping across all modules. --- api/build.gradle.kts | 4 ++-- build.gradle.kts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/api/build.gradle.kts b/api/build.gradle.kts index 8d57a36f..e0590828 100644 --- a/api/build.gradle.kts +++ b/api/build.gradle.kts @@ -13,8 +13,8 @@ tasks.compileJava { options.release.set(21) } -group = "net.thenextlvl.worlds" -version = "2.0.4" +group = rootProject.group +version = rootProject.version repositories { mavenCentral() diff --git a/build.gradle.kts b/build.gradle.kts index deb84d80..e41dbfa3 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -18,8 +18,8 @@ tasks.compileJava { options.release.set(21) } -group = project(":api").group -version = project(":api").version +group = "net.thenextlvl.worlds" +version = "2.0.5" repositories { mavenCentral() From eeff319145327c869210c80af60c03520907aaa8 Mon Sep 17 00:00:00 2001 From: david Date: Thu, 26 Dec 2024 17:43:42 +0100 Subject: [PATCH 5/6] Remove unused Maven repositories from build.gradle.kts The JitPack and snapshots repositories were removed as they are no longer required. This change simplifies the repository configuration and ensures the build script only includes necessary dependencies. --- build.gradle.kts | 2 -- 1 file changed, 2 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index e41dbfa3..d757bafe 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -23,9 +23,7 @@ version = "2.0.5" repositories { mavenCentral() - maven("https://jitpack.io") maven("https://repo.thenextlvl.net/releases") - maven("https://repo.thenextlvl.net/snapshots") maven("https://repo.papermc.io/repository/maven-public/") } From b17edbe3573c05ec802e09630539ae4869264fff Mon Sep 17 00:00:00 2001 From: david Date: Thu, 26 Dec 2024 18:01:15 +0100 Subject: [PATCH 6/6] Remove Lombok and refactor constructors. Replaced Lombok annotations with explicit constructors throughout the codebase. Updated usages of `@Getter` and `@RequiredArgsConstructor` to improve clarity and remove dependency on Lombok. Also refined Gradle dependencies by removing unused Lombok references. --- api/build.gradle.kts | 3 - .../worlds/api/event/WorldDeleteEvent.java | 9 +- .../api/exception/GeneratorException.java | 27 +++- .../thenextlvl/worlds/api/link/Relative.java | 15 +- .../thenextlvl/worlds/api/preset/Preset.java | 130 ++++++++++++++++-- build.gradle.kts | 4 - .../net/thenextlvl/worlds/WorldsPlugin.java | 51 ++++--- .../worlds/command/WorldCloneCommand.java | 6 +- .../worlds/command/WorldCommand.java | 6 +- .../worlds/command/WorldCreateCommand.java | 6 +- .../worlds/command/WorldDeleteCommand.java | 6 +- .../worlds/command/WorldImportCommand.java | 6 +- .../worlds/command/WorldInfoCommand.java | 6 +- .../worlds/command/WorldLinkCommand.java | 6 +- .../command/WorldLinkCreateCommand.java | 8 +- .../worlds/command/WorldLinkListCommand.java | 8 +- .../command/WorldLinkRemoveCommand.java | 8 +- .../worlds/command/WorldListCommand.java | 6 +- .../worlds/command/WorldLoadCommand.java | 6 +- .../command/WorldRegenerateCommand.java | 6 +- .../worlds/command/WorldSaveAllCommand.java | 6 +- .../worlds/command/WorldSaveCommand.java | 6 +- .../worlds/command/WorldSaveOffCommand.java | 6 +- .../worlds/command/WorldSaveOnCommand.java | 6 +- .../worlds/command/WorldSetSpawnCommand.java | 6 +- .../worlds/command/WorldSpawnCommand.java | 6 +- .../worlds/command/WorldTeleportCommand.java | 6 +- .../worlds/command/WorldUnloadCommand.java | 6 +- .../DimensionSuggestionProvider.java | 6 +- .../GeneratorSuggestionProvider.java | 6 +- .../suggestion/LevelSuggestionProvider.java | 6 +- .../RelativeSuggestionProvider.java | 6 +- .../WorldPresetSuggestionProvider.java | 6 +- .../suggestion/WorldSuggestionProvider.java | 15 +- .../WorldTypeSuggestionProvider.java | 6 +- .../controller/WorldLinkController.java | 5 +- .../worlds/listener/PortalListener.java | 6 +- .../worlds/listener/ServerListener.java | 6 +- .../thenextlvl/worlds/model/PaperLevel.java | 68 ++++++++- .../worlds/model/PaperLevelBuilder.java | 117 ++++++++++++++-- .../worlds/view/PaperLevelView.java | 6 +- 41 files changed, 504 insertions(+), 126 deletions(-) diff --git a/api/build.gradle.kts b/api/build.gradle.kts index e0590828..92ce6a0f 100644 --- a/api/build.gradle.kts +++ b/api/build.gradle.kts @@ -23,14 +23,11 @@ repositories { } dependencies { - compileOnly("org.projectlombok:lombok:1.18.36") compileOnly("io.papermc.paper:paper-api:1.21.4-R0.1-SNAPSHOT") implementation("net.thenextlvl.core:nbt:2.2.14") implementation("net.thenextlvl.core:files:2.0.0") implementation("net.thenextlvl.core:adapters:2.0.1") - - annotationProcessor("org.projectlombok:lombok:1.18.36") } diff --git a/api/src/main/java/net/thenextlvl/worlds/api/event/WorldDeleteEvent.java b/api/src/main/java/net/thenextlvl/worlds/api/event/WorldDeleteEvent.java index 6538b353..ee12f56a 100644 --- a/api/src/main/java/net/thenextlvl/worlds/api/event/WorldDeleteEvent.java +++ b/api/src/main/java/net/thenextlvl/worlds/api/event/WorldDeleteEvent.java @@ -1,6 +1,5 @@ package net.thenextlvl.worlds.api.event; -import lombok.Getter; import org.bukkit.World; import org.bukkit.event.HandlerList; import org.bukkit.event.world.WorldEvent; @@ -8,7 +7,7 @@ @NullMarked public class WorldDeleteEvent extends WorldEvent { - private static final @Getter HandlerList handlerList = new HandlerList(); + private static final HandlerList handlerList = new HandlerList(); public WorldDeleteEvent(World world) { super(world, false); @@ -16,6 +15,10 @@ public WorldDeleteEvent(World world) { @Override public HandlerList getHandlers() { - return getHandlerList(); + return handlerList; + } + + public static HandlerList getHandlerList() { + return handlerList; } } diff --git a/api/src/main/java/net/thenextlvl/worlds/api/exception/GeneratorException.java b/api/src/main/java/net/thenextlvl/worlds/api/exception/GeneratorException.java index 1e475ef3..9a68067a 100644 --- a/api/src/main/java/net/thenextlvl/worlds/api/exception/GeneratorException.java +++ b/api/src/main/java/net/thenextlvl/worlds/api/exception/GeneratorException.java @@ -1,6 +1,5 @@ package net.thenextlvl.worlds.api.exception; -import lombok.Getter; import org.jspecify.annotations.NullMarked; import org.jspecify.annotations.Nullable; @@ -8,15 +7,39 @@ * The GeneratorException class is a custom exception that is thrown when a requested plugin as a generator * cannot be found, is disabled, or doesn't provide a chunk generator or biome provider. */ -@Getter @NullMarked public class GeneratorException extends RuntimeException { private final String plugin; private final @Nullable String id; + /** + * Constructs a new GeneratorException with the specified plugin name, generator ID, and error message. + * + * @param plugin the name of the plugin associated with the generator + * @param id the unique identifier for the generator + * @param message the detailed error message describing the reason for the exception + */ public GeneratorException(String plugin, @Nullable String id, String message) { super(message); this.plugin = plugin; this.id = id; } + + /** + * Retrieves the name of the plugin associated with the generator exception. + * + * @return a string representing the plugin name + */ + public String getPlugin() { + return plugin; + } + + /** + * Retrieves the unique identifier associated with the generator exception. + * + * @return a nullable string representing the ID of the generator, or null if no ID is provided + */ + public @Nullable String getId() { + return id; + } } diff --git a/api/src/main/java/net/thenextlvl/worlds/api/link/Relative.java b/api/src/main/java/net/thenextlvl/worlds/api/link/Relative.java index 500be588..50044dd3 100644 --- a/api/src/main/java/net/thenextlvl/worlds/api/link/Relative.java +++ b/api/src/main/java/net/thenextlvl/worlds/api/link/Relative.java @@ -1,8 +1,5 @@ package net.thenextlvl.worlds.api.link; -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import lombok.experimental.Accessors; import net.kyori.adventure.key.Key; import net.kyori.adventure.key.Keyed; import org.bukkit.NamespacedKey; @@ -12,10 +9,7 @@ import java.util.Arrays; import java.util.Optional; -@Getter @NullMarked -@RequiredArgsConstructor -@Accessors(fluent = true) public enum Relative implements Keyed { OVERWORLD(new NamespacedKey("relative", "overworld")), NETHER(new NamespacedKey("relative", "nether")), @@ -23,6 +17,15 @@ public enum Relative implements Keyed { private final NamespacedKey key; + Relative(NamespacedKey key) { + this.key = key; + } + + @Override + public NamespacedKey key() { + return key; + } + public static Optional valueOf(Key key) { return Arrays.stream(values()) .filter(value -> value.key().equals(key)) diff --git a/api/src/main/java/net/thenextlvl/worlds/api/preset/Preset.java b/api/src/main/java/net/thenextlvl/worlds/api/preset/Preset.java index 6ea8b1e1..8af267e2 100644 --- a/api/src/main/java/net/thenextlvl/worlds/api/preset/Preset.java +++ b/api/src/main/java/net/thenextlvl/worlds/api/preset/Preset.java @@ -7,9 +7,6 @@ import core.file.format.GsonFile; import core.io.IO; import core.paper.adapters.inventory.MaterialAdapter; -import lombok.Getter; -import lombok.Setter; -import lombok.experimental.Accessors; import net.thenextlvl.worlds.api.preset.adapter.BiomeTypeAdapter; import net.thenextlvl.worlds.api.preset.adapter.StructureTypeAdapter; import org.bukkit.Material; @@ -19,10 +16,7 @@ import java.util.LinkedHashSet; import java.util.stream.Collectors; -@Getter -@Setter @NullMarked -@Accessors(chain = true, fluent = true) public class Preset { private Biome biome = Biome.minecraft("plains"); private boolean lakes; @@ -33,6 +27,126 @@ public class Preset { @SerializedName("structure_overrides") private LinkedHashSet structures = new LinkedHashSet<>(); + /** + * Retrieves the biome associated with the preset. + * + * @return the biome as a {@code Biome} record + */ + public Biome biome() { + return biome; + } + + /** + * Sets the biome for the current preset. + * + * @param biome the biome to be set, encapsulated in a {@code Biome} record + * @return the current {@code Preset} instance, allowing for method chaining + */ + public Preset biome(Biome biome) { + this.biome = biome; + return this; + } + + /** + * Determines whether lakes are enabled for the preset. + * + * @return true if lakes are enabled, false otherwise + */ + public boolean lakes() { + return lakes; + } + + /** + * Sets whether lakes should be included for the preset. + * + * @param lakes a boolean indicating whether lakes should be included + * @return the current Preset instance, allowing for method chaining + */ + public Preset lakes(boolean lakes) { + this.lakes = lakes; + return this; + } + + /** + * Determines whether features are enabled for the preset. + * + * @return true if features are enabled, false otherwise + */ + public boolean features() { + return features; + } + + /** + * Sets whether the features should be enabled for the preset. + * + * @param features a boolean indicating whether features are enabled + * @return the current Preset instance, allowing for method chaining + */ + public Preset features(boolean features) { + this.features = features; + return this; + } + + /** + * Determines whether decoration is enabled for the preset. + * + * @return true if decoration is enabled, false otherwise + */ + public boolean decoration() { + return decoration; + } + + /** + * Sets whether the decoration should be enabled for the preset. + * + * @param decoration a boolean indicating whether decoration is enabled + * @return the current Preset instance, allowing for method chaining + */ + public Preset decoration(boolean decoration) { + this.decoration = decoration; + return this; + } + + /** + * Retrieves the set of layers associated with the preset. + * + * @return a {@code LinkedHashSet} containing the layers of the preset + */ + public LinkedHashSet layers() { + return layers; + } + + /** + * Sets the layers for the preset. + * + * @param layers the set of layers to be associated with the preset + * @return the preset instance for method chaining + */ + public Preset layers(LinkedHashSet layers) { + this.layers = layers; + return this; + } + + /** + * Retrieves the set of structures associated with the preset. + * + * @return a {@code LinkedHashSet} containing the structures of the preset + */ + public LinkedHashSet structures() { + return structures; + } + + /** + * Sets the structures for the preset. + * + * @param structures the set of structures to be associated with the preset + * @return the preset instance for method chaining + */ + public Preset structures(LinkedHashSet structures) { + this.structures = structures; + return this; + } + /** * Add a layer to the preset * @@ -69,7 +183,7 @@ public boolean saveToFile(File file, boolean force) { } /** - * Serialize this preset into a json object. + * Serialize this preset into a JSON object. * * @return the serialized preset as a JsonObject */ @@ -85,7 +199,7 @@ public JsonObject serialize() { .create(); /** - * Deserialize a json object into a preset + * Deserialize a JSON object into a preset * * @param object the object to deserialize * @return the deserialized preset diff --git a/build.gradle.kts b/build.gradle.kts index d757bafe..65527848 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -30,8 +30,6 @@ repositories { dependencies { paperweight.paperDevBundle("1.21.4-R0.1-SNAPSHOT") - compileOnly("org.projectlombok:lombok:1.18.36") - implementation("org.bstats:bstats-bukkit:3.1.0") implementation(project(":api")) @@ -40,8 +38,6 @@ dependencies { implementation("net.thenextlvl.core:i18n:1.0.20") implementation("net.thenextlvl.core:paper:2.0.2") implementation("net.thenextlvl.core:adapters:2.0.1") - - annotationProcessor("org.projectlombok:lombok:1.18.36") } tasks.shadowJar { diff --git a/src/main/java/net/thenextlvl/worlds/WorldsPlugin.java b/src/main/java/net/thenextlvl/worlds/WorldsPlugin.java index b1e364ad..c2f0f3b2 100644 --- a/src/main/java/net/thenextlvl/worlds/WorldsPlugin.java +++ b/src/main/java/net/thenextlvl/worlds/WorldsPlugin.java @@ -1,8 +1,6 @@ package net.thenextlvl.worlds; import core.i18n.file.ComponentBundle; -import lombok.Getter; -import lombok.experimental.Accessors; import net.kyori.adventure.text.minimessage.MiniMessage; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver; @@ -35,9 +33,7 @@ import static org.bukkit.persistence.PersistentDataType.BOOLEAN; import static org.bukkit.persistence.PersistentDataType.STRING; -@Getter @NullMarked -@Accessors(fluent = true) public class WorldsPlugin extends JavaPlugin implements WorldsProvider { private final GeneratorView generatorView = new PluginGeneratorView(); private final LevelView levelView = new PaperLevelView(this); @@ -61,8 +57,8 @@ public class WorldsPlugin extends JavaPlugin implements WorldsProvider { @Override public void onLoad() { - if (!presetsFolder().isDirectory()) saveDefaultPresets(); - versionChecker().checkVersion(); + if (!presetsFolder.isDirectory()) saveDefaultPresets(); + versionChecker.checkVersion(); registerServices(); } @@ -74,15 +70,38 @@ public void onEnable() { @Override public void onDisable() { - metrics().shutdown(); + metrics.shutdown(); unloadWorlds(); } + public File presetsFolder() { + return presetsFolder; + } + + public ComponentBundle bundle() { + return bundle; + } + + @Override + public GeneratorView generatorView() { + return generatorView; + } + @Override public LevelBuilder levelBuilder(File level) { return new PaperLevelBuilder(this, level); } + @Override + public LevelView levelView() { + return levelView; + } + + @Override + public LinkController linkController() { + return linkController; + } + private void unloadWorlds() { getServer().getWorlds().stream().filter(world -> !world.isAutoSave()).forEach(world -> { world.getPlayers().forEach(player -> player.kick(getServer().shutdownMessage())); @@ -121,14 +140,14 @@ private void registerCommands() { } private void saveDefaultPresets() { - Presets.BOTTOMLESS_PIT.saveToFile(new File(presetsFolder(), "bottomless-pit.json"), true); - Presets.CLASSIC_FLAT.saveToFile(new File(presetsFolder(), "classic-flat.json"), true); - Presets.DESERT.saveToFile(new File(presetsFolder(), "desert.json"), true); - Presets.OVERWORLD.saveToFile(new File(presetsFolder(), "overworld.json"), true); - Presets.REDSTONE_READY.saveToFile(new File(presetsFolder(), "redstone-ready.json"), true); - Presets.SNOWY_KINGDOM.saveToFile(new File(presetsFolder(), "snowy-kingdom.json"), true); - Presets.THE_VOID.saveToFile(new File(presetsFolder(), "the-void.json"), true); - Presets.TUNNELERS_DREAM.saveToFile(new File(presetsFolder(), "tunnelers-dream.json"), true); - Presets.WATER_WORLD.saveToFile(new File(presetsFolder(), "water-world.json"), true); + Presets.BOTTOMLESS_PIT.saveToFile(new File(presetsFolder, "bottomless-pit.json"), true); + Presets.CLASSIC_FLAT.saveToFile(new File(presetsFolder, "classic-flat.json"), true); + Presets.DESERT.saveToFile(new File(presetsFolder, "desert.json"), true); + Presets.OVERWORLD.saveToFile(new File(presetsFolder, "overworld.json"), true); + Presets.REDSTONE_READY.saveToFile(new File(presetsFolder, "redstone-ready.json"), true); + Presets.SNOWY_KINGDOM.saveToFile(new File(presetsFolder, "snowy-kingdom.json"), true); + Presets.THE_VOID.saveToFile(new File(presetsFolder, "the-void.json"), true); + Presets.TUNNELERS_DREAM.saveToFile(new File(presetsFolder, "tunnelers-dream.json"), true); + Presets.WATER_WORLD.saveToFile(new File(presetsFolder, "water-world.json"), true); } } diff --git a/src/main/java/net/thenextlvl/worlds/command/WorldCloneCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldCloneCommand.java index f3926cfb..dd8baf47 100644 --- a/src/main/java/net/thenextlvl/worlds/command/WorldCloneCommand.java +++ b/src/main/java/net/thenextlvl/worlds/command/WorldCloneCommand.java @@ -6,7 +6,6 @@ import io.papermc.paper.command.brigadier.CommandSourceStack; import io.papermc.paper.command.brigadier.Commands; import io.papermc.paper.command.brigadier.argument.ArgumentTypes; -import lombok.RequiredArgsConstructor; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import net.thenextlvl.worlds.WorldsPlugin; import net.thenextlvl.worlds.command.suggestion.WorldSuggestionProvider; @@ -25,10 +24,13 @@ import static org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND; @NullMarked -@RequiredArgsConstructor class WorldCloneCommand { private final WorldsPlugin plugin; + WorldCloneCommand(WorldsPlugin plugin) { + this.plugin = plugin; + } + ArgumentBuilder create() { return Commands.literal("clone") .requires(source -> source.getSender().hasPermission("worlds.command.clone")) diff --git a/src/main/java/net/thenextlvl/worlds/command/WorldCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldCommand.java index 7c716281..5fdb495b 100644 --- a/src/main/java/net/thenextlvl/worlds/command/WorldCommand.java +++ b/src/main/java/net/thenextlvl/worlds/command/WorldCommand.java @@ -2,15 +2,17 @@ import io.papermc.paper.command.brigadier.Commands; import io.papermc.paper.plugin.lifecycle.event.types.LifecycleEvents; -import lombok.RequiredArgsConstructor; import net.thenextlvl.worlds.WorldsPlugin; import org.jspecify.annotations.NullMarked; @NullMarked -@RequiredArgsConstructor public class WorldCommand { private final WorldsPlugin plugin; + public WorldCommand(WorldsPlugin plugin) { + this.plugin = plugin; + } + public void register() { var command = Commands.literal("world") .requires(source -> source.getSender().hasPermission("worlds.command")) diff --git a/src/main/java/net/thenextlvl/worlds/command/WorldCreateCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldCreateCommand.java index ab4b0b53..253dcb2a 100644 --- a/src/main/java/net/thenextlvl/worlds/command/WorldCreateCommand.java +++ b/src/main/java/net/thenextlvl/worlds/command/WorldCreateCommand.java @@ -9,7 +9,6 @@ import io.papermc.paper.command.brigadier.CommandSourceStack; import io.papermc.paper.command.brigadier.Commands; import io.papermc.paper.command.brigadier.argument.ArgumentTypes; -import lombok.RequiredArgsConstructor; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import net.thenextlvl.worlds.WorldsPlugin; import net.thenextlvl.worlds.api.model.Generator; @@ -32,10 +31,13 @@ import static org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND; @NullMarked -@RequiredArgsConstructor class WorldCreateCommand { private final WorldsPlugin plugin; + WorldCreateCommand(WorldsPlugin plugin) { + this.plugin = plugin; + } + ArgumentBuilder create() { return Commands.literal("create") .requires(source -> source.getSender().hasPermission("worlds.command.create")) diff --git a/src/main/java/net/thenextlvl/worlds/command/WorldDeleteCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldDeleteCommand.java index 4976629f..bfd37ba3 100644 --- a/src/main/java/net/thenextlvl/worlds/command/WorldDeleteCommand.java +++ b/src/main/java/net/thenextlvl/worlds/command/WorldDeleteCommand.java @@ -6,7 +6,6 @@ import io.papermc.paper.command.brigadier.CommandSourceStack; import io.papermc.paper.command.brigadier.Commands; import io.papermc.paper.command.brigadier.argument.ArgumentTypes; -import lombok.RequiredArgsConstructor; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import net.thenextlvl.worlds.WorldsPlugin; import net.thenextlvl.worlds.command.argument.CommandFlagsArgument; @@ -18,10 +17,13 @@ import java.util.Set; @NullMarked -@RequiredArgsConstructor class WorldDeleteCommand { private final WorldsPlugin plugin; + WorldDeleteCommand(WorldsPlugin plugin) { + this.plugin = plugin; + } + ArgumentBuilder create() { return Commands.literal("delete") .requires(source -> source.getSender().hasPermission("worlds.command.delete")) diff --git a/src/main/java/net/thenextlvl/worlds/command/WorldImportCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldImportCommand.java index 09dcb25c..f73a4892 100644 --- a/src/main/java/net/thenextlvl/worlds/command/WorldImportCommand.java +++ b/src/main/java/net/thenextlvl/worlds/command/WorldImportCommand.java @@ -7,7 +7,6 @@ import io.papermc.paper.command.brigadier.CommandSourceStack; import io.papermc.paper.command.brigadier.Commands; import io.papermc.paper.command.brigadier.argument.ArgumentTypes; -import lombok.RequiredArgsConstructor; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import net.thenextlvl.worlds.WorldsPlugin; import net.thenextlvl.worlds.api.model.Generator; @@ -27,10 +26,13 @@ import static org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND; @NullMarked -@RequiredArgsConstructor class WorldImportCommand { private final WorldsPlugin plugin; + WorldImportCommand(WorldsPlugin plugin) { + this.plugin = plugin; + } + ArgumentBuilder create() { return Commands.literal("import") .requires(source -> source.getSender().hasPermission("worlds.command.import")) diff --git a/src/main/java/net/thenextlvl/worlds/command/WorldInfoCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldInfoCommand.java index a0479653..d9d3388e 100644 --- a/src/main/java/net/thenextlvl/worlds/command/WorldInfoCommand.java +++ b/src/main/java/net/thenextlvl/worlds/command/WorldInfoCommand.java @@ -6,7 +6,6 @@ import io.papermc.paper.command.brigadier.CommandSourceStack; import io.papermc.paper.command.brigadier.Commands; import io.papermc.paper.command.brigadier.argument.ArgumentTypes; -import lombok.RequiredArgsConstructor; import net.kyori.adventure.key.Key; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import net.thenextlvl.worlds.WorldsPlugin; @@ -21,10 +20,13 @@ import java.util.Optional; @NullMarked -@RequiredArgsConstructor class WorldInfoCommand { private final WorldsPlugin plugin; + WorldInfoCommand(WorldsPlugin plugin) { + this.plugin = plugin; + } + ArgumentBuilder create() { return Commands.literal("info") .requires(source -> source.getSender().hasPermission("worlds.command.info")) diff --git a/src/main/java/net/thenextlvl/worlds/command/WorldLinkCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldLinkCommand.java index 913d451e..dfe453a0 100644 --- a/src/main/java/net/thenextlvl/worlds/command/WorldLinkCommand.java +++ b/src/main/java/net/thenextlvl/worlds/command/WorldLinkCommand.java @@ -3,15 +3,17 @@ import com.mojang.brigadier.builder.ArgumentBuilder; import io.papermc.paper.command.brigadier.CommandSourceStack; import io.papermc.paper.command.brigadier.Commands; -import lombok.RequiredArgsConstructor; import net.thenextlvl.worlds.WorldsPlugin; import org.jspecify.annotations.NullMarked; @NullMarked -@RequiredArgsConstructor class WorldLinkCommand { private final WorldsPlugin plugin; + WorldLinkCommand(WorldsPlugin plugin) { + this.plugin = plugin; + } + ArgumentBuilder create() { return Commands.literal("link") .requires(source -> source.getSender().hasPermission("worlds.command.link")) diff --git a/src/main/java/net/thenextlvl/worlds/command/WorldLinkCreateCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldLinkCreateCommand.java index 3d33abb0..a1362d1c 100644 --- a/src/main/java/net/thenextlvl/worlds/command/WorldLinkCreateCommand.java +++ b/src/main/java/net/thenextlvl/worlds/command/WorldLinkCreateCommand.java @@ -5,7 +5,6 @@ import io.papermc.paper.command.brigadier.CommandSourceStack; import io.papermc.paper.command.brigadier.Commands; import io.papermc.paper.command.brigadier.argument.ArgumentTypes; -import lombok.RequiredArgsConstructor; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import net.thenextlvl.worlds.WorldsPlugin; import net.thenextlvl.worlds.command.suggestion.WorldSuggestionProvider; @@ -13,10 +12,13 @@ import org.jspecify.annotations.NullMarked; @NullMarked -@RequiredArgsConstructor -public class WorldLinkCreateCommand { +class WorldLinkCreateCommand { private final WorldsPlugin plugin; + WorldLinkCreateCommand(WorldsPlugin plugin) { + this.plugin = plugin; + } + ArgumentBuilder create() { return Commands.literal("create") .requires(source -> source.getSender().hasPermission("worlds.command.link.create")) diff --git a/src/main/java/net/thenextlvl/worlds/command/WorldLinkListCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldLinkListCommand.java index d8ec802b..0556eb03 100644 --- a/src/main/java/net/thenextlvl/worlds/command/WorldLinkListCommand.java +++ b/src/main/java/net/thenextlvl/worlds/command/WorldLinkListCommand.java @@ -5,7 +5,6 @@ import com.mojang.brigadier.context.CommandContext; import io.papermc.paper.command.brigadier.CommandSourceStack; import io.papermc.paper.command.brigadier.Commands; -import lombok.RequiredArgsConstructor; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import net.thenextlvl.worlds.WorldsPlugin; import net.thenextlvl.worlds.api.link.Relative; @@ -16,10 +15,13 @@ import java.util.Objects; @NullMarked -@RequiredArgsConstructor -public class WorldLinkListCommand { +class WorldLinkListCommand { private final WorldsPlugin plugin; + WorldLinkListCommand(WorldsPlugin plugin) { + this.plugin = plugin; + } + ArgumentBuilder create() { return Commands.literal("list") .requires(source -> source.getSender().hasPermission("worlds.command.link.list")) diff --git a/src/main/java/net/thenextlvl/worlds/command/WorldLinkRemoveCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldLinkRemoveCommand.java index e494fae7..0422adf1 100644 --- a/src/main/java/net/thenextlvl/worlds/command/WorldLinkRemoveCommand.java +++ b/src/main/java/net/thenextlvl/worlds/command/WorldLinkRemoveCommand.java @@ -5,7 +5,6 @@ import io.papermc.paper.command.brigadier.CommandSourceStack; import io.papermc.paper.command.brigadier.Commands; import io.papermc.paper.command.brigadier.argument.ArgumentTypes; -import lombok.RequiredArgsConstructor; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import net.thenextlvl.worlds.WorldsPlugin; import net.thenextlvl.worlds.api.link.Relative; @@ -15,10 +14,13 @@ import org.jspecify.annotations.NullMarked; @NullMarked -@RequiredArgsConstructor -public class WorldLinkRemoveCommand { +class WorldLinkRemoveCommand { private final WorldsPlugin plugin; + WorldLinkRemoveCommand(WorldsPlugin plugin) { + this.plugin = plugin; + } + ArgumentBuilder create() { return Commands.literal("remove") .requires(source -> source.getSender().hasPermission("worlds.command.link.remove")) diff --git a/src/main/java/net/thenextlvl/worlds/command/WorldListCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldListCommand.java index 9ca8f43c..160b4b8b 100644 --- a/src/main/java/net/thenextlvl/worlds/command/WorldListCommand.java +++ b/src/main/java/net/thenextlvl/worlds/command/WorldListCommand.java @@ -5,7 +5,6 @@ import com.mojang.brigadier.context.CommandContext; import io.papermc.paper.command.brigadier.CommandSourceStack; import io.papermc.paper.command.brigadier.Commands; -import lombok.RequiredArgsConstructor; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.JoinConfiguration; import net.kyori.adventure.text.event.ClickEvent; @@ -15,10 +14,13 @@ import org.jspecify.annotations.NullMarked; @NullMarked -@RequiredArgsConstructor class WorldListCommand { private final WorldsPlugin plugin; + WorldListCommand(WorldsPlugin plugin) { + this.plugin = plugin; + } + ArgumentBuilder create() { return Commands.literal("list") .requires(source -> source.getSender().hasPermission("worlds.command.list")) diff --git a/src/main/java/net/thenextlvl/worlds/command/WorldLoadCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldLoadCommand.java index 3f583f45..a4f2a5a4 100644 --- a/src/main/java/net/thenextlvl/worlds/command/WorldLoadCommand.java +++ b/src/main/java/net/thenextlvl/worlds/command/WorldLoadCommand.java @@ -6,7 +6,6 @@ import com.mojang.brigadier.context.CommandContext; import io.papermc.paper.command.brigadier.CommandSourceStack; import io.papermc.paper.command.brigadier.Commands; -import lombok.RequiredArgsConstructor; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import net.thenextlvl.worlds.WorldsPlugin; import net.thenextlvl.worlds.api.model.Level; @@ -20,10 +19,13 @@ import static org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND; @NullMarked -@RequiredArgsConstructor class WorldLoadCommand { private final WorldsPlugin plugin; + WorldLoadCommand(WorldsPlugin plugin) { + this.plugin = plugin; + } + ArgumentBuilder create() { return Commands.literal("load") .requires(source -> source.getSender().hasPermission("worlds.command.load")) diff --git a/src/main/java/net/thenextlvl/worlds/command/WorldRegenerateCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldRegenerateCommand.java index 43d01f77..2a810607 100644 --- a/src/main/java/net/thenextlvl/worlds/command/WorldRegenerateCommand.java +++ b/src/main/java/net/thenextlvl/worlds/command/WorldRegenerateCommand.java @@ -6,7 +6,6 @@ import io.papermc.paper.command.brigadier.CommandSourceStack; import io.papermc.paper.command.brigadier.Commands; import io.papermc.paper.command.brigadier.argument.ArgumentTypes; -import lombok.RequiredArgsConstructor; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import net.thenextlvl.worlds.WorldsPlugin; import net.thenextlvl.worlds.command.argument.CommandFlagsArgument; @@ -21,10 +20,13 @@ import static org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND; @NullMarked -@RequiredArgsConstructor class WorldRegenerateCommand { private final WorldsPlugin plugin; + WorldRegenerateCommand(WorldsPlugin plugin) { + this.plugin = plugin; + } + ArgumentBuilder create() { return Commands.literal("regenerate") .requires(source -> source.getSender().hasPermission("worlds.command.regenerate")) diff --git a/src/main/java/net/thenextlvl/worlds/command/WorldSaveAllCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldSaveAllCommand.java index 98691a15..fa19f158 100644 --- a/src/main/java/net/thenextlvl/worlds/command/WorldSaveAllCommand.java +++ b/src/main/java/net/thenextlvl/worlds/command/WorldSaveAllCommand.java @@ -4,17 +4,19 @@ import com.mojang.brigadier.builder.ArgumentBuilder; import io.papermc.paper.command.brigadier.CommandSourceStack; import io.papermc.paper.command.brigadier.Commands; -import lombok.RequiredArgsConstructor; import net.thenextlvl.worlds.WorldsPlugin; import org.bukkit.command.ConsoleCommandSender; import org.bukkit.craftbukkit.CraftServer; import org.jspecify.annotations.NullMarked; @NullMarked -@RequiredArgsConstructor class WorldSaveAllCommand { private final WorldsPlugin plugin; + WorldSaveAllCommand(WorldsPlugin plugin) { + this.plugin = plugin; + } + ArgumentBuilder create() { return Commands.literal("save-all") .requires(source -> source.getSender().hasPermission("worlds.command.save-all")) diff --git a/src/main/java/net/thenextlvl/worlds/command/WorldSaveCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldSaveCommand.java index 325b322a..205a6f03 100644 --- a/src/main/java/net/thenextlvl/worlds/command/WorldSaveCommand.java +++ b/src/main/java/net/thenextlvl/worlds/command/WorldSaveCommand.java @@ -6,7 +6,6 @@ import io.papermc.paper.command.brigadier.CommandSourceStack; import io.papermc.paper.command.brigadier.Commands; import io.papermc.paper.command.brigadier.argument.ArgumentTypes; -import lombok.RequiredArgsConstructor; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import net.thenextlvl.worlds.WorldsPlugin; import net.thenextlvl.worlds.command.suggestion.WorldSuggestionProvider; @@ -14,10 +13,13 @@ import org.jspecify.annotations.NullMarked; @NullMarked -@RequiredArgsConstructor class WorldSaveCommand { private final WorldsPlugin plugin; + WorldSaveCommand(WorldsPlugin plugin) { + this.plugin = plugin; + } + ArgumentBuilder create() { return Commands.literal("save") .requires(source -> source.getSender().hasPermission("worlds.command.save")) diff --git a/src/main/java/net/thenextlvl/worlds/command/WorldSaveOffCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldSaveOffCommand.java index 2d67cbbe..0a886ccd 100644 --- a/src/main/java/net/thenextlvl/worlds/command/WorldSaveOffCommand.java +++ b/src/main/java/net/thenextlvl/worlds/command/WorldSaveOffCommand.java @@ -5,7 +5,6 @@ import io.papermc.paper.command.brigadier.CommandSourceStack; import io.papermc.paper.command.brigadier.Commands; import io.papermc.paper.command.brigadier.argument.ArgumentTypes; -import lombok.RequiredArgsConstructor; import net.thenextlvl.worlds.WorldsPlugin; import net.thenextlvl.worlds.command.suggestion.WorldSuggestionProvider; import org.bukkit.World; @@ -13,10 +12,13 @@ import org.jspecify.annotations.NullMarked; @NullMarked -@RequiredArgsConstructor class WorldSaveOffCommand { private final WorldsPlugin plugin; + WorldSaveOffCommand(WorldsPlugin plugin) { + this.plugin = plugin; + } + ArgumentBuilder create() { return Commands.literal("save-off") .requires(source -> source.getSender().hasPermission("worlds.command.save-off")) diff --git a/src/main/java/net/thenextlvl/worlds/command/WorldSaveOnCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldSaveOnCommand.java index 0c8b96c0..a791be28 100644 --- a/src/main/java/net/thenextlvl/worlds/command/WorldSaveOnCommand.java +++ b/src/main/java/net/thenextlvl/worlds/command/WorldSaveOnCommand.java @@ -5,7 +5,6 @@ import io.papermc.paper.command.brigadier.CommandSourceStack; import io.papermc.paper.command.brigadier.Commands; import io.papermc.paper.command.brigadier.argument.ArgumentTypes; -import lombok.RequiredArgsConstructor; import net.thenextlvl.worlds.WorldsPlugin; import net.thenextlvl.worlds.command.suggestion.WorldSuggestionProvider; import org.bukkit.World; @@ -13,10 +12,13 @@ import org.jspecify.annotations.NullMarked; @NullMarked -@RequiredArgsConstructor class WorldSaveOnCommand { private final WorldsPlugin plugin; + WorldSaveOnCommand(WorldsPlugin plugin) { + this.plugin = plugin; + } + ArgumentBuilder create() { return Commands.literal("save-on") .requires(source -> source.getSender().hasPermission("worlds.command.save-on")) diff --git a/src/main/java/net/thenextlvl/worlds/command/WorldSetSpawnCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldSetSpawnCommand.java index eff54111..e4610ebd 100644 --- a/src/main/java/net/thenextlvl/worlds/command/WorldSetSpawnCommand.java +++ b/src/main/java/net/thenextlvl/worlds/command/WorldSetSpawnCommand.java @@ -7,7 +7,6 @@ import io.papermc.paper.command.brigadier.Commands; import io.papermc.paper.command.brigadier.argument.ArgumentTypes; import io.papermc.paper.command.brigadier.argument.resolvers.BlockPositionResolver; -import lombok.RequiredArgsConstructor; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import net.thenextlvl.worlds.WorldsPlugin; import org.bukkit.World; @@ -15,10 +14,13 @@ import org.jspecify.annotations.NullMarked; @NullMarked -@RequiredArgsConstructor class WorldSetSpawnCommand { private final WorldsPlugin plugin; + WorldSetSpawnCommand(WorldsPlugin plugin) { + this.plugin = plugin; + } + ArgumentBuilder create() { return Commands.literal("setspawn") .requires(source -> source.getSender().hasPermission("worlds.command.setspawn")) diff --git a/src/main/java/net/thenextlvl/worlds/command/WorldSpawnCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldSpawnCommand.java index e6579b0c..ba14cbbd 100644 --- a/src/main/java/net/thenextlvl/worlds/command/WorldSpawnCommand.java +++ b/src/main/java/net/thenextlvl/worlds/command/WorldSpawnCommand.java @@ -4,7 +4,6 @@ import com.mojang.brigadier.builder.ArgumentBuilder; import io.papermc.paper.command.brigadier.CommandSourceStack; import io.papermc.paper.command.brigadier.Commands; -import lombok.RequiredArgsConstructor; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import net.thenextlvl.worlds.WorldsPlugin; import org.bukkit.entity.Player; @@ -13,10 +12,13 @@ import static org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND; @NullMarked -@RequiredArgsConstructor class WorldSpawnCommand { private final WorldsPlugin plugin; + WorldSpawnCommand(WorldsPlugin plugin) { + this.plugin = plugin; + } + ArgumentBuilder create() { return Commands.literal("spawn") .requires(source -> source.getSender().hasPermission("worlds.command.spawn") diff --git a/src/main/java/net/thenextlvl/worlds/command/WorldTeleportCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldTeleportCommand.java index da7dcb45..ab4fd737 100644 --- a/src/main/java/net/thenextlvl/worlds/command/WorldTeleportCommand.java +++ b/src/main/java/net/thenextlvl/worlds/command/WorldTeleportCommand.java @@ -9,7 +9,6 @@ import io.papermc.paper.command.brigadier.argument.ArgumentTypes; import io.papermc.paper.command.brigadier.argument.resolvers.FinePositionResolver; import io.papermc.paper.command.brigadier.argument.resolvers.selector.EntitySelectorArgumentResolver; -import lombok.RequiredArgsConstructor; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import net.thenextlvl.worlds.WorldsPlugin; @@ -26,10 +25,13 @@ import static org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.COMMAND; @NullMarked -@RequiredArgsConstructor class WorldTeleportCommand { private final WorldsPlugin plugin; + WorldTeleportCommand(WorldsPlugin plugin) { + this.plugin = plugin; + } + ArgumentBuilder create() { return Commands.literal("teleport") .requires(source -> source.getSender().hasPermission("worlds.command.teleport")) diff --git a/src/main/java/net/thenextlvl/worlds/command/WorldUnloadCommand.java b/src/main/java/net/thenextlvl/worlds/command/WorldUnloadCommand.java index 955de277..ff78f44d 100644 --- a/src/main/java/net/thenextlvl/worlds/command/WorldUnloadCommand.java +++ b/src/main/java/net/thenextlvl/worlds/command/WorldUnloadCommand.java @@ -5,7 +5,6 @@ import io.papermc.paper.command.brigadier.CommandSourceStack; import io.papermc.paper.command.brigadier.Commands; import io.papermc.paper.command.brigadier.argument.ArgumentTypes; -import lombok.RequiredArgsConstructor; import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; import net.thenextlvl.worlds.WorldsPlugin; import net.thenextlvl.worlds.command.suggestion.WorldSuggestionProvider; @@ -14,10 +13,13 @@ import org.jspecify.annotations.Nullable; @NullMarked -@RequiredArgsConstructor class WorldUnloadCommand { private final WorldsPlugin plugin; + WorldUnloadCommand(WorldsPlugin plugin) { + this.plugin = plugin; + } + ArgumentBuilder create() { return Commands.literal("unload") .requires(source -> source.getSender().hasPermission("worlds.command.unload")) diff --git a/src/main/java/net/thenextlvl/worlds/command/suggestion/DimensionSuggestionProvider.java b/src/main/java/net/thenextlvl/worlds/command/suggestion/DimensionSuggestionProvider.java index ce2c0386..f938b604 100644 --- a/src/main/java/net/thenextlvl/worlds/command/suggestion/DimensionSuggestionProvider.java +++ b/src/main/java/net/thenextlvl/worlds/command/suggestion/DimensionSuggestionProvider.java @@ -5,7 +5,6 @@ import com.mojang.brigadier.suggestion.SuggestionsBuilder; import core.paper.command.SuggestionProvider; import io.papermc.paper.command.brigadier.CommandSourceStack; -import lombok.RequiredArgsConstructor; import net.thenextlvl.worlds.WorldsPlugin; import org.jspecify.annotations.NullMarked; @@ -13,10 +12,13 @@ import java.util.concurrent.CompletableFuture; @NullMarked -@RequiredArgsConstructor public class DimensionSuggestionProvider implements SuggestionProvider { private final WorldsPlugin plugin; + public DimensionSuggestionProvider(WorldsPlugin plugin) { + this.plugin = plugin; + } + private final Map dimensions = Map.of( "minecraft:overworld", "environment.normal", "minecraft:the_end", "environment.end", diff --git a/src/main/java/net/thenextlvl/worlds/command/suggestion/GeneratorSuggestionProvider.java b/src/main/java/net/thenextlvl/worlds/command/suggestion/GeneratorSuggestionProvider.java index b99920bc..a0e9114d 100644 --- a/src/main/java/net/thenextlvl/worlds/command/suggestion/GeneratorSuggestionProvider.java +++ b/src/main/java/net/thenextlvl/worlds/command/suggestion/GeneratorSuggestionProvider.java @@ -4,7 +4,6 @@ import com.mojang.brigadier.suggestion.Suggestions; import com.mojang.brigadier.suggestion.SuggestionsBuilder; import core.paper.command.SuggestionProvider; -import lombok.RequiredArgsConstructor; import net.thenextlvl.worlds.WorldsPlugin; import org.bukkit.plugin.Plugin; import org.jspecify.annotations.NullMarked; @@ -13,10 +12,13 @@ import java.util.concurrent.CompletableFuture; @NullMarked -@RequiredArgsConstructor public class GeneratorSuggestionProvider implements SuggestionProvider { private final WorldsPlugin plugin; + public GeneratorSuggestionProvider(WorldsPlugin plugin) { + this.plugin = plugin; + } + @Override public CompletableFuture suggest(CommandContext context, SuggestionsBuilder builder) { Arrays.stream(plugin.getServer().getPluginManager().getPlugins()) diff --git a/src/main/java/net/thenextlvl/worlds/command/suggestion/LevelSuggestionProvider.java b/src/main/java/net/thenextlvl/worlds/command/suggestion/LevelSuggestionProvider.java index 561ead31..ec560b62 100644 --- a/src/main/java/net/thenextlvl/worlds/command/suggestion/LevelSuggestionProvider.java +++ b/src/main/java/net/thenextlvl/worlds/command/suggestion/LevelSuggestionProvider.java @@ -5,7 +5,6 @@ import com.mojang.brigadier.suggestion.SuggestionProvider; import com.mojang.brigadier.suggestion.Suggestions; import com.mojang.brigadier.suggestion.SuggestionsBuilder; -import lombok.RequiredArgsConstructor; import net.thenextlvl.worlds.WorldsPlugin; import org.jspecify.annotations.NullMarked; @@ -13,10 +12,13 @@ import java.util.concurrent.CompletableFuture; @NullMarked -@RequiredArgsConstructor public class LevelSuggestionProvider implements SuggestionProvider { private final WorldsPlugin plugin; + public LevelSuggestionProvider(WorldsPlugin plugin) { + this.plugin = plugin; + } + @Override public CompletableFuture getSuggestions(CommandContext context, SuggestionsBuilder builder) { plugin.levelView().listLevels() diff --git a/src/main/java/net/thenextlvl/worlds/command/suggestion/RelativeSuggestionProvider.java b/src/main/java/net/thenextlvl/worlds/command/suggestion/RelativeSuggestionProvider.java index c035fa36..2e803201 100644 --- a/src/main/java/net/thenextlvl/worlds/command/suggestion/RelativeSuggestionProvider.java +++ b/src/main/java/net/thenextlvl/worlds/command/suggestion/RelativeSuggestionProvider.java @@ -4,7 +4,6 @@ import com.mojang.brigadier.suggestion.Suggestions; import com.mojang.brigadier.suggestion.SuggestionsBuilder; import core.paper.command.SuggestionProvider; -import lombok.RequiredArgsConstructor; import net.thenextlvl.worlds.api.link.Relative; import org.jspecify.annotations.NullMarked; @@ -13,10 +12,13 @@ import java.util.function.Predicate; @NullMarked -@RequiredArgsConstructor public class RelativeSuggestionProvider implements SuggestionProvider { private final Predicate filter; + public RelativeSuggestionProvider(Predicate filter) { + this.filter = filter; + } + @Override public CompletableFuture suggest(CommandContext context, SuggestionsBuilder builder) { Arrays.stream(Relative.values()) diff --git a/src/main/java/net/thenextlvl/worlds/command/suggestion/WorldPresetSuggestionProvider.java b/src/main/java/net/thenextlvl/worlds/command/suggestion/WorldPresetSuggestionProvider.java index 06cb069f..04cf3d70 100644 --- a/src/main/java/net/thenextlvl/worlds/command/suggestion/WorldPresetSuggestionProvider.java +++ b/src/main/java/net/thenextlvl/worlds/command/suggestion/WorldPresetSuggestionProvider.java @@ -5,7 +5,6 @@ import com.mojang.brigadier.suggestion.Suggestions; import com.mojang.brigadier.suggestion.SuggestionsBuilder; import core.paper.command.SuggestionProvider; -import lombok.RequiredArgsConstructor; import net.thenextlvl.worlds.WorldsPlugin; import org.jspecify.annotations.NullMarked; @@ -14,10 +13,13 @@ import java.util.concurrent.CompletableFuture; @NullMarked -@RequiredArgsConstructor public class WorldPresetSuggestionProvider implements SuggestionProvider { private final WorldsPlugin plugin; + public WorldPresetSuggestionProvider(WorldsPlugin plugin) { + this.plugin = plugin; + } + @Override public CompletableFuture suggest(CommandContext context, SuggestionsBuilder builder) { var files = plugin.presetsFolder().listFiles((file, name) -> diff --git a/src/main/java/net/thenextlvl/worlds/command/suggestion/WorldSuggestionProvider.java b/src/main/java/net/thenextlvl/worlds/command/suggestion/WorldSuggestionProvider.java index 30813de9..aa47964b 100644 --- a/src/main/java/net/thenextlvl/worlds/command/suggestion/WorldSuggestionProvider.java +++ b/src/main/java/net/thenextlvl/worlds/command/suggestion/WorldSuggestionProvider.java @@ -4,8 +4,6 @@ import com.mojang.brigadier.suggestion.SuggestionProvider; import com.mojang.brigadier.suggestion.Suggestions; import com.mojang.brigadier.suggestion.SuggestionsBuilder; -import lombok.AllArgsConstructor; -import lombok.RequiredArgsConstructor; import net.kyori.adventure.key.Key; import org.bukkit.Keyed; import org.bukkit.World; @@ -16,11 +14,18 @@ import java.util.function.BiPredicate; @NullMarked -@AllArgsConstructor -@RequiredArgsConstructor public class WorldSuggestionProvider implements SuggestionProvider { private final Plugin plugin; - private BiPredicate, World> filter = (context, world) -> true; + private final BiPredicate, World> filter; + + public WorldSuggestionProvider(Plugin plugin) { + this(plugin, (context, world) -> true); + } + + public WorldSuggestionProvider(Plugin plugin, BiPredicate, World> filter) { + this.plugin = plugin; + this.filter = filter; + } @Override public CompletableFuture getSuggestions(CommandContext context, SuggestionsBuilder builder) { diff --git a/src/main/java/net/thenextlvl/worlds/command/suggestion/WorldTypeSuggestionProvider.java b/src/main/java/net/thenextlvl/worlds/command/suggestion/WorldTypeSuggestionProvider.java index 363c1d58..391338dc 100644 --- a/src/main/java/net/thenextlvl/worlds/command/suggestion/WorldTypeSuggestionProvider.java +++ b/src/main/java/net/thenextlvl/worlds/command/suggestion/WorldTypeSuggestionProvider.java @@ -5,7 +5,6 @@ import com.mojang.brigadier.suggestion.SuggestionsBuilder; import core.paper.command.SuggestionProvider; import io.papermc.paper.command.brigadier.CommandSourceStack; -import lombok.RequiredArgsConstructor; import net.thenextlvl.worlds.WorldsPlugin; import org.jspecify.annotations.NullMarked; @@ -13,10 +12,13 @@ import java.util.concurrent.CompletableFuture; @NullMarked -@RequiredArgsConstructor public class WorldTypeSuggestionProvider implements SuggestionProvider { private final WorldsPlugin plugin; + public WorldTypeSuggestionProvider(WorldsPlugin plugin) { + this.plugin = plugin; + } + private final Map dimensions = Map.of( "minecraft:amplified", "world.type.amplified", "minecraft:checkerboard", "world.type.checkerboard", diff --git a/src/main/java/net/thenextlvl/worlds/controller/WorldLinkController.java b/src/main/java/net/thenextlvl/worlds/controller/WorldLinkController.java index 3891bb23..85250031 100644 --- a/src/main/java/net/thenextlvl/worlds/controller/WorldLinkController.java +++ b/src/main/java/net/thenextlvl/worlds/controller/WorldLinkController.java @@ -1,6 +1,5 @@ package net.thenextlvl.worlds.controller; -import lombok.RequiredArgsConstructor; import net.thenextlvl.worlds.WorldsPlugin; import net.thenextlvl.worlds.api.link.LinkController; import net.thenextlvl.worlds.api.link.Relative; @@ -14,10 +13,12 @@ import static org.bukkit.persistence.PersistentDataType.STRING; @NullMarked -@RequiredArgsConstructor public class WorldLinkController implements LinkController { private final WorldsPlugin plugin; + public WorldLinkController(WorldsPlugin plugin) { + this.plugin = plugin; + } @Override public Optional getTarget(World world, Relative relative) { return Optional.ofNullable(world.getPersistentDataContainer() diff --git a/src/main/java/net/thenextlvl/worlds/listener/PortalListener.java b/src/main/java/net/thenextlvl/worlds/listener/PortalListener.java index 9fc40850..7344b7d7 100644 --- a/src/main/java/net/thenextlvl/worlds/listener/PortalListener.java +++ b/src/main/java/net/thenextlvl/worlds/listener/PortalListener.java @@ -1,7 +1,6 @@ package net.thenextlvl.worlds.listener; import io.papermc.paper.event.entity.EntityPortalReadyEvent; -import lombok.RequiredArgsConstructor; import net.thenextlvl.worlds.WorldsPlugin; import net.thenextlvl.worlds.model.PortalCooldown; import org.bukkit.Bukkit; @@ -22,11 +21,14 @@ import static org.bukkit.event.player.PlayerTeleportEvent.TeleportCause.END_PORTAL; @NullMarked -@RequiredArgsConstructor public class PortalListener implements Listener { private final PortalCooldown cooldown = new PortalCooldown(); private final WorldsPlugin plugin; + public PortalListener(WorldsPlugin plugin) { + this.plugin = plugin; + } + @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) public void onEntityPortal(EntityPortalReadyEvent event) { if (event.getPortalType().equals(PortalType.CUSTOM)) return; diff --git a/src/main/java/net/thenextlvl/worlds/listener/ServerListener.java b/src/main/java/net/thenextlvl/worlds/listener/ServerListener.java index fc8bdd58..ab8a834c 100644 --- a/src/main/java/net/thenextlvl/worlds/listener/ServerListener.java +++ b/src/main/java/net/thenextlvl/worlds/listener/ServerListener.java @@ -1,6 +1,5 @@ package net.thenextlvl.worlds.listener; -import lombok.RequiredArgsConstructor; import net.minecraft.util.DirectoryLock; import net.thenextlvl.worlds.WorldsPlugin; import net.thenextlvl.worlds.api.exception.GeneratorException; @@ -11,10 +10,13 @@ import org.jspecify.annotations.NullMarked; @NullMarked -@RequiredArgsConstructor public class ServerListener implements Listener { private final WorldsPlugin plugin; + public ServerListener(WorldsPlugin plugin) { + this.plugin = plugin; + } + @EventHandler(priority = EventPriority.MONITOR) public void onWorldLoad(WorldLoadEvent event) { if (!event.getWorld().key().asString().equals("minecraft:overworld")) return; diff --git a/src/main/java/net/thenextlvl/worlds/model/PaperLevel.java b/src/main/java/net/thenextlvl/worlds/model/PaperLevel.java index 39d22c73..bcee9bdd 100644 --- a/src/main/java/net/thenextlvl/worlds/model/PaperLevel.java +++ b/src/main/java/net/thenextlvl/worlds/model/PaperLevel.java @@ -5,8 +5,6 @@ import core.nbt.tag.ByteTag; import core.nbt.tag.CompoundTag; import core.nbt.tag.LongTag; -import lombok.Getter; -import lombok.experimental.Accessors; import net.thenextlvl.worlds.WorldsPlugin; import net.thenextlvl.worlds.api.model.Generator; import net.thenextlvl.worlds.api.model.Level; @@ -24,9 +22,7 @@ import java.util.Optional; import java.util.concurrent.ThreadLocalRandom; -@Getter @NullMarked -@Accessors(fluent = true) public class PaperLevel implements Level { private final NBTFile levelData; private final WorldsPlugin plugin; @@ -115,6 +111,26 @@ private WorldType typeOf(WorldPreset worldPreset) { return WorldType.NORMAL; } + @Override + public @Nullable Generator generator() { + return generator; + } + + @Override + public @Nullable Preset preset() { + return preset; + } + + @Override + public NBTFile levelData() { + return levelData; + } + + @Override + public NamespacedKey key() { + return key; + } + @Override public Optional create() { var generatorSettings = Optional.ofNullable(preset()) @@ -130,9 +146,49 @@ public Optional create() { .seed(seed()) .type(typeOf(type())); - if (generator() != null) creator.generator(generator().generator(creator.name())); - if (generator() != null) creator.biomeProvider(generator().biomeProvider(creator.name())); + if (generator != null) creator.generator(generator.generator(creator.name())); + if (generator != null) creator.biomeProvider(generator.biomeProvider(creator.name())); return Optional.ofNullable(creator.createWorld()); } + + @Override + public String name() { + return name; + } + + @Override + public World.Environment environment() { + return environment; + } + + @Override + public WorldPreset type() { + return type; + } + + @Override + public boolean enabled() { + return enabled; + } + + @Override + public boolean hardcore() { + return hardcore; + } + + @Override + public boolean importedBefore() { + return importedBefore; + } + + @Override + public boolean structures() { + return structures; + } + + @Override + public long seed() { + return seed; + } } diff --git a/src/main/java/net/thenextlvl/worlds/model/PaperLevelBuilder.java b/src/main/java/net/thenextlvl/worlds/model/PaperLevelBuilder.java index 7667ef11..8c6b468b 100644 --- a/src/main/java/net/thenextlvl/worlds/model/PaperLevelBuilder.java +++ b/src/main/java/net/thenextlvl/worlds/model/PaperLevelBuilder.java @@ -1,9 +1,5 @@ package net.thenextlvl.worlds.model; -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import lombok.Setter; -import lombok.experimental.Accessors; import net.thenextlvl.worlds.WorldsPlugin; import net.thenextlvl.worlds.api.model.Generator; import net.thenextlvl.worlds.api.model.Level; @@ -17,11 +13,7 @@ import java.io.File; -@Getter -@Setter @NullMarked -@RequiredArgsConstructor -@Accessors(fluent = true) public class PaperLevelBuilder implements LevelBuilder { private final WorldsPlugin plugin; private final File level; @@ -36,6 +28,115 @@ public class PaperLevelBuilder implements LevelBuilder { private World.@Nullable Environment environment; private @Nullable WorldPreset type; + public PaperLevelBuilder(WorldsPlugin plugin, File level) { + this.plugin = plugin; + this.level = level; + } + + @Override + public @Nullable Boolean hardcore() { + return hardcore; + } + + @Override + public @Nullable Boolean structures() { + return structures; + } + + @Override + public @Nullable Generator generator() { + return generator; + } + + @Override + public @Nullable Long seed() { + return seed; + } + + @Override + public @Nullable NamespacedKey key() { + return key; + } + + @Override + public @Nullable Preset preset() { + return preset; + } + + @Override + public @Nullable String name() { + return name; + } + + @Override + public World.@Nullable Environment environment() { + return environment; + } + + @Override + public @Nullable WorldPreset type() { + return type; + } + + @Override + public File level() { + return level; + } + + @Override + public LevelBuilder environment(World.@Nullable Environment environment) { + this.environment = environment; + return this; + } + + @Override + public LevelBuilder generator(@Nullable Generator generator) { + this.generator = generator; + return this; + } + + @Override + public LevelBuilder hardcore(@Nullable Boolean hardcore) { + this.hardcore = hardcore; + return this; + } + + @Override + public LevelBuilder key(@Nullable NamespacedKey key) { + this.key = key; + return this; + } + + @Override + public LevelBuilder name(@Nullable String name) { + this.name = name; + return this; + } + + @Override + public LevelBuilder preset(@Nullable Preset preset) { + this.preset = preset; + return this; + } + + @Override + public LevelBuilder seed(@Nullable Long seed) { + this.seed = seed; + return this; + } + + @Override + public LevelBuilder structures(@Nullable Boolean structures) { + this.structures = structures; + return this; + } + + @Override + public LevelBuilder type(@Nullable WorldPreset type) { + this.type = type; + return this; + } + @Override public Level build() { return new PaperLevel(plugin, this); diff --git a/src/main/java/net/thenextlvl/worlds/view/PaperLevelView.java b/src/main/java/net/thenextlvl/worlds/view/PaperLevelView.java index 1f0e955d..81086488 100644 --- a/src/main/java/net/thenextlvl/worlds/view/PaperLevelView.java +++ b/src/main/java/net/thenextlvl/worlds/view/PaperLevelView.java @@ -8,7 +8,6 @@ import core.nbt.tag.StringTag; import core.nbt.tag.Tag; import io.papermc.paper.plugin.provider.classloader.ConfiguredPluginClassLoader; -import lombok.RequiredArgsConstructor; import net.thenextlvl.worlds.WorldsPlugin; import net.thenextlvl.worlds.api.model.Generator; import net.thenextlvl.worlds.api.model.LevelExtras; @@ -31,10 +30,13 @@ import java.util.stream.Stream; @NullMarked -@RequiredArgsConstructor public class PaperLevelView implements LevelView { private final WorldsPlugin plugin; + public PaperLevelView(WorldsPlugin plugin) { + this.plugin = plugin; + } + @Override public Stream listLevels() { return Optional.ofNullable(plugin.getServer().getWorldContainer()