diff --git a/VelocityCore/Dependencies/src/de/steamwar/velocitycore/advancements/Items.java b/VelocityCore/Dependencies/src/de/steamwar/velocitycore/advancements/Items.java new file mode 100644 index 00000000..c231196c --- /dev/null +++ b/VelocityCore/Dependencies/src/de/steamwar/velocitycore/advancements/Items.java @@ -0,0 +1,31 @@ +/* + * This file is a part of the SteamWar software. + * + * Copyright (C) 2026 SteamWar.de-Serverteam + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +package de.steamwar.velocitycore.advancements; + +import com.google.gson.Gson; +import com.google.gson.JsonObject; + +import java.io.BufferedReader; +import java.io.InputStreamReader; + +public class Items { + + static final JsonObject values = new Gson().fromJson(new BufferedReader(new InputStreamReader(Items.class.getResourceAsStream("/de/steamwar/velocitycore/advancements/item.json"))), JsonObject.class); +} diff --git a/VelocityCore/src/de/steamwar/velocitycore/advancements/item.json b/VelocityCore/Dependencies/src/de/steamwar/velocitycore/advancements/item.json similarity index 100% rename from VelocityCore/src/de/steamwar/velocitycore/advancements/item.json rename to VelocityCore/Dependencies/src/de/steamwar/velocitycore/advancements/item.json diff --git a/VelocityCore/src/de/steamwar/velocitycore/advancements/Advancement.java b/VelocityCore/src/de/steamwar/velocitycore/advancements/Advancement.java index dfbb75b4..cfa17ee6 100644 --- a/VelocityCore/src/de/steamwar/velocitycore/advancements/Advancement.java +++ b/VelocityCore/src/de/steamwar/velocitycore/advancements/Advancement.java @@ -19,8 +19,6 @@ package de.steamwar.velocitycore.advancements; -import com.google.gson.Gson; -import com.google.gson.JsonObject; import com.velocitypowered.api.network.ProtocolVersion; import com.velocitypowered.api.proxy.Player; import com.velocitypowered.proxy.connection.MinecraftSessionHandler; @@ -29,7 +27,6 @@ import com.velocitypowered.proxy.protocol.MinecraftPacket; import com.velocitypowered.proxy.protocol.ProtocolUtils; import com.velocitypowered.proxy.protocol.packet.chat.ComponentHolder; import de.steamwar.messages.Chatter; -import de.steamwar.sql.EventFight; import de.steamwar.sql.SteamwarUser; import io.netty.buffer.ByteBuf; import lombok.AllArgsConstructor; @@ -38,8 +35,6 @@ import lombok.RequiredArgsConstructor; import lombok.ToString; import net.kyori.adventure.text.Component; -import java.io.BufferedReader; -import java.io.InputStreamReader; import java.util.*; import java.util.function.BiFunction; import java.util.function.Function; @@ -239,8 +234,6 @@ public class Advancement { } } - private static final JsonObject ITEMS = new Gson().fromJson(new BufferedReader(new InputStreamReader(Advancement.class.getResourceAsStream("/de/steamwar/velocitycore/advancements/item.json"))), JsonObject.class); - private void encodeAdvancement(ByteBuf byteBuf, ProtocolVersion protocolVersion, boolean showToast) { ProtocolUtils.writeString(byteBuf, advancement.identifier); if (advancement.parent.isPresent()) { @@ -256,7 +249,8 @@ public class Advancement { new ComponentHolder(protocolVersion, advancement.display.description).write(byteBuf); { // Slot ProtocolUtils.writeVarInt(byteBuf, 1); - int itemId = ITEMS.get(protocolVersion.name().replace("MINECRAFT_", "V_")) + int itemId = Items.values + .get(protocolVersion.name().replace("MINECRAFT_", "V_")) .getAsJsonObject() .get(advancement.display.item) .getAsInt();