f70cc119df
Placeholderapi is no longer a requirement. /f showclaims lag fixed Scoreboard is now off by default, can be turned on in config. Issue with Flight AutoEnabling when disabled has been fixed. 1.7 itemflag bug fixed
47 lines
1.1 KiB
Java
47 lines
1.1 KiB
Java
package com.massivecraft.factions.zcore.nbtapi;
|
|
|
|
import java.io.File;
|
|
import java.io.FileInputStream;
|
|
import java.io.FileOutputStream;
|
|
import java.io.IOException;
|
|
|
|
public class NBTFile extends NBTCompound {
|
|
|
|
private final File file;
|
|
private Object nbt;
|
|
|
|
public NBTFile(File file) throws IOException {
|
|
super(null, null);
|
|
this.file = file;
|
|
if (file.exists()) {
|
|
FileInputStream inputsteam = new FileInputStream(file);
|
|
nbt = NBTReflectionUtil.readNBTFile(inputsteam);
|
|
} else {
|
|
nbt = NBTReflectionUtil.getNewNBTTag();
|
|
save();
|
|
}
|
|
}
|
|
|
|
public void save() throws IOException {
|
|
if (!file.exists()) {
|
|
file.getParentFile().mkdirs();
|
|
file.createNewFile();
|
|
}
|
|
FileOutputStream outStream = new FileOutputStream(file);
|
|
NBTReflectionUtil.saveNBTFile(nbt, outStream);
|
|
}
|
|
|
|
public File getFile() {
|
|
return file;
|
|
}
|
|
|
|
protected Object getCompound() {
|
|
return nbt;
|
|
}
|
|
|
|
protected void setCompound(Object compound) {
|
|
nbt = compound;
|
|
}
|
|
|
|
}
|