Let's start some work on saving the flatfile.
This commit is contained in:
parent
4adffd7b4a
commit
af9d1a1f5b
@ -1,10 +1,13 @@
|
||||
package com.graywolf336.jail;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
|
||||
import com.graywolf336.jail.beans.Jail;
|
||||
|
||||
public class JailIO {
|
||||
private JailMain pl;
|
||||
private FileConfiguration flat;
|
||||
@ -52,4 +55,31 @@ public class JailIO {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void saveJail(Jail j) {
|
||||
switch(storage) {
|
||||
case 1:
|
||||
case 2:
|
||||
break;
|
||||
default:
|
||||
if(flat != null) {
|
||||
String node = "jails." + j.getName();
|
||||
flat.set(node + "top.x", j.getMaxPoint().getBlockX());
|
||||
flat.set(node + "top.y", j.getMaxPoint().getBlockY());
|
||||
flat.set(node + "top.z", j.getMaxPoint().getBlockZ());
|
||||
flat.set(node + "bottom.x", j.getMinPoint().getBlockX());
|
||||
flat.set(node + "bottom.y", j.getMinPoint().getBlockY());
|
||||
flat.set(node + "bottom.z", j.getMinPoint().getBlockZ());
|
||||
|
||||
try {
|
||||
flat.save(new File(pl.getDataFolder(), "data.yml"));
|
||||
} catch (IOException e) {
|
||||
pl.getLogger().severe("Unable to save the Jail data: " + e.getMessage());
|
||||
}
|
||||
}else {
|
||||
pl.getLogger().severe("Storage not enabled, could not save the jail " + j.getName());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user