mirror of
https://github.com/ViaVersion/ViaBackwards.git
synced 2024-12-18 16:17:45 +01:00
Update Via API usage (#702)
This commit is contained in:
parent
59a621315b
commit
082cc010b2
@ -24,6 +24,7 @@ import com.viaversion.viaversion.libs.opennbt.tag.builtin.Tag;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.logging.Logger;
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
|
|
||||||
public class BackwardsMappingDataLoader extends MappingDataLoader {
|
public class BackwardsMappingDataLoader extends MappingDataLoader {
|
||||||
@ -34,11 +35,6 @@ public class BackwardsMappingDataLoader extends MappingDataLoader {
|
|||||||
super(dataLoaderClass, dataPath);
|
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.
|
* 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.
|
* 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) {
|
public @Nullable CompoundTag loadNBTFromDir(final String name) {
|
||||||
final CompoundTag packedData = loadNBT(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()) {
|
if (!file.exists()) {
|
||||||
return packedData;
|
return packedData;
|
||||||
}
|
}
|
||||||
|
|
||||||
ViaBackwards.getPlatform().getLogger().info("Loading " + name + " from plugin folder");
|
getLogger().info("Loading " + name + " from plugin folder");
|
||||||
try {
|
try {
|
||||||
final CompoundTag fileData = MAPPINGS_READER.read(file.toPath(), false);
|
final CompoundTag fileData = MAPPINGS_READER.read(file.toPath(), false);
|
||||||
return mergeTags(packedData, fileData);
|
return mergeTags(packedData, fileData);
|
||||||
@ -78,4 +74,14 @@ public class BackwardsMappingDataLoader extends MappingDataLoader {
|
|||||||
}
|
}
|
||||||
return original;
|
return original;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Logger getLogger() {
|
||||||
|
return ViaBackwards.getPlatform().getLogger();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public File getDataFolder() {
|
||||||
|
return ViaBackwards.getPlatform().getDataFolder();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user