Skip to content

Commit

Permalink
Fixed the defaulting of irc_handle
Browse files Browse the repository at this point in the history
  • Loading branch information
Animosity committed Nov 28, 2010
1 parent 9d5d4c3 commit d239b66
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
9 changes: 7 additions & 2 deletions CraftIRCListener.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import java.lang.Exception;
import java.util.logging.Logger;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Handler;
import java.util.logging.LogRecord;

public class CraftIRCListener extends PluginListener {
protected static final Logger log = Logger.getLogger("Minecraft");
private static ArrayList<String> logMessages = new ArrayList<String>();
private static Minebot bot;

public CraftIRCListener() {
bot = Minebot.getInstance();
}
Expand Down Expand Up @@ -199,5 +203,6 @@ public static String MessageBuilder(String[] a, String separator) {

return result.toString();
}



}
21 changes: 10 additions & 11 deletions Minebot.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

/**
* @author Animosity
*
*
*/

public class Minebot extends PircBot implements Runnable {
Expand Down Expand Up @@ -71,18 +71,17 @@ public synchronized void init() {
}

try {
cmd_prefix = ircSettings.getProperty("command-prefix");

cmd_prefix = ircSettings.getProperty("command-prefix", ".").trim();
if (colorMap.containsKey(ircSettings.getProperty("irc-relayed-user-color").toLowerCase())) {
irc_relayed_user_color = colorMap.get(ircSettings.getProperty("irc-relayed-user-color").toLowerCase());
} else {
irc_relayed_user_color = colorMap.get("white");
}

irc_handle = ircSettings.getProperty("irc-handle").trim();
irc_handle = ircSettings.getProperty("irc-handle", "CraftIRCBot").trim();

irc_server = ircSettings.getProperty("irc-server").trim();
irc_server_port = ircSettings.getProperty("irc-server-port").trim();
irc_server_port = ircSettings.getProperty("irc-server-port", "6667").trim();
irc_server_pass = ircSettings.getProperty("irc-server-password").trim();
irc_server_ssl = Boolean.parseBoolean(ircSettings.getProperty("irc-server-ssl").trim());

Expand Down Expand Up @@ -171,10 +170,11 @@ public synchronized void init() {
log.info(CraftIRC.NAME + " - Error while LOADING settings from " + this.ircSettingsFilename);
e.printStackTrace();
}
if (irc_handle.isEmpty()) {
this.irc_handle = "minecraftbot";
}

/*if (irc_handle.isEmpty()) {
this.irc_handle = "CraftIRCBot";
}
*/
this.setName(this.irc_handle);
this.setFinger(CraftIRC.NAME + " v" + CraftIRC.VERSION);
this.setLogin(this.irc_server_login);
Expand Down Expand Up @@ -417,7 +417,7 @@ public void onMessage(String channel, String sender, String login, String hostna

String[] splitMessage = message.split(" ");
String command = this.combineSplit(1, splitMessage, " ");

try {

// Parse admin commands here
Expand Down Expand Up @@ -466,7 +466,7 @@ else if (message.startsWith(cmd_prefix + "botsay") && this.getChannelList().cont
this.sendNotice(sender, "Sent to main channel: " + command);
return;
}

else if (message.startsWith(cmd_prefix + "raw")) {
// message = message.substring(message.indexOf(" ")).trim();
if (splitMessage.length > 1) {
Expand Down Expand Up @@ -514,7 +514,6 @@ else if (message.startsWith(cmd_prefix + "say") || message.startsWith(cmd_prefix
}
}


} catch (Exception e) {
e.printStackTrace();
log.log(Level.SEVERE, CraftIRC.NAME + " - error while relaying IRC command: " + message);
Expand Down

0 comments on commit d239b66

Please sign in to comment.