Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-26 16:12:46 +01:00
Clean chat code and fix skins
Dieser Commit ist enthalten in:
Ursprung
f2f59e4e37
Commit
70009c4bf9
@ -105,7 +105,7 @@
|
||||
<dependency>
|
||||
<groupId>com.github.GeyserMC</groupId>
|
||||
<artifactId>MCProtocolLib</artifactId>
|
||||
<version>feature~1.16-1.12.1-1-g74ee57a-310</version>
|
||||
<version>feature~1.16-1.12.1-1-ge4798a3-318</version>
|
||||
<scope>compile</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
|
@ -32,6 +32,7 @@ import com.github.steveice10.mc.protocol.data.message.TextMessage;
|
||||
import com.github.steveice10.mc.protocol.data.message.TranslationMessage;
|
||||
import com.github.steveice10.mc.protocol.data.message.style.ChatColor;
|
||||
import com.github.steveice10.mc.protocol.data.message.style.ChatFormat;
|
||||
import com.github.steveice10.mc.protocol.data.message.style.MessageStyle;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import net.kyori.text.Component;
|
||||
@ -216,25 +217,19 @@ public class MessageUtils {
|
||||
if (parent == null) {
|
||||
return message;
|
||||
}
|
||||
Message newMessage = message;
|
||||
MessageStyle.Builder styleBuilder = message.getStyle().toBuilder();
|
||||
|
||||
// Copy color from parent
|
||||
if (newMessage.getStyle().getColor() == ChatColor.NONE) {
|
||||
JsonObject messageObject = MessageSerializer.toJsonObject(newMessage);
|
||||
messageObject.addProperty("color", parent.getStyle().getColor());
|
||||
newMessage = MessageSerializer.fromJson(messageObject);
|
||||
if (message.getStyle().getColor() == ChatColor.NONE) {
|
||||
styleBuilder.color(parent.getStyle().getColor());
|
||||
}
|
||||
|
||||
// Copy formatting from parent
|
||||
if (newMessage.getStyle().getFormats().size() == 0) {
|
||||
JsonObject messageObject = MessageSerializer.toJsonObject(newMessage);
|
||||
for(ChatFormat format : parent.getStyle().getFormats()) {
|
||||
messageObject.addProperty(format.toString(), true);
|
||||
}
|
||||
newMessage = MessageSerializer.fromJson(messageObject);
|
||||
if (message.getStyle().getFormats().size() == 0) {
|
||||
styleBuilder.formats(parent.getStyle().getFormats());
|
||||
}
|
||||
|
||||
return newMessage;
|
||||
return message.toBuilder().style(styleBuilder.build()).build();
|
||||
}
|
||||
|
||||
public static String getBedrockMessage(Message message) {
|
||||
|
@ -96,6 +96,7 @@ public class SkinUtils {
|
||||
entry.setXuid("");
|
||||
entry.setPlatformChatId("");
|
||||
entry.setTeacher(false);
|
||||
entry.setTrustedSkin(true);
|
||||
return entry;
|
||||
}
|
||||
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren