Skip to content

Commit

Permalink
Updater message change
Browse files Browse the repository at this point in the history
  • Loading branch information
Rothes committed Feb 26, 2024
1 parent 1097dc8 commit f26ca1e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main/java/me/rothes/protocolstringreplacer/Updater.java
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ private void checkJson(String json) {
private void sendJsonMessage(JsonObject json, String id) {
JsonObject msgJson = json.getAsJsonObject("Message");
String msg = getLocaledJsonMessage(msgJson);
if (msg == null) {
return;
}

int msgTimes = json.has("Message_Times") ? json.get("Message_Times").getAsInt() : -1;
int curTimes = msgTimesMap.get(id) == null ? 0 : msgTimesMap.get(id);
Expand Down Expand Up @@ -204,10 +207,10 @@ private void checkActions(JsonArray actions) {
}

private String getLocaledJsonMessage(@NotNull JsonObject messageJson) {
String msg;
String msg = null;
if (messageJson.has(PsrLocalization.getLocale())) {
msg = messageJson.get(PsrLocalization.getLocale()).getAsString();
} else {
} else if (messageJson.has("en-US")) {
msg = messageJson.get("en-US").getAsString();
}
return msg;
Expand Down

0 comments on commit f26ca1e

Please sign in to comment.