Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

View An Accounts Banreason In-game*ODIN*

Status
Not open for further replies.
Banned
Banned
Joined
Sep 25, 2006
Messages
295
Reaction score
1
Someone wanted my banreason command for Odin so here it is.

Type !banreason accountname and it will display the accountname/banreason/macs.

You might need some extra imports but I don't remember what they are so I'll just include all the entire list I have at the bottom..

In BanningCommands.java
Add
Code:
                } else if (splitted[0].equals("!banreason")) {
                        String name = StringUtil.joinStringFrom(splitted, 1);
                        mc.dropMessage(getBannedReason(name));
                }

Add
Code:
        private static String getBannedReason(String name) {
                try {
                        Connection con = DatabaseConnection.getConnection();
                        PreparedStatement ps = con.prepareStatement("SELECT * FROM accounts WHERE name = ?");
                        ps.setString(1, name);
                        ResultSet rs = ps.executeQuery();
                        if(rs.next())
                                return "username: " + rs.getString("name") + " | banreason: " + rs.getString("banreason") + " | macs: " + rs.getString("macs");
                } catch(Exception ex) {}
                return "Error while trying to get name or banreason.";
        }

Add
Code:
                        new CommandDefinition("banreason", "<name>", "Gets the reason for a users ban.", 100),

Code:
package net.sf.odinms.client.messages.commands;

import static net.sf.odinms.client.messages.CommandProcessor.getNamedIntArg;
import static net.sf.odinms.client.messages.CommandProcessor.joinAfterString;

import java.text.DateFormat;
import java.util.Calendar;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

import net.sf.odinms.database.DatabaseConnection;
import net.sf.odinms.client.MapleCharacter;
import net.sf.odinms.client.MapleCharacterUtil;
import net.sf.odinms.client.MapleClient;
import net.sf.odinms.client.messages.Command;
import net.sf.odinms.client.messages.CommandDefinition;
import net.sf.odinms.client.messages.IllegalCommandSyntaxException;
import net.sf.odinms.client.messages.MessageCallback;
import net.sf.odinms.net.channel.ChannelServer;
import net.sf.odinms.tools.StringUtil;
 
Initiate Mage
Joined
Apr 2, 2008
Messages
89
Reaction score
1
Re: [RELEASE] View An Accounts Banreason In-game*ODIN*

great release, i'll add to my server l8er i am to lazy to right now XD
 
Initiate Mage
Joined
Mar 14, 2008
Messages
89
Reaction score
0
Re: [RELEASE] View An Accounts Banreason In-game*ODIN*

Nice release air, something I can use for my server.
 
Initiate Mage
Joined
Sep 27, 2005
Messages
72
Reaction score
1
Re: [RELEASE] View An Accounts Banreason In-game*ODIN*

I can't find BanningCommands.java for some reason? =S
 
Experienced Elementalist
Joined
Jul 2, 2008
Messages
287
Reaction score
0
Re: [RELEASE] View An Accounts Banreason In-game*ODIN*

same here T.T
 
Junior Spellweaver
Joined
Apr 12, 2008
Messages
105
Reaction score
0
Re: [RELEASE] View An Accounts Banreason In-game*ODIN*

Just add it into CommandProcessor. There are some that don't have the organized command files and there are some who do.
 
Initiate Mage
Joined
Jan 4, 2007
Messages
69
Reaction score
0
Re: [RELEASE] View An Accounts Banreason In-game*ODIN*

This is for v0.58 aka odinsnow which has these files. Just put them in CommandProcessor.java for v0.55, and this code is the syntax
Code:
          new CommandDefinition("banreason", "<name>", "Gets the reason for a users ban.", 100),

Editted:
This includes the syntax for those v0.55 users
Code:
                        } else if (splitted[0].equals("!banreason")) {
                                if (splitted.length < 4) {
                                    mc.dropMessage("Syntax: !banreason <name>");
                                } else {
                                String name = StringUtil.joinStringFrom(splitted, 1);
                                mc.dropMessage(getBannedReason(name));
                                }
 
Experienced Elementalist
Joined
Jun 22, 2008
Messages
264
Reaction score
0
Re: [RELEASE] View An Accounts Banreason In-game*ODIN*

another one of airflow0's great release.

Gj :D

~dXm
 
Banned
Banned
Joined
May 30, 2008
Messages
726
Reaction score
1
Re: [RELEASE] View An Accounts Banreason In-game*ODIN*

does this also show who banned the person??
 
Status
Not open for further replies.
Back
Top