Advertisement
Guest User

Untitled

a guest
Aug 8th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.78 KB | None | 0 0
  1. package core;
  2. import core.factories.BotFactory;
  3.  
  4. import org.schwering.irc.lib.IRCConnection;
  5. import org.schwering.irc.lib.IRCEventListener;
  6. import org.schwering.irc.lib.IRCUser;
  7. import org.schwering.irc.lib.IRCModeParser;
  8. import java.sql.Connection;
  9. import java.sql.DatabaseMetaData;
  10. import java.sql.DriverManager;
  11. import java.sql.SQLException;
  12. import java.sql.Statement;
  13. import java.sql.ResultSet;
  14. import java.util.HashMap;
  15.  
  16. public class Plugin implements IRCEventListener {
  17.    
  18.     protected Connection sql;
  19.     protected IRCConnection irc;
  20.     protected BotFactory bot;
  21.     protected HashMap <String,NicknamesItem> nicknames;
  22.     protected HashMap <String,IRCEventListener> plugins;
  23.     protected Statement stmtS;
  24.     protected Statement stmtQ;
  25.     protected ResultSet result;
  26.  
  27.     public Plugin() {
  28.  
  29.     }
  30.  
  31.     public void addIRCConnection(IRCConnection a) {
  32.         this.irc = a;
  33.     }
  34.  
  35.     public void SQLConnect() {
  36.         try {
  37.             Class.forName("com.mysql.jdbc.Driver");
  38.             this.sql = DriverManager.getConnection("jdbc:mysql://"+bot.getSQLAddress()+":"+bot.getSQLPort()+"/"+bot.getSQLDatabase(),bot.getSQLUsername(), bot.getSQLPassword());
  39.             this.stmtS = sql.createStatement();
  40.             this.stmtQ = sql.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
  41.         }
  42.         catch (Exception e) {
  43.             e.printStackTrace();
  44.         }
  45.     }
  46.  
  47.     public void SQLDisconnect() {
  48.         try {
  49.             sql.close();
  50.         }
  51.         catch (Exception e) {
  52.             e.printStackTrace();
  53.         }
  54.     }
  55.  
  56.     public void addSQLConnection(Connection a) {
  57.         this.sql = a;
  58.     }
  59.  
  60.     public void addBotFactory(BotFactory a) {
  61.         this.bot = a;
  62.         this.nicknames = a.getNicknames();
  63.         this.plugins = a.getPlugins();
  64.     }
  65.  
  66.     public void onPrivmsg (String target, IRCUser user, String msg) {
  67.     }
  68.  
  69.     public void stop() {
  70.     }
  71.  
  72.     public void onRegistered() {
  73.     }
  74.  
  75.     public void onDisconnected() {
  76.     }
  77.  
  78.     public void onError(String msg) {
  79.     }
  80.  
  81.     public void onError(int num, String msg) {
  82.     }
  83.  
  84.     public void onInvite(String chan, IRCUser user, String passiveNick) {
  85.     }
  86.  
  87.     public void onJoin(String chan, IRCUser user) {
  88.     }
  89.  
  90.     public void onKick(String chan, IRCUser user, String passiveNick, String msg) {
  91.     }
  92.  
  93.     public void onMode(String chan, IRCUser user, IRCModeParser modeParser) {
  94.     }
  95.  
  96.     public void onMode(IRCUser user, String passiveNick, String mode) {
  97.     }
  98.  
  99.     public void onNick(IRCUser user, String newNick) {
  100.     }
  101.  
  102.     public void onNotice(String target, IRCUser user, String msg) {
  103.     }
  104.  
  105.     public void onPart(String chan, IRCUser user, String msg) {
  106.     }
  107.  
  108.     public void onPing(String ping) {
  109.     }
  110.  
  111.     public void onQuit(IRCUser user, String msg) {
  112.     }
  113.  
  114.     public void onReply(int num, String value, String msg) {
  115.     }
  116.  
  117.     public void onTopic(String chan, IRCUser user, String topic) {
  118.     }
  119.  
  120.     public void unknown(String prefix, String command, String middle, String trailing) {
  121.     }
  122. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement