3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-11-17 13:30:14 +01:00

Update Via API usage (#702)

Dieser Commit ist enthalten in:
EnZaXD 2024-03-24 22:10:06 +01:00 committet von GitHub
Ursprung 59a621315b
Commit 082cc010b2
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: B5690EEEBB952194

Datei anzeigen

@ -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();
}
}