Skip to content

Commit

Permalink
Fixed commands not working on some servers since translations
Browse files Browse the repository at this point in the history
  • Loading branch information
DustinRepo committed Mar 17, 2022
1 parent b29538e commit ae1c76d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion config.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ commandPrefix=!
greenText=true
#Sets whether or not to print with color in the console
consoleColor=true
#Sets the locale for the ServerBoundClientSettings packet https://minecraft.fandom.com/wiki/Language
#Sets the locale for the ServerBoundClientSettings packet and translations https://minecraft.fandom.com/wiki/Language
locale=en_us
#Sets whether or not to allow the bot to be seen in server's player listing
allowServerListing=true
Expand Down
2 changes: 1 addition & 1 deletion src/me/dustin/chatbot/chat/ChatMessage.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public static ChatMessage of(String jsonData) {
}
}
body.append(getExtra(jsonObject));
if (isChat && body.toString().startsWith("<") && body.toString().contains("> ") && name.toString().isEmpty()) {//crude way to move player name to actual name field if the text is set up weird
if (body.toString().startsWith("<") && body.toString().contains("> ") && name.toString().isEmpty()) {//crude way to move player name to actual name field if the text is set up weird
String s = body.toString().split("<")[1].split(">")[0];
name.append(s);
body = new StringBuilder(body.toString().replace("<" + s + "> ", ""));
Expand Down
2 changes: 1 addition & 1 deletion src/me/dustin/chatbot/helper/GeneralHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static void print(String s, ChatMessage.TextColors color) {
}

public static void printChat(ChatMessage chatMessage) {
if (!chatMessage.getSenderName().isEmpty() && chatMessage.isChat())
if (!chatMessage.getSenderName().isEmpty() && !chatMessage.getSenderName().startsWith("<"))
chatMessage = new ChatMessage("<" + chatMessage.getSenderName() + (chatMessage.getSenderName().contains("§") ? "§f" : "") +">", chatMessage.getBody());
String m = chatMessage.getMessage();
if (!m.contains("§") || !ChatBot.getConfig().isColorConsole()) {
Expand Down

0 comments on commit ae1c76d

Please sign in to comment.