SteamWar/SpigotCore
Archiviert
13
0

Reflections
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
zOnlyKroks 2022-08-06 21:30:24 +02:00
Ursprung 71f7264789
Commit 3ca4a7d99f

Datei anzeigen

@ -26,6 +26,9 @@ import net.minecraft.network.chat.contents.LiteralContents;
import net.minecraft.network.protocol.game.ClientboundServerDataPacket;
public class ChatWrapper19 implements ChatWrapper {
private static final Reflection.FieldAccessor<Boolean> accessor = Reflection.getField(ClientboundServerDataPacket.class, "c",Boolean.class);
@Override
public Object stringToChatComponent(String text) {
return IChatMutableComponent.a(new LiteralContents(text));
@ -40,11 +43,7 @@ public class ChatWrapper19 implements ChatWrapper {
@Override
public Object modifyServerDataPacket(Object o) {
ClientboundServerDataPacket clientboundServerDataPacket = (ClientboundServerDataPacket) o;
try{
o.getClass().getDeclaredField("c").setBoolean(clientboundServerDataPacket,true);
}catch (NoSuchFieldException | IllegalAccessException e) {
//ignore
}
accessor.set(clientboundServerDataPacket,true);
return clientboundServerDataPacket;
}
}