Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-09-08 12:32:53 +02:00
Fix some nested language strings (#482)
Dieser Commit ist enthalten in:
Ursprung
5b3e7c965f
Commit
eeb4cafbc8
@ -27,18 +27,15 @@ package org.geysermc.connector.utils;
|
||||
|
||||
import com.github.steveice10.mc.protocol.data.game.scoreboard.TeamColor;
|
||||
import com.github.steveice10.mc.protocol.data.message.*;
|
||||
import com.github.steveice10.opennbt.tag.builtin.StringTag;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.JsonPrimitive;
|
||||
import com.google.gson.*;
|
||||
import net.kyori.text.Component;
|
||||
import net.kyori.text.serializer.gson.GsonComponentSerializer;
|
||||
import net.kyori.text.serializer.legacy.LegacyComponentSerializer;
|
||||
import org.geysermc.connector.network.session.GeyserSession;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@ -111,9 +108,20 @@ public class MessageUtils {
|
||||
builder.append(getColorOrParent(msg.getStyle()));
|
||||
if (!(msg.getText() == null)) {
|
||||
boolean isTranslationMessage = (msg instanceof TranslationMessage);
|
||||
builder.append(getTranslatedBedrockMessage(msg, locale, isTranslationMessage));
|
||||
String extraText = "";
|
||||
|
||||
if (isTranslationMessage) {
|
||||
List<String> paramsTranslated = getTranslationParams(((TranslationMessage) msg).getTranslationParams(), locale);
|
||||
extraText = insertParams(getTranslatedBedrockMessage(msg, locale, isTranslationMessage), paramsTranslated);
|
||||
} else {
|
||||
extraText = getTranslatedBedrockMessage(msg, locale, isTranslationMessage);
|
||||
}
|
||||
|
||||
builder.append(extraText);
|
||||
builder.append("\u00a7r");
|
||||
}
|
||||
}
|
||||
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
@ -164,9 +172,11 @@ public class MessageUtils {
|
||||
}
|
||||
|
||||
for (String text : params) {
|
||||
newMessage = newMessage.replaceFirst("%s", text);
|
||||
newMessage = newMessage.replaceFirst("%s", text.replaceAll("%s", "%r"));
|
||||
}
|
||||
|
||||
newMessage = newMessage.replaceAll("%r", "MISSING!");
|
||||
|
||||
return newMessage;
|
||||
}
|
||||
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren