Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-08 17:20:24 +01:00
Merge pull request #1502 from ViaVersion/master
Merge master into dev
Dieser Commit ist enthalten in:
Commit
5ad2511e17
@ -3,6 +3,7 @@ package us.myles.ViaVersion.protocols.protocol1_12to1_11_1;
|
|||||||
import com.google.gson.JsonArray;
|
import com.google.gson.JsonArray;
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
import com.google.gson.JsonPrimitive;
|
||||||
import us.myles.ViaVersion.api.data.UserConnection;
|
import us.myles.ViaVersion.api.data.UserConnection;
|
||||||
|
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
@ -20,23 +21,30 @@ public class ChatItemRewriter {
|
|||||||
if (hoverEvent.has("action") && hoverEvent.has("value")) {
|
if (hoverEvent.has("action") && hoverEvent.has("value")) {
|
||||||
String type = hoverEvent.get("action").getAsString();
|
String type = hoverEvent.get("action").getAsString();
|
||||||
if (type.equals("show_item") || type.equals("show_entity")) {
|
if (type.equals("show_item") || type.equals("show_entity")) {
|
||||||
if (hoverEvent.get("value").isJsonPrimitive()) {
|
JsonElement value = hoverEvent.get("value");
|
||||||
if (hoverEvent.get("value").getAsJsonPrimitive().isString()) {
|
|
||||||
String value = hoverEvent.get("value").getAsString();
|
if (value.isJsonPrimitive() && value.getAsJsonPrimitive().isString()) {
|
||||||
value = indexRemoval.matcher(value).replaceAll("");
|
String newValue = indexRemoval.matcher(value.getAsString()).replaceAll("");
|
||||||
hoverEvent.addProperty("value", value);
|
hoverEvent.addProperty("value", newValue);
|
||||||
|
} else if (value.isJsonArray()) {
|
||||||
|
JsonArray newArray = new JsonArray();
|
||||||
|
|
||||||
|
for (JsonElement valueElement : value.getAsJsonArray()) {
|
||||||
|
if (valueElement.isJsonPrimitive() && valueElement.getAsJsonPrimitive().isString()) {
|
||||||
|
String newValue = indexRemoval.matcher(valueElement.getAsString()).replaceAll("");
|
||||||
|
newArray.add(new JsonPrimitive(newValue));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
hoverEvent.add("value", newArray);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if (obj.has("extra")) {
|
||||||
} else {
|
|
||||||
if (obj.has("extra")) {
|
|
||||||
toClient(obj.get("extra"), user);
|
toClient(obj.get("extra"), user);
|
||||||
}
|
}
|
||||||
}
|
} else if (element instanceof JsonArray) {
|
||||||
}
|
|
||||||
if (element instanceof JsonArray) {
|
|
||||||
JsonArray array = (JsonArray) element;
|
JsonArray array = (JsonArray) element;
|
||||||
for (JsonElement value : array) {
|
for (JsonElement value : array) {
|
||||||
toClient(value, user);
|
toClient(value, user);
|
||||||
|
@ -105,8 +105,7 @@ public class Protocol1_13To1_12_2 extends Protocol {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// These are arbitrary rewrite values, it just needs an invalid color code character.
|
// These are arbitrary rewrite values, it just needs an invalid color code character.
|
||||||
protected static EnumMap<ChatColor, Character> SCOREBOARD_TEAM_NAME_REWRITE = new EnumMap<>(ChatColor.class);
|
protected static final EnumMap<ChatColor, Character> SCOREBOARD_TEAM_NAME_REWRITE = new EnumMap<>(ChatColor.class);
|
||||||
// @formatter:on
|
|
||||||
|
|
||||||
static {
|
static {
|
||||||
SCOREBOARD_TEAM_NAME_REWRITE.put(ChatColor.BLACK, 'g');
|
SCOREBOARD_TEAM_NAME_REWRITE.put(ChatColor.BLACK, 'g');
|
||||||
@ -125,6 +124,13 @@ public class Protocol1_13To1_12_2 extends Protocol {
|
|||||||
SCOREBOARD_TEAM_NAME_REWRITE.put(ChatColor.LIGHT_PURPLE, 'z');
|
SCOREBOARD_TEAM_NAME_REWRITE.put(ChatColor.LIGHT_PURPLE, 'z');
|
||||||
SCOREBOARD_TEAM_NAME_REWRITE.put(ChatColor.YELLOW, '!');
|
SCOREBOARD_TEAM_NAME_REWRITE.put(ChatColor.YELLOW, '!');
|
||||||
SCOREBOARD_TEAM_NAME_REWRITE.put(ChatColor.WHITE, '?');
|
SCOREBOARD_TEAM_NAME_REWRITE.put(ChatColor.WHITE, '?');
|
||||||
|
SCOREBOARD_TEAM_NAME_REWRITE.put(ChatColor.MAGIC, '#');
|
||||||
|
SCOREBOARD_TEAM_NAME_REWRITE.put(ChatColor.BOLD, '(');
|
||||||
|
SCOREBOARD_TEAM_NAME_REWRITE.put(ChatColor.STRIKETHROUGH, ')');
|
||||||
|
SCOREBOARD_TEAM_NAME_REWRITE.put(ChatColor.UNDERLINE, ':');
|
||||||
|
SCOREBOARD_TEAM_NAME_REWRITE.put(ChatColor.ITALIC, ';');
|
||||||
|
SCOREBOARD_TEAM_NAME_REWRITE.put(ChatColor.RESET, '/');
|
||||||
|
|
||||||
MappingData.init();
|
MappingData.init();
|
||||||
ConnectionData.init();
|
ConnectionData.init();
|
||||||
RecipeData.init();
|
RecipeData.init();
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren