org.monstercraft.irc.handlers
Class IRCHandler

java.lang.Object
  extended by org.bukkit.plugin.java.JavaPlugin
      extended by org.monstercraft.irc.IRC
          extended by org.monstercraft.irc.handlers.IRCHandler
All Implemented Interfaces:
org.bukkit.command.CommandExecutor, org.bukkit.plugin.Plugin

public class IRCHandler
extends IRC

This handles all of the IRC related stuff.

Author:
fletch_to_99

Constructor Summary
IRCHandler(IRC plugin)
          Creates an instance of the IRCHandler class.
 
Method Summary
 void ban(java.lang.String Nick, java.lang.String channel)
          Bans a user from the IRC channel if the bot is OP.
 void changeNick(java.lang.String Nick)
          Changes the nickname of the IRC bot.
 boolean connect(java.lang.String channel, java.lang.String server, int port, java.lang.String user, java.lang.String nick, java.lang.String password, boolean identify)
          Connects to an IRC server then a channel.
 boolean disconnect(java.lang.String channel)
          Disconnects a user from the IRC server.
 java.util.List<java.lang.String> getOpList()
          Fetches the list of Operaters in the current IRC channel.
 java.util.List<java.lang.String> getVoiceList()
          Fetches the list of Voices in the current IRC channel.
 boolean isConnected()
          Checks if the user is connected to an IRC server.
 boolean isOp(java.lang.String sender, java.util.List<java.lang.String> opList)
          Checks if a user is OP in the IRC.
 boolean isVoice(java.lang.String sender, java.util.List<java.lang.String> voiceList)
          Checks if a user is Voice in the IRC.
 void join(java.lang.String channel)
          Joins an IRC channel on that server.
 void leave(java.lang.String channel)
          Quits a channel in the IRC
 java.lang.String removeColors(java.lang.String msg)
          Removes colors from a string of text.
 void sendMessage(java.lang.String Message, java.lang.String channel)
          Sends a message to the specified channel.
 
Methods inherited from class org.monstercraft.irc.IRC
getCommandManager, getHandleManager, getHookManager, getSettings, onCommand, onDisable, onEnable
 
Methods inherited from class org.bukkit.plugin.java.JavaPlugin
getCommand, getConfig, getConfiguration, getDatabase, getDatabaseClasses, getDataFolder, getDefaultWorldGenerator, getDescription, getPluginLoader, getResource, getServer, isEnabled, isInitialized, isNaggable, onLoad, reloadConfig, saveConfig, setNaggable, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IRCHandler

public IRCHandler(IRC plugin)
Creates an instance of the IRCHandler class.

Parameters:
plugin - The parent plugin.
Method Detail

connect

public boolean connect(java.lang.String channel,
                       java.lang.String server,
                       int port,
                       java.lang.String user,
                       java.lang.String nick,
                       java.lang.String password,
                       boolean identify)
Connects to an IRC server then a channel.

Parameters:
channel - The channel to connect to.
server - The server to connec to.
port - The port to use.
user - The username.
nick - The nick name.
password - The password when identifing.
identify - Weither the user wants to identify with nickserv.
Returns:
True if connected successfully; otherwise false.

disconnect

public boolean disconnect(java.lang.String channel)
Disconnects a user from the IRC server.

Parameters:
channel - The channel to disconenct from, if any.
Returns:
True if we disconnect successfully; otherwise false.

isConnected

public boolean isConnected()
Checks if the user is connected to an IRC server.

Returns:
True if conencted to an IRC server; othewise false.

join

public void join(java.lang.String channel)
Joins an IRC channel on that server.

Parameters:
channel - The channel to join.

leave

public void leave(java.lang.String channel)
           throws java.io.IOException
Quits a channel in the IRC

Parameters:
channel - The channel to leave.
Throws:
java.io.IOException

sendMessage

public void sendMessage(java.lang.String Message,
                        java.lang.String channel)
Sends a message to the specified channel.

Parameters:
Message - The message to send.
channel - The channel to send the message to.

changeNick

public void changeNick(java.lang.String Nick)
Changes the nickname of the IRC bot.

Parameters:
Nick - The name to change to.

ban

public void ban(java.lang.String Nick,
                java.lang.String channel)
Bans a user from the IRC channel if the bot is OP.

Parameters:
Nick - The user to ban.
channel - The channel to ban in.

isOp

public boolean isOp(java.lang.String sender,
                    java.util.List<java.lang.String> opList)
Checks if a user is OP in the IRC.

Parameters:
sender - The name to check.
opList - The list to check in.
Returns:
True if the sender is OP; otherwise false.

isVoice

public boolean isVoice(java.lang.String sender,
                       java.util.List<java.lang.String> voiceList)
Checks if a user is Voice in the IRC.

Parameters:
sender - The name to check.
voiceList - The list to check in.
Returns:
True if the sender is Voice; otherwise false.

getOpList

public java.util.List<java.lang.String> getOpList()
Fetches the list of Operaters in the current IRC channel.

Returns:
The list of Operators.

getVoiceList

public java.util.List<java.lang.String> getVoiceList()
Fetches the list of Voices in the current IRC channel.

Returns:
The list of Voices.

removeColors

public java.lang.String removeColors(java.lang.String msg)
Removes colors from a string of text.

Parameters:
msg - The string to remove the colors from.
Returns:
The string without the colors.