Junior Spellweaver
- Joined
- Sep 23, 2012
- Messages
- 129
- Reaction score
- 17
a small memory leak was found and here is a much better loading of the chars
found in MapleClient.Java
should works on any source if you know what to do and it uses the Diamond Operator in Java 7
found in MapleClient.Java
should works on any source if you know what to do and it uses the Diamond Operator in Java 7
Code:
private List<CharNameAndId> loadCharactersInternal(int serverId) {
List<CharNameAndId> chars = new LinkedList<>();
try {
try (PreparedStatement ps = DatabaseConnection.getConnection().prepareStatement("SELECT id, name FROM characters WHERE accountid = ? AND world = ?")) {
ps.setInt(1, this.accId);
ps.setInt(2, serverId);
try (ResultSet rs = ps.executeQuery()) {
while (rs.next()) {
chars.add(new CharNameAndId(rs.getString("name"), rs.getInt("id")));
}
rs.close();
ps.close();
}
}
} catch (SQLException Ex) {
System.out.println("loadCharactersInternal Error " + Ex.getMessage());
}
return chars;
}
Last edited: