From a191000142e1327883ee2b557627587955f60b24 Mon Sep 17 00:00:00 2001 From: Pierre Maurice Schwang Date: Thu, 23 Oct 2025 20:32:09 +0200 Subject: [PATCH] chore: drop unneeded type adapter --- .../bukkit/schematic/NbtGsonSerializer.java | 80 ------------------- 1 file changed, 80 deletions(-) delete mode 100644 Bukkit/src/main/java/com/plotsquared/bukkit/schematic/NbtGsonSerializer.java diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/schematic/NbtGsonSerializer.java b/Bukkit/src/main/java/com/plotsquared/bukkit/schematic/NbtGsonSerializer.java deleted file mode 100644 index 8e29f3e6a..000000000 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/schematic/NbtGsonSerializer.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * PlotSquared, a land and world management plugin for Minecraft. - * Copyright (C) IntellectualSites - * Copyright (C) IntellectualSites team and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.plotsquared.bukkit.schematic; - -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonPrimitive; -import com.google.gson.JsonSerializationContext; -import com.google.gson.JsonSerializer; -import com.sk89q.jnbt.ByteArrayTag; -import com.sk89q.jnbt.CompoundTag; -import com.sk89q.jnbt.IntArrayTag; -import com.sk89q.jnbt.ListTag; -import com.sk89q.jnbt.LongArrayTag; -import com.sk89q.jnbt.Tag; - -import java.lang.reflect.Type; - -final class NbtGsonSerializer implements JsonSerializer { - - @Override - public JsonElement serialize(final Tag src, final Type typeOfSrc, final JsonSerializationContext context) { - if (src instanceof CompoundTag compoundTag) { - JsonObject object = new JsonObject(); - compoundTag.getValue().forEach((s, tag) -> object.add(s, context.serialize(tag))); - return object; - } - if (src instanceof ListTag listTag) { - JsonArray array = new JsonArray(); - listTag.getValue().forEach(tag -> array.add(context.serialize(tag))); - return array; - } - if (src instanceof ByteArrayTag byteArrayTag) { - JsonArray array = new JsonArray(); - for (final byte b : byteArrayTag.getValue()) { - array.add(b); - } - return array; - } - if (src instanceof IntArrayTag intArrayTag) { - JsonArray array = new JsonArray(); - for (final int i : intArrayTag.getValue()) { - array.add(i); - } - return array; - } - if (src instanceof LongArrayTag longArrayTag) { - JsonArray array = new JsonArray(); - for (final long l : longArrayTag.getValue()) { - array.add(l); - } - return array; - } - if (src.getValue() instanceof Number number) { - return new JsonPrimitive(number); - } - if (src.getValue() instanceof String string) { - return new JsonPrimitive(string); - } - throw new IllegalArgumentException("Don't know how to serialize " + src); - } - -}