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