[RELEASE] !unban [Odin] *Updated
This is with the old command system, ask someone else to convert it to the new one.
1. net/sf/odinms/client/MapleCharacter.java
Code:
public static boolean unban(String id, boolean accountId) {
boolean ret = false;
try {
PreparedStatement ps;
Connection con = DatabaseConnection.getConnection();
if (accountId) {
ps = con.prepareStatement("SELECT id FROM accounts WHERE name = ?");
} else {
ps = con.prepareStatement("SELECT accountid FROM characters WHERE name = ?");
}
ps.setString(1, id);
ResultSet rs = ps.executeQuery();
if (rs.next()) {
PreparedStatement psb = con.prepareStatement("UPDATE accounts SET banned = -1, banreason = null WHERE id = ?");
psb.setInt(1, rs.getInt(1));
psb.executeUpdate();
psb.close();
ret = true;
}
rs.close();
ps.close();
} catch (SQLException ex) {
log.error("Error while unbanning", ex);
}
return ret;
}
2. net/sf/odinms/client/messages/CommandProcessor.java
Code:
} else if (splitted[0].equals("!unban")) {
if (MapleCharacter.unban(splitted[1], false)) {
mc.dropMessage("Unbanned " + splitted[1]);
} else {
mc.dropMessage("Failed to unban " + splitted[1]);
}
}
3. Save and compile.
4. ???
5. PROFIT!!111shift+one11
Credits:
Serpendiem, Matze, Vimes(?) for creating OdinMS
Trait0r for telling me what -1 in banned does
Um.. I dunno.
Re: [RELEASE] !unban [Odin]
nice xD so all you do is !unban (char ign) right?
Re: [RELEASE] !unban [Odin]
Yesss!!!!! Very excellent. :)
Re: [RELEASE] !unban [Odin]
Re: [RELEASE] !unban [Odin]
Damn man i need this Command thanks alot
Re: [RELEASE] !unban [Odin]
Wait, does this uban the ip and mac's?
Always going in the db to unban macs is annoying..
Re: [RELEASE] !unban [Odin]
You should replace:
With this:
It makes sure that all the macs and IPs are unbanned too.
I just made an unban command right before you posted this thread too.
EDIT:
Seems more complicated now then just setting banned = -1
Re: [RELEASE] !unban [Odin]
Im stuck on step 5:
5. PROFIT!
xP. Lulz. Nice release
Re: [RELEASE] !unban [Odin]
Updated so that it unbans macs (repeat step 1, do step 2)
@Trait0r: It already does that anyway.
@zander145: Before it unbanned IP, now it does both.
Re: [RELEASE] !unban [Odin]
Very nice job! Keep up the good work.
Re: [RELEASE] !unban [Odin]
WOW??? this is great ... much props great job...
Re: [RELEASE] !unban [Odin]
Why dont you just set Banned to -1 and BanReason Null...
I hope you guys know that setting banned to -1 deletes the IP and Mac..
Re: [RELEASE] !unban [Odin]
Try crtl+Shit+I
(I hope you all know that it's much easier to copy and paste with netbeans... Might acualy learn 0-0)
Re: [RELEASE] !unban [Odin]
Anyone tested if this really works... this thread will get alot of good feedback...
Re: [RELEASE] !unban [Odin]
It should work.
It was made by zero so i trust it to work 1st try ;D
and try it urself be4 asking?
Or read post's like i do for somethings