Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package core;
- import core.factories.BotFactory;
- import org.schwering.irc.lib.IRCConnection;
- import org.schwering.irc.lib.IRCEventListener;
- import org.schwering.irc.lib.IRCUser;
- import org.schwering.irc.lib.IRCModeParser;
- import java.sql.Connection;
- import java.sql.DatabaseMetaData;
- import java.sql.DriverManager;
- import java.sql.SQLException;
- import java.sql.Statement;
- import java.sql.ResultSet;
- import java.util.HashMap;
- public class Plugin implements IRCEventListener {
- protected Connection sql;
- protected IRCConnection irc;
- protected BotFactory bot;
- protected HashMap <String,NicknamesItem> nicknames;
- protected HashMap <String,IRCEventListener> plugins;
- protected Statement stmtS;
- protected Statement stmtQ;
- protected ResultSet result;
- public Plugin() {
- }
- public void addIRCConnection(IRCConnection a) {
- this.irc = a;
- }
- public void SQLConnect() {
- try {
- Class.forName("com.mysql.jdbc.Driver");
- this.sql = DriverManager.getConnection("jdbc:mysql://"+bot.getSQLAddress()+":"+bot.getSQLPort()+"/"+bot.getSQLDatabase(),bot.getSQLUsername(), bot.getSQLPassword());
- this.stmtS = sql.createStatement();
- this.stmtQ = sql.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- }
- public void SQLDisconnect() {
- try {
- sql.close();
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- }
- public void addSQLConnection(Connection a) {
- this.sql = a;
- }
- public void addBotFactory(BotFactory a) {
- this.bot = a;
- this.nicknames = a.getNicknames();
- this.plugins = a.getPlugins();
- }
- public void onPrivmsg (String target, IRCUser user, String msg) {
- }
- public void stop() {
- }
- public void onRegistered() {
- }
- public void onDisconnected() {
- }
- public void onError(String msg) {
- }
- public void onError(int num, String msg) {
- }
- public void onInvite(String chan, IRCUser user, String passiveNick) {
- }
- public void onJoin(String chan, IRCUser user) {
- }
- public void onKick(String chan, IRCUser user, String passiveNick, String msg) {
- }
- public void onMode(String chan, IRCUser user, IRCModeParser modeParser) {
- }
- public void onMode(IRCUser user, String passiveNick, String mode) {
- }
- public void onNick(IRCUser user, String newNick) {
- }
- public void onNotice(String target, IRCUser user, String msg) {
- }
- public void onPart(String chan, IRCUser user, String msg) {
- }
- public void onPing(String ping) {
- }
- public void onQuit(IRCUser user, String msg) {
- }
- public void onReply(int num, String value, String msg) {
- }
- public void onTopic(String chan, IRCUser user, String topic) {
- }
- public void unknown(String prefix, String command, String middle, String trailing) {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement