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