-
[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
-
Re: [RELEASE] !unban [Odin]
-
Re: [RELEASE] !unban [Odin]
This works fine.
For your alternate method it still uses getClient().unbanMacs()
-
Re: [RELEASE] !unban [Odin]
Quote:
Originally Posted by
Trait0r
This works fine.
For your alternate method it still uses getClient().unbanMacs()
Oh, right, thanks, fixed.
-
Re: [RELEASE] !unban [Odin]
Hmm Look at the MapleCharacter and such it deletes all MACs and IP Bans from list but it only sets <Charnames>'s 'Banned' Field to 0
-
Re: [RELEASE] !unban [Odin]
Quote:
Originally Posted by
GMLooney
Hmm Look at the MapleCharacter and such it deletes all MACs and IP Bans from list but it only sets <Charnames>'s 'Banned' Field to 0
Thats why the alternate method is there..
-
Re: [RELEASE] !unban [Odin]
this will delete de ip banned and mac banned right?
-
Re: [RELEASE] !unban [Odin]
Quote:
Originally Posted by
metroix
this will delete de ip banned and mac banned right?
Yes, it will. Both methods.
-
Re: [RELEASE] !unban [Odin]
Yea I get the same erros as the other guy =P
PHP Code:
C:\Documents and Settings\Zack\Desktop\PCMaple v1.7\src\net\sf\odinms\provider\xmlwz\FileStoredPngMapleCanvas.java:14: warning: com.sun.imageio.plugins.png.PNGImageReaderSpi is Sun proprietary API and may be removed in a future release
import com.sun.imageio.plugins.png.PNGImageReaderSpi;
C:\Documents and Settings\Zack\Desktop\PCMaple v1.7\src\net\sf\odinms\client\MapleCharacter.java:2705: cannot find symbol
symbol : variable ps
location: class net.sf.odinms.client.MapleCharacter
ps = con.prepareStatement("SELECT id FROM accounts WHERE name = ?");
^
C:\Documents and Settings\Zack\Desktop\PCMaple v1.7\src\net\sf\odinms\client\MapleCharacter.java:2707: cannot find symbol
symbol : variable ps
location: class net.sf.odinms.client.MapleCharacter
ps = con.prepareStatement("SELECT accountid FROM characters WHERE name = ?");
^
C:\Documents and Settings\Zack\Desktop\PCMaple v1.7\src\net\sf\odinms\client\MapleCharacter.java:2710: cannot find symbol
symbol : variable ps
location: class net.sf.odinms.client.MapleCharacter
ps.setString(1, id);
^
C:\Documents and Settings\Zack\Desktop\PCMaple v1.7\src\net\sf\odinms\client\MapleCharacter.java:2711: cannot find symbol
symbol : variable ps
location: class net.sf.odinms.client.MapleCharacter
ResultSet rs = ps.executeQuery();
^
C:\Documents and Settings\Zack\Desktop\PCMaple v1.7\src\net\sf\odinms\client\MapleCharacter.java:2720: cannot find symbol
symbol : variable ps
location: class net.sf.odinms.client.MapleCharacter
ps.close();
^
C:\Documents and Settings\Zack\Desktop\PCMaple v1.7\src\net\sf\odinms\provider\xmlwz\FileStoredPngMapleCanvas.java:47: warning: com.sun.imageio.plugins.png.PNGImageReaderSpi is Sun proprietary API and may be removed in a future release
ImageReaderSpi readerSpi = iioRegistry.getServiceProviderByClass(PNGImageReaderSpi.class);
^
5 errors
2 warnings
BUILD FAILED (total time: 0 seconds)
-
Re: [RELEASE] !unban [Odin]
Quote:
Originally Posted by
PinCrackerGod
Yea I get the same erros as the other guy =P
PHP Code:
C:\Documents and Settings\Zack\Desktop\PCMaple v1.7\src\net\sf\odinms\provider\xmlwz\FileStoredPngMapleCanvas.java:14: warning: com.sun.imageio.plugins.png.PNGImageReaderSpi is Sun proprietary API and may be removed in a future release
import com.sun.imageio.plugins.png.PNGImageReaderSpi;
C:\Documents and Settings\Zack\Desktop\PCMaple v1.7\src\net\sf\odinms\client\MapleCharacter.java:2705: cannot find symbol
symbol : variable ps
location: class net.sf.odinms.client.MapleCharacter
ps = con.prepareStatement("SELECT id FROM accounts WHERE name = ?");
^
C:\Documents and Settings\Zack\Desktop\PCMaple v1.7\src\net\sf\odinms\client\MapleCharacter.java:2707: cannot find symbol
symbol : variable ps
location: class net.sf.odinms.client.MapleCharacter
ps = con.prepareStatement("SELECT accountid FROM characters WHERE name = ?");
^
C:\Documents and Settings\Zack\Desktop\PCMaple v1.7\src\net\sf\odinms\client\MapleCharacter.java:2710: cannot find symbol
symbol : variable ps
location: class net.sf.odinms.client.MapleCharacter
ps.setString(1, id);
^
C:\Documents and Settings\Zack\Desktop\PCMaple v1.7\src\net\sf\odinms\client\MapleCharacter.java:2711: cannot find symbol
symbol : variable ps
location: class net.sf.odinms.client.MapleCharacter
ResultSet rs = ps.executeQuery();
^
C:\Documents and Settings\Zack\Desktop\PCMaple v1.7\src\net\sf\odinms\client\MapleCharacter.java:2720: cannot find symbol
symbol : variable ps
location: class net.sf.odinms.client.MapleCharacter
ps.close();
^
C:\Documents and Settings\Zack\Desktop\PCMaple v1.7\src\net\sf\odinms\provider\xmlwz\FileStoredPngMapleCanvas.java:47: warning: com.sun.imageio.plugins.png.PNGImageReaderSpi is Sun proprietary API and may be removed in a future release
ImageReaderSpi readerSpi = iioRegistry.getServiceProviderByClass(PNGImageReaderSpi.class);
^
5 errors
2 warnings
BUILD FAILED (total time: 0 seconds)
Fixed, whee.
-
Re: [RELEASE] !unban [Odin]
Edit* NICE! You fixed it ty Zero this is going in PCMaple 1.8