Skip to content

Commit

Permalink
Fixed some bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Scribee committed May 3, 2018
1 parent 0cfb811 commit 504a8fd
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/main/java/scribee/morePingsMod/MorePingsMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ public void onChatEvent(ClientChatReceivedEvent event) {

for (String keyword : keywordList) {
if (ConfigHandler.caseSensitive)
keywordPattern = Pattern.compile(".+?" + String.valueOf('\u00a7') + "(7|f): .*(" + String.valueOf('\u00a7') + "7|\\b)(" + keyword + "\\b)");
keywordPattern = Pattern.compile(".+?" + String.valueOf('\u00a7') + "(7|f): .*(" + String.valueOf('\u00a7') + "7|" + String.valueOf('\u00a7') + "r|\\b)(" + keyword + "\\b)");
else
keywordPattern = Pattern.compile(".+?" + String.valueOf('\u00a7') + "(7|f): .*(" + String.valueOf('\u00a7') + "7|\\b)(" + keyword + "\\b)", Pattern.CASE_INSENSITIVE);
keywordPattern = Pattern.compile(".+?" + String.valueOf('\u00a7') + "(7|f): .*(" + String.valueOf('\u00a7') + "7|" + String.valueOf('\u00a7') + "r|\\b)(" + keyword + "\\b)", Pattern.CASE_INSENSITIVE);

Matcher matcher = keywordPattern.matcher(message);

Expand Down Expand Up @@ -112,19 +112,21 @@ else if (matcher.group(1).equals("f")) {
}
// check for nick set message to add nick as a keyword
if (message.length() > 27 && message.contains("You are now nicked as ")) {
ConfigHandler.config.get(ConfigHandler.CATEGORY_HIDDEN, "Current nick", "", "Automatically stores the name that the player is currently nicked as").set(message.substring(26, message.length() - 1));
ConfigHandler.config.get(ConfigHandler.CATEGORY_HIDDEN, "Current nick", "", "Automatically stores the name that the player is currently nicked as").set(message.substring(26, message.length() - 3));
ConfigHandler.syncConfig();
updateKeywords();

sendModMessage("Nick added to keywords", "nicked as " + EnumChatFormatting.ITALIC + ConfigHandler.nick + EnumChatFormatting.RESET, 2, true);

String style = ConfigHandler.pingStyle.equals("None") ? "" : ConfigHandler.pingStyle.substring(0, 2);
String color = ConfigHandler.pingColor.equals("None") ? "" : ConfigHandler.pingColor.substring(0, 2);
sendModMessage(EnumChatFormatting.GREEN + "Nick added to keywords", "nicked as " + color + style + ConfigHandler.nick + EnumChatFormatting.RESET, 2, true);
}
// check for nick reset message to remove nick from keywords
else if (message.length() == 31 && message.contains("Your nick has been reset!")) {
ConfigHandler.config.get(ConfigHandler.CATEGORY_HIDDEN, "Current nick", "", "Automatically stores the name that the player is currently nicked as").set("");
ConfigHandler.syncConfig();
updateKeywords();

sendModMessage("Nick removed from keywords", "reset nick", 2, true);
sendModMessage(EnumChatFormatting.GREEN + "Nick removed from keywords", "reset nick", 2, true);
}
}
}
Expand Down Expand Up @@ -169,7 +171,7 @@ public static void sendModMessage(String content, String extraInfo, int delay, b
message.appendText(content);

if (!extraInfo.equals(""))
message.appendText("(" + extraInfo + ")");
message.appendText(" (" + extraInfo + EnumChatFormatting.WHITE + ")");

try {
if (delay > 0)
Expand All @@ -188,7 +190,7 @@ else if (delay == 0)
* @param reason Text to put in parentheses after message
*/
public static void sendDisabledMessage(String reason) {
String message = EnumChatFormatting.RED + "Mod Disabled " + EnumChatFormatting.WHITE;
String message = EnumChatFormatting.RED + "Mod Disabled" + EnumChatFormatting.WHITE;

sendModMessage(message, reason, 100, true);

Expand Down

0 comments on commit 504a8fd

Please sign in to comment.