Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixing some color character issues, add stub for getBotFromId, colori…

…zeName() needs fixing, build Preview 9d
  • Loading branch information...
commit 7e4277c6b0aa7fdcb18cea22b6b6dbe55d9cab66 1 parent 8012610
@Animosity authored
View
BIN  beta/preview/CraftIRC.jar
Binary file not shown
View
24 com/ensifera/animosity/craftirc/CraftIRC.java
@@ -441,10 +441,19 @@ public void sendMessageToTag(String message, String tag) {
* @param tag
* @return
*/
- private int getBotFromTag(String tag) {
+ private int getBotIdFromTag(String tag) {
return 0;
}
+ /** TODO: MAKE THIS
+ * CraftIRC API call - getBotFromId(id) Gets the bot id# from a source tag
+ * @param id
+ * @return
+
+ private Minebot getBotFromId(int id) {
+ return Minebot;
+ }
+ */
protected ArrayList<String> ircUserLists(String tag) {
ArrayList<String> result = new ArrayList<String>();
if (tag == null)
@@ -747,11 +756,12 @@ protected boolean checkPerms(String pl, String path) {
return false;
}
+ // TODO: This needs repair
protected String colorizeName(String name) {
- Pattern color_codes = Pattern.compile("§[0-9a-f]");
+ Pattern color_codes = Pattern.compile(Character.toString((char) 3)+"[0-9a-f]");
Matcher find_colors = color_codes.matcher(name);
while (find_colors.find()) {
- name = find_colors.replaceFirst(Character.toString((char) 3)
+ name = find_colors.replaceAll(Character.toString((char) 3)
+ String.format("%02d", cColorIrcFromGame(find_colors.group())));
find_colors = color_codes.matcher(name);
}
@@ -767,7 +777,7 @@ protected String getPermPrefix(String pl) {
String result = perms.getGroupPrefix(group);
if (result == null)
return "";
- return colorizeName(result.replaceAll("&([0-9a-f])", "§$1"));
+ return colorizeName(result.replaceAll("&([0-9a-f])", Character.toString((char) 3)+"$1"));
}
protected String getPermSuffix(String pl) {
@@ -779,15 +789,15 @@ protected String getPermSuffix(String pl) {
String result = perms.getGroupSuffix(group);
if (result == null)
return "";
- return colorizeName(result.replaceAll("&([0-9a-f])", "§$1"));
+ return colorizeName(result.replaceAll("&([0-9a-f])", Character.toString((char) 3)+"$1"));
}
- public void enqueueConsoleCommand(String cmd) {
+ protected void enqueueConsoleCommand(String cmd) {
try {
console.a(cmd, console);
} catch (Exception e) {
-
+ e.printStackTrace();
}
View
4 com/ensifera/animosity/craftirc/RelayedMessage.java
@@ -121,7 +121,7 @@ public String asString(EndPoint realTarget) throws RelayedMessageException {
result = result.replace("%trgChannel%", trgChannel);
result = result.replace("%world%", world);
if (source == EndPoint.GAME && this.plugin.hasPerms() && this.plugin.cChanNameColors(trgBot, trgChannel)) {
- if (this.plugin.isDebug()) CraftIRC.log.info(String.format(CraftIRC.NAME + " RelayedMessage: hasPerms="+String.valueOf(this.plugin.hasPerms())+" cChanNameColors()="+String.valueOf(this.plugin.cChanNameColors(trgBot, trgChannel)))+", apply pre/suffixes ");
+ //if (this.plugin.isDebug()) CraftIRC.log.info(String.format(CraftIRC.NAME + " RelayedMessage: hasPerms="+String.valueOf(this.plugin.hasPerms())+" cChanNameColors()="+String.valueOf(this.plugin.cChanNameColors(trgBot, trgChannel)))+", apply pre/suffixes ");
result = result.replace("%prefix%", this.plugin.getPermPrefix(sender));
result = result.replace("%suffix%", this.plugin.getPermSuffix(sender));
if (!moderator.equals("")) {
@@ -132,7 +132,7 @@ public String asString(EndPoint realTarget) throws RelayedMessageException {
result = result.replace("%modSuffix%", "");
}
} else {
- if (this.plugin.isDebug()) CraftIRC.log.info(String.format(CraftIRC.NAME + " RelayedMessage: hasPerms="+String.valueOf(this.plugin.hasPerms())+" cChanNameColors()="+String.valueOf(this.plugin.cChanNameColors(trgBot, trgChannel)))+", apply EMPTY pre/suffixes ");
+ //if (this.plugin.isDebug()) CraftIRC.log.info(String.format(CraftIRC.NAME + " RelayedMessage: hasPerms="+String.valueOf(this.plugin.hasPerms())+" cChanNameColors()="+String.valueOf(this.plugin.cChanNameColors(trgBot, trgChannel)))+", apply EMPTY pre/suffixes ");
result = result.replace("%prefix%", "");
result = result.replace("%suffix%", "");
result = result.replace("%modPrefix%", "");
View
3  config.yml
@@ -25,7 +25,7 @@ settings:
formatting:
#### Formatting for the messages relayed by the plugin. You can override all formatting strings in the bot or channel
#### scope (within a formatting: block). In irc-to-irc, the target channel controls the format strings.
- #### VARIABLES (may be blank depending on the context): %sender% %message% %moderator% %srcChannel% %trgChannel%
+ #### VARIABLES (may be blank depending on the context): %sender% %message% %moderator% %srcChannel% %trgChannel% %world%
#### IF YOU'RE RUNNING Permissions: %prefix% %suffix% %modPredix% %modSuffix% (game-to-irc only)
#### IRC FORMATTING: %b% %u% %r% %o% %k% %kNUM% (NUM is 0 to 15); Do the same as CTRL+key in mIRC
#### GAME COLORS: §NUM (NUM is 1 to f); Do not use in the end of a line
@@ -66,6 +66,7 @@ settings:
#### events can be redefined in the bot or channel scopes (within an events: block). In irc-to-irc, the source
#### channel controls the events.
game-to-irc:
+ # If you use other chat plugins, you probably want to set cancelled-chat: true
cancelled-chat: false
all-chat: true
joins: false
View
2  plugin.yml
@@ -1,6 +1,6 @@
name: CraftIRC
main: com.ensifera.animosity.craftirc.CraftIRC
-version: 2.0 Preview 9c
+version: 2.0 Preview 9d
commands:
irc:
description: Sends a message to all IRC channels
Please sign in to comment.
Something went wrong with that request. Please try again.