From 082cc010b2cc109eaf6bd05f8e64acae94b7f8d7 Mon Sep 17 00:00:00 2001 From: EnZaXD <60033407+FlorianMichael@users.noreply.github.com> Date: Sun, 24 Mar 2024 22:10:06 +0100 Subject: [PATCH] Update Via API usage (#702) --- .../api/data/BackwardsMappingDataLoader.java | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/common/src/main/java/com/viaversion/viabackwards/api/data/BackwardsMappingDataLoader.java b/common/src/main/java/com/viaversion/viabackwards/api/data/BackwardsMappingDataLoader.java index 0f6924f6..1f086c47 100644 --- a/common/src/main/java/com/viaversion/viabackwards/api/data/BackwardsMappingDataLoader.java +++ b/common/src/main/java/com/viaversion/viabackwards/api/data/BackwardsMappingDataLoader.java @@ -24,6 +24,7 @@ import com.viaversion.viaversion.libs.opennbt.tag.builtin.Tag; import java.io.File; import java.io.IOException; import java.util.Map; +import java.util.logging.Logger; import org.checkerframework.checker.nullness.qual.Nullable; public class BackwardsMappingDataLoader extends MappingDataLoader { @@ -34,11 +35,6 @@ public class BackwardsMappingDataLoader extends MappingDataLoader { super(dataLoaderClass, dataPath); } - @Override - public File getFile(final String name) { - return new File(ViaBackwards.getPlatform().getDataFolder(), name); - } - /** * Returns nbt data from the plugin folder or packed assets. * If a file with the same name exists in the plugin folder, the data of the original packed tag will be merged with the file's tag. @@ -49,12 +45,12 @@ public class BackwardsMappingDataLoader extends MappingDataLoader { public @Nullable CompoundTag loadNBTFromDir(final String name) { final CompoundTag packedData = loadNBT(name); - final File file = new File(ViaBackwards.getPlatform().getDataFolder(), name); + final File file = new File(getDataFolder(), name); if (!file.exists()) { return packedData; } - ViaBackwards.getPlatform().getLogger().info("Loading " + name + " from plugin folder"); + getLogger().info("Loading " + name + " from plugin folder"); try { final CompoundTag fileData = MAPPINGS_READER.read(file.toPath(), false); return mergeTags(packedData, fileData); @@ -78,4 +74,14 @@ public class BackwardsMappingDataLoader extends MappingDataLoader { } return original; } + + @Override + public Logger getLogger() { + return ViaBackwards.getPlatform().getLogger(); + } + + @Override + public File getDataFolder() { + return ViaBackwards.getPlatform().getDataFolder(); + } }