Guest Bans

Newbie Spellweaver
Joined
Aug 28, 2009
Messages
80
Reaction score
50
Used this before, but i removed guests recently.

GM.java

Add this within the !ban command handler:
Code:
else if (target.getClient().isGuest()) {
                        String readableTargetName = MapleCharacterUtil.makeMapleReadable(target.getName());
                        Connection con = DatabaseConnection.getConnection();
                        PreparedStatement ps;
                        target.getClient().deleteAllCharacters();
                        ps = con.prepareStatement("INSERT INTO ipbans VALUES (DEFAULT, ?)");
                        String[] ipSplit = target.getClient().getSession().getRemoteAddress().toString().split(":");
                        ps.setString(1, ipSplit[0]);
                        ps.executeUpdate();
                        ps.close();
                        cserv.getWorldInterface().broadcastMessage(null, MaplePacketCreator.serverNotice(6, "Guest user: " + readableTargetName +  " has been banned.").getBytes());
                        cserv.getWorldInterface().broadcastMessage(null, MaplePacketCreator.serverNotice(6, "Reason: " + originalReason).getBytes());
                }

Add this within the !permban handler:
Code:
else if (victim.getClient().isGuest()) {
                        String readableTargetName = MapleCharacterUtil.makeMapleReadable(victim.getName());
                        Connection con = DatabaseConnection.getConnection();
                        PreparedStatement ps;
                        victim.getClient().banMacs();
                        victim.getClient().deleteAllCharacters();
                        ps = con.prepareStatement("INSERT INTO ipbans VALUES (DEFAULT, ?)");
                        String[] ipSplit = victim.getClient().getSession().getRemoteAddress().toString().split(":");
                        ps.setString(1, ipSplit[0]);
                        ps.executeUpdate();
                        ps.close();
                        cserv.getWorldInterface().broadcastMessage(null, MaplePacketCreator.serverNotice(6, "Guest user: " + readableTargetName +  " has been permanently banned.").getBytes());
                        cserv.getWorldInterface().broadcastMessage(null, MaplePacketCreator.serverNotice(6, "Reason: " + originalReason).getBytes());
                }

And again, i wont be saying exactly where should you put these, but these should already be common sense :D

Note: I dont know if this is released, once again, but if it is, the mod may delete it.

Extras:
This was used in dutchms and directms :D
Suitable for use in XoticSource.

Have fun!

Credits:
Fate
Kelvin (for telling me how he managed to get on time to time after bans in the old DutchMs (at least 4months ago))
 
Last edited:
there are people who gets banned and decides to mess around with the server. Ex. Banned, come back again, Banned, come back again

Even thou, the GMs win the war no matter what, it might leave a bad impression on the server that they have "bugged" bans.

Those people will get bored after being banned 10~12times :D Since they take 2mins+ to get in and the GMs take 2seconds to ban them LOL:lol:
 
Back