Let's try to load the data from flatfile, or rather start.

This commit is contained in:
graywolf336 2013-12-06 16:05:11 -06:00
parent e07c657a40
commit 4adffd7b4a
2 changed files with 137 additions and 114 deletions

View File

@ -1,7 +1,13 @@
package com.graywolf336.jail;
import java.io.File;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
public class JailIO {
private JailMain pl;
private FileConfiguration flat;
private int storage; //0 = flatfile, 1 = sqlite, 2 = mysql
public JailIO(JailMain plugin) {
@ -17,7 +23,7 @@ public class JailIO {
}
}
public void PrepareStorage() {
public void prepareStorage() {
switch(storage) {
case 1:
//prepare sqlite, I need to research this
@ -26,7 +32,23 @@ public class JailIO {
//prepare mysql, research this as well
break;
default:
//File system, prepare it somehow.. Maybe load in the files
flat = YamlConfiguration.loadConfiguration(new File(pl.getDataFolder(), "data.yml"));
break;
}
}
public void loadJails() {
switch(storage) {
case 1:
//load the jails from sqlite
break;
case 2:
//load the jails from mysql
break;
default:
//load the jails from flatfile
if(flat.contains("jails"))
pl.getLogger().info("Jails exists");
break;
}
}

View File

@ -20,7 +20,8 @@ public class JailMain extends JavaPlugin {
loadConfig();
io = new JailIO(this);
io.PrepareStorage();
io.prepareStorage();
io.loadJails();
jm = new JailManager(this);
cmdHand = new CommandHandler(this);