Skip to content

Commit

Permalink
Minor bugfixes
Browse files Browse the repository at this point in the history
Fixed invalid warning message
Fixed text formatting bug
  • Loading branch information
abc123me committed Dec 4, 2022
1 parent c603536 commit 9c68d69
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/jeremiahbl/bfcmod/TextFormatter.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public static final TextComponent stringToFormattedText(String msg, boolean enab
if(enableColors) curColor = getColor(c, curColor);
if(enableStyles) curStyle = getStyle(c, curStyle);
curStr = "";
nextIsStyle = false;
} else curStr += ("&" + c);
nextIsStyle = false;
} else curStr += c;
}
if(curStr.length() > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;

import com.jeremiahbl.bfcmod.TextFormatter;
import com.jeremiahbl.bfcmod.config.ConfigHandler;
Expand Down Expand Up @@ -46,12 +47,12 @@ public void onServerChat(ServerChatEvent e) {
if(!enableColor && TextFormatter.messageContainsColorsOrStyles(msg, true))
emsg = "You are not permitted to use colors";
if(!enableStyle && TextFormatter.messageContainsColorsOrStyles(msg, false))
emsg = emsg.length() > 0 ? " or styles" : "You are not permitted to use styles";
emsg += emsg.length() > 0 ? " or styles" : "You are not permitted to use styles";
if(emsg.length() > 0) {
TextComponent ecmp = new TextComponent(emsg + "!");
ecmp.withStyle(ChatFormatting.BOLD);
ecmp.withStyle(ChatFormatting.RED);
player.sendMessage(ecmp, ChatType.GAME_INFO, player.getUUID());
player.sendMessage(ecmp, ChatType.GAME_INFO, UUID.randomUUID());
}
TextComponent msgComp = TextFormatter.stringToFormattedText(msg, enableColor, enableStyle);
e.setComponent(beforeMsg.append(msgComp.append(afterMsg)));
Expand Down

0 comments on commit 9c68d69

Please sign in to comment.