Skip to content

Commit

Permalink
Merge pull request #75 from TheNextLvl-net/cleanup
Browse files Browse the repository at this point in the history
Cleanup: removed lombok and jetbrains annotations and moved plugins module to root
  • Loading branch information
NonSwag authored Dec 26, 2024
2 parents 6e9c717 + b17edbe commit 725be15
Show file tree
Hide file tree
Showing 85 changed files with 743 additions and 371 deletions.
16 changes: 7 additions & 9 deletions api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,30 @@ plugins {
}

java {
toolchain.languageVersion = JavaLanguageVersion.of(21)
withSourcesJar()
withJavadocJar()
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

group = "net.thenextlvl.worlds"
version = "2.0.3"
tasks.compileJava {
options.release.set(21)
}

group = rootProject.group
version = rootProject.version

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")
implementation("net.thenextlvl.core:files:2.0.0")
implementation("net.thenextlvl.core:adapters:2.0.1")

annotationProcessor("org.projectlombok:lombok:1.18.36")
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
package net.thenextlvl.worlds.api.event;

import lombok.Getter;
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();
private static final HandlerList handlerList = new HandlerList();

public WorldDeleteEvent(World world) {
super(world, false);
}

@Override
public HandlerList getHandlers() {
return getHandlerList();
return handlerList;
}

public static HandlerList getHandlerList() {
return handlerList;
}
}
Original file line number Diff line number Diff line change
@@ -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);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,20 +1,45 @@
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;

/**
* 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;
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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<NamespacedKey> getTarget(World world, PortalType type);

Expand Down
17 changes: 11 additions & 6 deletions api/src/main/java/net/thenextlvl/worlds/api/link/Relative.java
Original file line number Diff line number Diff line change
@@ -1,26 +1,31 @@
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;
import org.bukkit.World;
import org.jspecify.annotations.NullMarked;

import java.util.Arrays;
import java.util.Optional;

@Getter
@RequiredArgsConstructor
@Accessors(fluent = true)
@NullMarked
public enum Relative implements Keyed {
OVERWORLD(new NamespacedKey("relative", "overworld")),
NETHER(new NamespacedKey("relative", "nether")),
THE_END(new NamespacedKey("relative", "the_end"));

private final NamespacedKey key;

Relative(NamespacedKey key) {
this.key = key;
}

@Override
public NamespacedKey key() {
return key;
}

public static Optional<Relative> valueOf(Key key) {
return Arrays.stream(values())
.filter(value -> value.key().equals(key))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
7 changes: 5 additions & 2 deletions api/src/main/java/net/thenextlvl/worlds/api/model/Level.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
32 changes: 21 additions & 11 deletions api/src/main/java/net/thenextlvl/worlds/api/model/LevelBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down

This file was deleted.

2 changes: 2 additions & 0 deletions api/src/main/java/net/thenextlvl/worlds/api/preset/Biome.java
Original file line number Diff line number Diff line change
@@ -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());
Expand Down
2 changes: 2 additions & 0 deletions api/src/main/java/net/thenextlvl/worlds/api/preset/Layer.java
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
Loading

0 comments on commit 725be15

Please sign in to comment.