public void createEconomyFromYml(String econ, boolean restart) {
    if (hc.gYH().gFC("config").getBoolean("config.run-automatic-backups")) {
      new Backup();
    }
    FileConfiguration objects = hc.gYH().gFC("objects");
    SQLWrite sw = hc.getSQLWrite();
    Iterator<String> it = objects.getKeys(false).iterator();
    while (it.hasNext()) {
      String itemname = it.next().toString();
      String category = objects.getString(itemname + ".information.category");
      if (category == null) {
        category = "unknown";
      }

      HashMap<String, String> values = new HashMap<String, String>();
      values.put("NAME", itemname);
      values.put("ECONOMY", econ);
      values.put("DISPLAY_NAME", objects.getString(itemname + ".name.display"));
      values.put("ALIASES", objects.getString(itemname + ".name.aliases"));
      values.put("TYPE", objects.getString(itemname + ".information.type"));
      values.put("VALUE", objects.getDouble(itemname + ".value") + "");
      values.put("STATIC", objects.getString(itemname + ".price.static"));
      values.put("STATICPRICE", objects.getDouble(itemname + ".price.staticprice") + "");
      values.put("STOCK", objects.getDouble(itemname + ".stock.stock") + "");
      values.put("MEDIAN", objects.getDouble(itemname + ".stock.median") + "");
      values.put("INITIATION", objects.getString(itemname + ".initiation.initiation"));
      values.put("STARTPRICE", objects.getDouble(itemname + ".initiation.startprice") + "");
      values.put("CEILING", objects.getDouble(itemname + ".price.ceiling") + "");
      values.put("FLOOR", objects.getDouble(itemname + ".price.floor") + "");
      values.put("MAXSTOCK", objects.getDouble(itemname + ".stock.maxstock") + "");
      if (objects.getString(itemname + ".information.type").equalsIgnoreCase("item")) {
        values.put("MATERIAL", objects.getString(itemname + ".information.material"));
        values.put("DATA", objects.getInt(itemname + ".information.data") + "");
        values.put("DURABILITY", objects.getInt(itemname + ".information.data") + "");
      } else if (objects
          .getString(itemname + ".information.type")
          .equalsIgnoreCase("enchantment")) {
        values.put("MATERIAL", objects.getString(itemname + ".information.material"));
        values.put("DATA", "-1");
        values.put("DURABILITY", "-1");
      } else if (objects.getString(itemname + ".information.type").equalsIgnoreCase("experience")) {
        values.put("MATERIAL", "none");
        values.put("DATA", "-1");
        values.put("DURABILITY", "-1");
      }
      sw.performInsert("hyperconomy_objects", values);
    }
    if (restart) {
      hc.restart();
    }
  }
 public void createNewEconomy(String economy) {
   HyperEconomy defaultEconomy = getEconomy("default");
   SQLWrite sw = hc.getSQLWrite();
   for (HyperObject ho : defaultEconomy.getHyperObjects()) {
     HashMap<String, String> values = new HashMap<String, String>();
     values.put("NAME", ho.getName());
     values.put("DISPLAY_NAME", ho.getDisplayName());
     values.put("ALIASES", ho.getAliasesString());
     values.put("ECONOMY", economy);
     values.put("TYPE", ho.getType().toString());
     values.put("VALUE", ho.getValue() + "");
     values.put("STATIC", ho.getIsstatic());
     values.put("STATICPRICE", ho.getStaticprice() + "");
     values.put("STOCK", 0 + "");
     values.put("MEDIAN", ho.getMedian() + "");
     values.put("INITIATION", ho.getInitiation());
     values.put("STARTPRICE", ho.getStartprice() + "");
     values.put("CEILING", ho.getCeiling() + "");
     values.put("FLOOR", ho.getFloor() + "");
     values.put("MAXSTOCK", ho.getMaxstock() + "");
     if (ho instanceof HyperItem) {
       HyperItem hi = (HyperItem) ho;
       values.put("MATERIAL", hi.getMaterial());
       values.put("DATA", hi.getData() + "");
       values.put("DURABILITY", hi.getDurability() + "");
     } else if (ho instanceof HyperEnchant) {
       HyperEnchant he = (HyperEnchant) ho;
       values.put("MATERIAL", he.getEnchantmentName());
       values.put("DATA", "-1");
       values.put("DURABILITY", "-1");
     } else {
       values.put("MATERIAL", "none");
       values.put("DATA", "-1");
       values.put("DURABILITY", "-1");
     }
     sw.performInsert("hyperconomy_objects", values);
   }
   hc.restart();
 }
 public void createTables(SQLWrite sw) {
   sw.convertExecuteSynchronously(
       "CREATE TABLE IF NOT EXISTS hyperconomy_settings (SETTING VARCHAR(255) NOT NULL, VALUE TEXT, TIME DATETIME NOT NULL, PRIMARY KEY (SETTING))");
   sw.convertExecuteSynchronously("DELETE FROM hyperconomy_settings");
   sw.convertExecuteSynchronously(
       "INSERT INTO hyperconomy_settings (SETTING, VALUE, TIME) VALUES ('version', '"
           + hc.getEconomyManager().getVersion()
           + "', NOW() )");
   sw.convertExecuteSynchronously(
       "CREATE TABLE IF NOT EXISTS hyperconomy_objects (NAME VARCHAR(255) NOT NULL, ECONOMY VARCHAR(255) NOT NULL, DISPLAY_NAME VARCHAR(255), ALIASES VARCHAR(1000), TYPE TINYTEXT, MATERIAL TINYTEXT, DATA INTEGER, DURABILITY INTEGER, VALUE DOUBLE, STATIC TINYTEXT, STATICPRICE DOUBLE, STOCK DOUBLE, MEDIAN DOUBLE, INITIATION TINYTEXT, STARTPRICE DOUBLE, CEILING DOUBLE, FLOOR DOUBLE, MAXSTOCK DOUBLE NOT NULL DEFAULT '1000000', PRIMARY KEY (NAME, ECONOMY))");
   sw.convertExecuteSynchronously(
       "CREATE TABLE IF NOT EXISTS hyperconomy_players (PLAYER VARCHAR(255) NOT NULL PRIMARY KEY, ECONOMY TINYTEXT, BALANCE DOUBLE NOT NULL DEFAULT '0', X DOUBLE NOT NULL DEFAULT '0', Y DOUBLE NOT NULL DEFAULT '0', Z DOUBLE NOT NULL DEFAULT '0', WORLD TINYTEXT NOT NULL, HASH VARCHAR(255) NOT NULL DEFAULT '', SALT VARCHAR(255) NOT NULL DEFAULT '')");
   sw.convertExecuteSynchronously(
       "CREATE TABLE IF NOT EXISTS hyperconomy_log (ID INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, TIME DATETIME, CUSTOMER TINYTEXT, ACTION TINYTEXT, OBJECT TINYTEXT, AMOUNT DOUBLE, MONEY DOUBLE, TAX DOUBLE, STORE TINYTEXT, TYPE TINYTEXT)");
   sw.convertExecuteSynchronously(
       "CREATE TABLE IF NOT EXISTS hyperconomy_history (ID INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, OBJECT TINYTEXT, ECONOMY TINYTEXT, TIME DATETIME, PRICE DOUBLE)");
   sw.convertExecuteSynchronously(
       "CREATE TABLE IF NOT EXISTS hyperconomy_audit_log (ID INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, TIME DATETIME NOT NULL, ACCOUNT TINYTEXT NOT NULL, ACTION TINYTEXT NOT NULL, AMOUNT DOUBLE NOT NULL, ECONOMY TINYTEXT NOT NULL)");
   sw.convertExecuteSynchronously(
       "CREATE TABLE IF NOT EXISTS hyperconomy_shop_objects (ID INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, SHOP VARCHAR(255) NOT NULL, HYPEROBJECT VARCHAR(255) NOT NULL, QUANTITY DOUBLE NOT NULL, PRICE DOUBLE NOT NULL, STATUS VARCHAR(255) NOT NULL)");
   sw.convertExecuteSynchronously(
       "CREATE TABLE IF NOT EXISTS hyperconomy_frame_shops (ID INTEGER NOT NULL PRIMARY KEY, HYPEROBJECT VARCHAR(255) NOT NULL, ECONOMY TINYTEXT, SHOP VARCHAR(255), X DOUBLE NOT NULL DEFAULT '0', Y DOUBLE NOT NULL DEFAULT '0', Z DOUBLE NOT NULL DEFAULT '0', WORLD TINYTEXT NOT NULL)");
 }