public static void Stop() { m_perksDB.freeDatabase(); }
private static void UpgradeDatabases() { File buildFile = FindDatabase("Build.sqlite"); if (buildFile != null) { BukkitDatabase tempDb = bDatabaseManager.createDatabase("Build", PerkUtils.plugin, DatabaseType.SQLite); // select every property from the table String query = "SELECT * FROM build"; ResultSet result = tempDb.queryResult(query); try { // while we have another result, read in the data while (result.next()) { String worldName = result.getString("world"); String playerName = result.getString("player"); int x = result.getInt("x"); int y = result.getInt("y"); int z = result.getInt("z"); int pitch = result.getInt("pitch"); int yaw = result.getInt("yaw"); World world = PerkUtils.plugin.getServer().getWorld(worldName); if (world == null) continue; Location loc = new Location(world, x, y, z, yaw, pitch); tpLocation newHome = new tpLocation(); newHome.playername = playerName; newHome.loc = loc; builds.add(newHome); AddBuild(playerName, loc); } } catch (SQLException e) { e.printStackTrace(); return; } tempDb.freeResult(result); tempDb.freeDatabase(); buildFile.renameTo( new File( PerkUtils.plugin.getDataFolder().getAbsolutePath() + "\\Build.sqlite.upgradded")); } File homeFile = FindDatabase("Homes.sqlite"); if (homeFile != null) { BukkitDatabase tempDb = bDatabaseManager.createDatabase("Homes", PerkUtils.plugin, DatabaseType.SQLite); // select every property from the table String query = "SELECT * FROM homes"; ResultSet result = tempDb.queryResult(query); try { // while we have another result, read in the data while (result.next()) { String worldName = result.getString("world"); String playerName = result.getString("player"); int x = result.getInt("x"); int y = result.getInt("y"); int z = result.getInt("z"); int pitch = result.getInt("pitch"); int yaw = result.getInt("yaw"); World world = PerkUtils.plugin.getServer().getWorld(worldName); if (world == null) continue; Location loc = new Location(world, x, y, z, yaw, pitch); tpLocation newHome = new tpLocation(); newHome.playername = playerName; newHome.loc = loc; homes.add(newHome); AddHome(playerName, loc); } } catch (SQLException e) { e.printStackTrace(); return; } tempDb.freeResult(result); tempDb.freeDatabase(); homeFile.renameTo( new File( PerkUtils.plugin.getDataFolder().getAbsolutePath() + "\\Homes.sqlite.upgradded")); } }