package org.mcupdater.ravenbot.features;

import org.pircbotx.hooks.ListenerAdapter;
import org.pircbotx.hooks.events.MessageEvent;

public class InfoHandler extends ListenerAdapter {

    @Override
    public void onMessage(final MessageEvent event) {
        if (event.getMessage().startsWith(".info")) {
            String[] splitMessage = event.getMessage().split(" ");
            if (splitMessage.length == 1) {

            }
        }
    }
}

@@ -35,16 +35,129 @@
 tures;%0A%0A
+import org.apache.commons.lang3.StringUtils;%0Aimport org.mcupdater.ravenbot.RavenBot;%0Aimport org.pircbotx.Colors;%0A
 import o
@@ -239,16 +239,79 @@
 Event;%0A%0A
+import java.sql.PreparedStatement;%0Aimport java.sql.ResultSet;%0A%0A
 public c
@@ -350,24 +350,21 @@
 rAdapter
- %7B%0A%0A    
+%0A%7B%0A%0A%09
 @Overrid
@@ -365,20 +365,17 @@
 verride%0A
-    
+%09
 public v
@@ -416,24 +416,18 @@
 vent) %7B%0A
-        
+%09%09
 if (even
@@ -468,148 +468,1229 @@
 ) %7B%0A
-            String%5B%5D splitMessage = e
+%09%09%09String%5B%5D splitMessage = event.getMessage().split(%22 %22);%0A%09%09%09if (splitMessage.length == 1) %7B%0A%09%09%09%09event.respond(%22No key specified.%22);%0A%09%09%09%09return;%0A%09%09%09%7D%0A%09%09%09if (splitMessage.length == 2) %7B%0A%09%09%09%09String key = splitMessage%5B1%5D;%0A%09%09%09%09try %7B%0A%09%09%09%09%09PreparedStatement getInfo = Ra
 ven
+Bo
 t.get
-Message().split(%22 %22);%0A            if (splitMessage.length == 1) %7B%0A%0A            %7D%0A        %7D%0A    
+Instance().getPreparedStatement(%22getInfo%22);%0A%09%09%09%09%09getInfo.setString(1, key);%0A%09%09%09%09%09ResultSet results = getInfo.executeQuery();%0A%09%09%09%09%09if (results.next()) %7B%0A%09%09%09%09%09%09event.respond(Colors.BOLD + key + Colors.NORMAL + %22 - %22 + results.getString(1));%0A%09%09%09%09%09%7D else %7B%0A%09%09%09%09%09%09event.respond(%22No information found for: %22 + key);%0A%09%09%09%09%09%7D%0A%09%09%09%09%7D catch (Exception e) %7B%0A%09%09%09%09%09e.printStackTrace();%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%09if (splitMessage.length %3E 2) %7B%0A%09%09%09%09String key = splitMessage%5B1%5D;%0A%09%09%09%09String data = StringUtils.join(splitMessage, %22 %22, 2, splitMessage.length);%0A%09%09%09%09try %7B%0A%09%09%09%09%09PreparedStatement updateInfo = RavenBot.getInstance().getPreparedStatement(%22updateInfo%22);%0A%09%09%09%09%09updateInfo.setString(1, key);%0A%09%09%09%09%09updateInfo.setString(2, data);%0A%09%09%09%09%09if (updateInfo.executeUpdate() %3E 0) %7B%0A%09%09%09%09%09%09event.respond(%22Value set.%22);%0A%09%09%09%09%09%7D else %7B%0A%09%09%09%09%09%09event.respond(%22An error occurred while trying to set the value.%22);%0A%09%09%09%09%09%7D%0A%09%09%09%09%7D catch (Exception e) %7B%0A%09%09%09%09%09e.printStackTrace();%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%7D%0A%09
 %7D%0A%7D%0A

Handle .info. Still needs .ilist