<< Masterio >> Posted November 27, 2013 Author Posted November 27, 2013 3.8.5 relesed. Fxed many bugs. I recommend reinstall all previous version for this one ;) It is beta but i've hope I not created new bugs ;)
L2nuLL Posted November 27, 2013 Posted November 27, 2013 Just a suggestion, use try with resources for database interactions: private void load() { try (Connection con = L2DatabaseFactory.getInstance().getConnection(); Statement statement = con.createStatement(); ResultSet rset = statement.executeQuery("SELECT * FROM rank_pvp_system")) { With this, you don't need to close the resources after the usage, like con.close();
SweeTs Posted November 27, 2013 Posted November 27, 2013 (edited) Just a suggestion, use try with resources for database interactions: try (Connection con = L2DatabaseFactory.getInstance().getConnection()) With this, you don't need to close the resources after the usage, like con.close(); Thanks to java 7 :D Edited November 27, 2013 by SweeTs
vampir Posted November 27, 2013 Posted November 27, 2013 BTW any awesome solution for neasted try statements for example in here? try(Connection con = L2DatabaseFactory.getInstance().getConnection()) { try(PreparedStatement statement = con.prepareStatement(QUERY_ONE)) { try(ResultSet rset = statement.executeQuery()) { something(rset); } } try(PreparedStatement statement = con.prepareStatement(QUERY_TWO)) { statement.executeUpdate(); } } catch(SQLException e) { _log.error(e); }
<< Masterio >> Posted November 28, 2013 Author Posted November 28, 2013 (edited) Maybe something like this: try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { statement = con.createStatement(); statement.addBatch(insert1); statement.addBatch(insert2); statement.addBatch(update1); statement.addBatch(update2); statement.addBatch(update3); statement.addBatch(delete1); statement.addBatch(delete2); statement.batchExecute(); statement = con.prepareStatement(select1); ResultSet rset = statement.executeQuery(); something(rset); } catch (SQLException e) { _log.error(e); } Edited November 28, 2013 by << Masterio >>
vampir Posted November 28, 2013 Posted November 28, 2013 Maybe something like this: try (Connection con = L2DatabaseFactory.getInstance().getConnection()) { statement = con.createStatement(); statement.addBatch(insert1); statement.addBatch(insert2); statement.addBatch(update1); statement.addBatch(update2); statement.addBatch(update3); statement.addBatch(delete1); statement.addBatch(delete2); statement.batchExecute(); statement = con.prepareStatement(select1); ResultSet rset = statement.executeQuery(); something(rset); } catch (SQLException e) { _log.error(e); } If you will get exception, memory will leak because of unclosed Statement and ResultSet. Only object that is safe is con
xdem Posted November 28, 2013 Posted November 28, 2013 statement and resultset declaration should be into the try with resources
<< Masterio >> Posted November 28, 2013 Author Posted November 28, 2013 (edited) I prefer old methods :D Because it must works on java 1.6 too ;) Edited November 29, 2013 by << Masterio >>
Amida Nguyen Posted December 4, 2013 Posted December 4, 2013 I urgent need auto add skill to rank like Rank PvP System Rank Reward. When gamer get new rank he can receive new skill
Amida Nguyen Posted December 7, 2013 Posted December 7, 2013 (edited) I got this error: Exception in thread "Thread-233" Exception in thread "Thread-232" java.lang.NullPointerException at com.l2jserver.gameserver.masteriopack.rankpvpsystem.KillerPvpStats.updateDailyStats(KillerPvpStats.java:274) at com.l2jserver.gameserver.masteriopack.rankpvpsystem.PvpTable.getKillerPvpStats(PvpTable.java:229) at com.l2jserver.gameserver.masteriopack.rankpvpsystem.RankPvpSystem.doPvp(RankPvpSystem.java:64) at com.l2jserver.gameserver.masteriopack.rankpvpsystem.RankPvpSystemPc$RankPvpSystemPvpTask.run(RankPvpSystemPc.java:43) at java.lang.Thread.run(Unknown Source) and sent bad RequestBypassToServer: "RPS.RPC:1"java.lang.NullPointerException at com.l2jserver.gameserver.masteriopack.rankpvpsystem.RPCTable.getRpcByPlayerId(RPCTable.java:91) at com.l2jserver.gameserver.masteriopack.rankpvpsystem.RankPvpSystemRPC.playerResponseHtm(RankPvpSystemRPC.java:25) at com.l2jserver.gameserver.masteriopack.rankpvpsystem.RankPvpSystemRPC.sendPlayerResponse(RankPvpSystemRPC.java:17) at com.l2jserver.gameserver.masteriopack.rankpvpsystem.RankPvpSystemBypass.executeCommand(RankPvpSystemBypass.java:75) at com.l2jserver.gameserver.network.clientpackets.RequestBypassToServer.runImpl(RequestBypassToServer.java:287) at com.l2jserver.gameserver.network.clientpackets.L2GameClientPacket.run(L2GameClientPacket.java:62) at com.l2jserver.gameserver.network.L2GameClient.run(L2GameClient.java:1101) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Edited December 7, 2013 by Amida Nguyen
<< Masterio >> Posted December 7, 2013 Author Posted December 7, 2013 Amida Nguyen You should include RPS version and chronicle what u are using.
Amida Nguyen Posted December 8, 2013 Posted December 8, 2013 (edited) Amida Nguyen You should include RPS version and chronicle what u are using. I use RPS 8.5 and Freya, now I have problem is RPS point always reset to 0 after restart server Edited December 8, 2013 by Amida Nguyen
radu33 Posted December 12, 2013 Posted December 12, 2013 Hey why connot see the image rank ? I can see rank black...Why?
Recommended Posts