- Joined
- May 29, 2008
- Messages
- 241
- Reaction score
- 0
ok i dont take credits for this. i took the base code from somewhere else whoever is that credits go to him.
EDIT: CREDITS TO gorgon0 for base code
ok so go to commandprocessor.java and find:
and add this before the 'else' :
You can change the @reborns to anything you like for the command.
then find this:
add t his below:
then compile and you're done. works 100%. it shows the top 10 reborn ranks.
EDIT: CREDITS TO gorgon0 for base code
ok so go to commandprocessor.java and find:
Code:
else {
mc.dropMessage("GM Command " + splitted[0] + " does not exist");
}
and add this before the 'else' :
Code:
else if (splitted[0].equals("@reborns")) {
ResultSet rs = reborns();
try { mc.dropMessage("Reborn Ranking Top 10:");
while(rs.next()){
mc.dropMessage("Player : " + rs.getString("name") + " | Reborns :" + rs.getInt("reborns"));
}
} catch(Exception ex) {}
}
then find this:
Code:
private static String getCharInfoById(int id){
try {
Connection dcon = DatabaseConnection.getConnection();
PreparedStatement ps = dcon.prepareStatement("SELECT * FROM characters where id = ?");
ps.setInt(1, id);
ResultSet rs = ps.executeQuery();
if(rs.next())
return rs.getString("name");
} catch(Exception ex) {}
return "error while trying to get name";
}
add t his below:
Code:
public static ResultSet reborns() {
try {
Connection con = DatabaseConnection.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT name,reborns FROM characters WHERE gm = 0 ORDER BY reborns desc LIMIT 10");
return ps.executeQuery();
} catch (Exception ex) {}
return null;
}
then compile and you're done. works 100%. it shows the top 10 reborn ranks.
Last edited: