Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout repository
uses: actions/checkout@v5
uses: actions/checkout@v6
- name: Setup Java
uses: actions/setup-java@v5
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout Repository
uses: actions/checkout@v5
uses: actions/checkout@v6
- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v5
- name: Setup Java
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publishing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
ONELITEFEATHER_MAVEN_PASSWORD: ${{ secrets.ONELITEFEATHER_MAVEN_PASSWORD }}
steps:
- name: Checkout repository
uses: actions/checkout@v5
uses: actions/checkout@v6

- name: Set up JDK 25
uses: actions/setup-java@v5
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
}

group = "net.theevilreaper"
version = "1.12.0"
version = "1.13.0"
description = "Aves"

java {
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ dependencyResolutionManagement {
}
versionCatalogs {
create("libs") {
version("bom", "1.5.0")
version("bom", "1.6.0")
library("mycelium.bom", "net.onelitefeather", "mycelium-bom").versionRef("bom")
library("minestom","net.minestom", "minestom").withoutVersion()
library("adventure", "net.kyori", "adventure-text-minimessage").withoutVersion()
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/net/theevilreaper/aves/file/FileHandler.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package net.theevilreaper.aves.file;

import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -37,7 +36,7 @@ public interface FileHandler {
* @param object The object to save
* @param <T> A generic type for the object value
*/
<T> void save(@NotNull Path path, @NotNull T object);
<T> void save(Path path, T object);

/**
* Load a given file and parse to the give class.
Expand All @@ -47,5 +46,5 @@ public interface FileHandler {
* @param <T> is generic type for the object value
* @return a {@link Optional} with the object instance
*/
<T> Optional<T> load(@NotNull Path path, @NotNull Class<T> clazz);
<T> Optional<T> load(Path path, Class<T> clazz);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import net.minestom.server.utils.validate.Check;
import org.jetbrains.annotations.NotNull;

import java.io.IOException;
import java.nio.file.Files;
Expand Down Expand Up @@ -33,7 +32,7 @@ public GsonFileHandler() {
* Creates a new instance from the file handler.
* @param gson the gson instance to deserialize or serialize data
*/
public GsonFileHandler(@NotNull Gson gson) {
public GsonFileHandler(Gson gson) {
this.gson = gson;
}

Expand All @@ -44,7 +43,7 @@ public GsonFileHandler(@NotNull Gson gson) {
* @param <T> A generic type for the object value
*/
@Override
public <T> void save(@NotNull Path path, @NotNull T object) {
public <T> void save(Path path, T object) {
Check.argCondition(Files.isDirectory(path), "Unable to save a directory. Please check the used path");
try (var outputStream = Files.newBufferedWriter(path, UTF_8)) {
if (!Files.exists(path)) {
Expand All @@ -65,7 +64,7 @@ public <T> void save(@NotNull Path path, @NotNull T object) {
* @return a {@link Optional} with the object instance
*/
@Override
public <T> Optional<T> load(@NotNull Path path, @NotNull Class<T> clazz) {
public <T> Optional<T> load(Path path, Class<T> clazz) {
Check.argCondition(Files.isDirectory(path), "Unable to load a directory. Please check the used path");
if (!Files.exists(path)) {
return Optional.empty();
Expand Down
20 changes: 11 additions & 9 deletions src/main/java/net/theevilreaper/aves/file/ModernFileHandler.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package net.theevilreaper.aves.file;

import com.google.gson.reflect.TypeToken;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -11,7 +10,8 @@
import java.util.Optional;

/**
* The class represents the base logic to load or save json files.
* The class represents the base logic to load or save JSON files.
*
* @author theEvilReaper
* @version 1.0.0
* @since 1.9.0
Expand All @@ -24,19 +24,21 @@ public interface ModernFileHandler {

/**
* Saves a given object into a file.
* @param path The path where the file is located
* @param object The object to save
*
* @param path The path where the file is located
* @param object The object to save
* @param typeToken the type token to serialize the object
* @param <T> A generic type for the object value
* @param <T> A generic type for the object value
*/
<T> void save(@NotNull Path path, @NotNull T object, @NotNull TypeToken<T> typeToken);
<T> void save(Path path, T object, TypeToken<T> typeToken);

/**
* Load a given file and parse to the give class.
* @param path is the where the file is located
*
* @param path is the where the file is located
* @param typeToken the type token to deserialize the object
* @param <T> is generic type for the object value
* @param <T> is generic type for the object value
* @return a {@link Optional} with the object instance
*/
<T> Optional<T> load(@NotNull Path path, @NotNull TypeToken<T> typeToken);
<T> Optional<T> load(Path path, TypeToken<T> typeToken);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import net.minestom.server.utils.validate.Check;
import org.jetbrains.annotations.NotNull;

import java.io.IOException;
import java.nio.file.Files;
Expand Down Expand Up @@ -31,7 +30,7 @@ public ModernGsonFileHandler() {
* Creates a new instance from the file handler.
* @param gson the gson instance to deserialize or serialize data
*/
public ModernGsonFileHandler(@NotNull Gson gson) {
public ModernGsonFileHandler(Gson gson) {
this.gson = gson;
}

Expand All @@ -42,7 +41,7 @@ public ModernGsonFileHandler(@NotNull Gson gson) {
* @param <T> A generic type for the object value
*/
@Override
public <T> void save(@NotNull Path path, @NotNull T object, @NotNull TypeToken<T> typeToken) {
public <T> void save(Path path, T object, TypeToken<T> typeToken) {
Check.argCondition(Files.isDirectory(path), "Unable to save a directory. Please check the used path");
try (var outputStream = Files.newBufferedWriter(path, UTF_8)) {
if (!Files.exists(path)) {
Expand All @@ -63,7 +62,7 @@ public <T> void save(@NotNull Path path, @NotNull T object, @NotNull TypeToken<T
* @return a {@link Optional} with the object instance
*/
@Override
public <T> Optional<T> load(@NotNull Path path, @NotNull TypeToken<T> typeToken) {
public <T> Optional<T> load(Path path, TypeToken<T> typeToken) {
Check.argCondition(Files.isDirectory(path), "Unable to load a directory. Please check the used path");
if (!Files.exists(path)) {
return Optional.empty();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import net.minestom.server.item.Material;
import net.minestom.server.item.component.CustomModelData;
import net.minestom.server.item.component.TooltipDisplay;
import org.jetbrains.annotations.NotNull;

import java.lang.reflect.Type;

Expand All @@ -30,7 +29,7 @@ public non-sealed class ItemStackGsonTypeAdapter implements JsonSerializer<ItemS
private static final String CUSTOM_MODEL_DATA = "customModelData";

@Override
public JsonElement serialize(@NotNull ItemStack itemStack, Type type, JsonSerializationContext context) {
public JsonElement serialize(ItemStack itemStack, Type type, JsonSerializationContext context) {
JsonObject object = new JsonObject();
object.addProperty(MATERIAL, itemStack.material().name());
object.addProperty("amount", itemStack.amount());
Expand Down Expand Up @@ -60,7 +59,7 @@ public JsonElement serialize(@NotNull ItemStack itemStack, Type type, JsonSerial
}

@Override
public ItemStack deserialize(@NotNull JsonElement jsonElement, Type type, JsonDeserializationContext context) throws JsonParseException {
public ItemStack deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context) throws JsonParseException {
JsonObject object = jsonElement.getAsJsonObject();

Material material = Material.STONE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import net.minestom.server.item.enchant.Enchantment;
import net.minestom.server.registry.DynamicRegistry;
import net.minestom.server.registry.RegistryKey;
import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -42,7 +41,7 @@ sealed interface ItemStackSerializerHelper permits ItemStackGsonTypeAdapter {
* @param stack the stack to serialize
* @param object the object to serialize the data
*/
default void serializeCustomName(@NotNull ItemStack stack, @NotNull JsonObject object) {
default void serializeCustomName(ItemStack stack, JsonObject object) {
if (!stack.has(DataComponents.CUSTOM_NAME)) return;
final Component itemName = stack.get(DataComponents.CUSTOM_NAME, Component.empty());
final String displayName = plainText().serialize(itemName);
Expand All @@ -55,7 +54,7 @@ default void serializeCustomName(@NotNull ItemStack stack, @NotNull JsonObject o
* @param stack the builder to set the custom name
* @param jsonObject the object to deserialize the data
*/
default void serializeLore(@NotNull ItemStack stack, @NotNull JsonObject jsonObject) {
default void serializeLore(ItemStack stack, JsonObject jsonObject) {
if (!stack.has(DataComponents.LORE)) return;
final List<Component> loreLines = stack.get(DataComponents.LORE);

Expand All @@ -75,7 +74,7 @@ default void serializeLore(@NotNull ItemStack stack, @NotNull JsonObject jsonObj
* @param object the object to deserialize the data
* @return the builder with the lore set
*/
default @NotNull ItemStack.Builder deserializeLore(@NotNull ItemStack.Builder builder, @NotNull JsonObject object) {
default ItemStack.Builder deserializeLore(ItemStack.Builder builder, JsonObject object) {
if (!object.has(LORE_KEY)) return builder;

JsonArray loreArray = object.getAsJsonArray(LORE_KEY);
Expand All @@ -92,7 +91,7 @@ default void serializeLore(@NotNull ItemStack stack, @NotNull JsonObject jsonObj
* @param stack the stack to serialize
* @param object the object to serialize the data
*/
default void serializeEnchantments(@NotNull ItemStack stack, @NotNull JsonObject object) {
default void serializeEnchantments(ItemStack stack, JsonObject object) {
if (!stack.has(DataComponents.ENCHANTMENTS)) return;
JsonArray enchantsArray = new JsonArray();
final EnchantmentList enchantmentList = stack.get(DataComponents.ENCHANTMENTS);
Expand All @@ -115,7 +114,7 @@ default void serializeEnchantments(@NotNull ItemStack stack, @NotNull JsonObject
* @param object the object to deserialize the data
* @return the builder with the enchantments set
*/
default @NotNull ItemStack.Builder deserializeEnchantments(@NotNull ItemStack.Builder builder, @NotNull JsonObject object) {
default ItemStack.Builder deserializeEnchantments(ItemStack.Builder builder, JsonObject object) {
if (!object.has(ENCHANTMENTS)) return builder;
JsonArray enchantsArray = object.getAsJsonArray(ENCHANTMENTS);
Map<RegistryKey<Enchantment>, Integer> enchantments = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import com.google.gson.stream.JsonWriter;
import net.kyori.adventure.key.Key;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;

import java.io.IOException;
import java.util.function.BiFunction;
Expand Down Expand Up @@ -36,7 +35,7 @@ public class KeyGsonAdapter extends TypeAdapter<Key> {

private final BiFunction<String, String, Key> createKeyObject;

private KeyGsonAdapter(@NotNull BiFunction<String, String, Key> createKeyObject) {
private KeyGsonAdapter(BiFunction<String, String, Key> createKeyObject) {
this.createKeyObject = createKeyObject;
}

Expand All @@ -49,7 +48,7 @@ private KeyGsonAdapter() {
* @return the new instance of the {@link KeyGsonAdapter}
*/
@Contract(value = " -> new", pure = true)
public static @NotNull KeyGsonAdapter create() {
public static KeyGsonAdapter create() {
return new KeyGsonAdapter();
}

Expand All @@ -59,23 +58,20 @@ private KeyGsonAdapter() {
* @return the new instance of the {@link KeyGsonAdapter}
*/
@Contract(value = "_ -> new", pure = true)
public static @NotNull KeyGsonAdapter create(@NotNull BiFunction<String, String, Key> createKeyObject) {
public static KeyGsonAdapter create(BiFunction<String, String, Key> createKeyObject) {
return new KeyGsonAdapter(createKeyObject);
}

/**
* Creates a new instance of the {@link KeyGsonAdapter} with a custom key) creation function for Minestom.
* @return the new instance of the {@link KeyGsonAdapter}
*/
public static @NotNull KeyGsonAdapter createMinestom() {
public static KeyGsonAdapter createMinestom() {
return new KeyGsonAdapter(Key::key);
}

@Override
public void write(JsonWriter out, Key value) throws IOException {
if (value == null) {
return;
}
out.beginObject();
out.name("namespace").value(value.namespace());
out.name("value").value(value.value());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;

import java.io.IOException;

Expand Down Expand Up @@ -36,15 +35,12 @@ public class MiniMessageComponentGsonAdapter extends TypeAdapter<Component> {
* @return the new instance of the {@link MiniMessageComponentGsonAdapter}
*/
@Contract(value = " -> new", pure = true)
public static @NotNull MiniMessageComponentGsonAdapter create() {
public static MiniMessageComponentGsonAdapter create() {
return new MiniMessageComponentGsonAdapter();
}

@Override
public void write(JsonWriter out, Component value) throws IOException {
if (value == null) {
return;
}
out.beginObject();
out.name("minimessage").value(MiniMessage.miniMessage().serialize(value));
out.endObject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import net.minestom.server.coordinate.Point;
import net.minestom.server.coordinate.Pos;
import net.minestom.server.coordinate.Vec;
import org.jetbrains.annotations.NotNull;

import java.lang.reflect.Type;

Expand All @@ -27,7 +26,7 @@ public class PositionGsonAdapter implements JsonSerializer<Point>, JsonDeseriali
private static final String PITCH = "pitch";

@Override
public Point deserialize(@NotNull JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
public Point deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
JsonObject object = json.getAsJsonObject();
double x = object.get("x").getAsDouble();
double y = object.get("y").getAsDouble();
Expand All @@ -43,7 +42,7 @@ public Point deserialize(@NotNull JsonElement json, Type typeOfT, JsonDeserializ
}

@Override
public JsonElement serialize(@NotNull Point src, Type typeOfSrc, JsonSerializationContext context) {
public JsonElement serialize(Point src, Type typeOfSrc, JsonSerializationContext context) {
JsonObject object = new JsonObject();
object.addProperty("x", src.x());
object.addProperty("y", src.y());
Expand Down
Loading