public static void reloadTraps() { TrapTable.reload(); L1WorldTraps oldInstance = _instance; _instance = new L1WorldTraps(); oldInstance.resetTimer(); removeTraps(oldInstance._allTraps); removeTraps(oldInstance._allBases); }
private void initialize() { Connection con = null; PreparedStatement pstm = null; ResultSet rs = null; try { con = L1DatabaseFactory.getInstance().getConnection(); pstm = con.prepareStatement("SELECT * FROM spawnlist_trap"); rs = pstm.executeQuery(); while (rs.next()) { int trapId = rs.getInt("trapId"); L1Trap trapTemp = TrapTable.getInstance().getTemplate(trapId); L1Location loc = new L1Location(); loc.setMap(rs.getInt("mapId")); loc.setX(rs.getInt("locX")); loc.setY(rs.getInt("locY")); Point rndPt = new Point(); rndPt.setX(rs.getInt("locRndX")); rndPt.setY(rs.getInt("locRndY")); int count = rs.getInt("count"); int span = rs.getInt("span"); for (int i = 0; i < count; i++) { L1TrapInstance trap = new L1TrapInstance(IdFactory.getInstance().nextId(), trapTemp, loc, rndPt, span); L1World.getInstance().addVisibleObject(trap); _allTraps.add(trap); } L1TrapInstance base = new L1TrapInstance(IdFactory.getInstance().nextId(), loc); L1World.getInstance().addVisibleObject(base); _allBases.add(base); } } catch (SQLException e) { _log.log(Level.SEVERE, e.getLocalizedMessage(), e); } finally { SQLUtil.close(rs); SQLUtil.close(pstm); SQLUtil.close(con); } }