Build AsminVoicechat / prepare-release (push) Successful in 14s
Build AsminVoicechat / build-and-test (17) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (18) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (19) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (20) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (21) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (22) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (23) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (24) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (25) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (26) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (27-ea) (push) Canceled after 0s
Build AsminVoicechat / build-and-test (16) (push) Canceled after 38s
84 lines
4.0 KiB
Java
84 lines
4.0 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*
|
|
* Could not load the following classes:
|
|
* com.mojang.brigadier.arguments.ArgumentType
|
|
* org.bukkit.entity.Player
|
|
*/
|
|
package de.maxhenkel.voicechat.compatibility;
|
|
|
|
import com.mojang.brigadier.arguments.ArgumentType;
|
|
import de.maxhenkel.voicechat.BukkitVersion;
|
|
import de.maxhenkel.voicechat.compatibility.Compatibility1_8;
|
|
import de.maxhenkel.voicechat.compatibility.JsonMessageBaseCompatibility;
|
|
import de.maxhenkel.voicechat.compatibility.ReflectionUtils;
|
|
import java.util.UUID;
|
|
import org.bukkit.entity.Player;
|
|
|
|
public class Compatibility1_16
|
|
extends JsonMessageBaseCompatibility {
|
|
public static final BukkitVersion VERSION_1_16_5 = BukkitVersion.parseBukkitVersion("1.16.5-R0.1");
|
|
public static final BukkitVersion VERSION_1_16_4 = BukkitVersion.parseBukkitVersion("1.16.4-R0.1");
|
|
public static final BukkitVersion VERSION_1_16_3 = BukkitVersion.parseBukkitVersion("1.16.3-R0.1");
|
|
public static final BukkitVersion VERSION_1_16_2 = BukkitVersion.parseBukkitVersion("1.16.2-R0.1");
|
|
public static final BukkitVersion VERSION_1_16_1 = BukkitVersion.parseBukkitVersion("1.16.1-R0.1");
|
|
public static final BukkitVersion VERSION_1_16 = BukkitVersion.parseBukkitVersion("1.16-R0.1");
|
|
public static final Compatibility1_16 INSTANCE = new Compatibility1_16();
|
|
private static final UUID NUL_UUID = new UUID(0L, 0L);
|
|
|
|
@Override
|
|
public void sendJsonMessage(Player player, String json) {
|
|
Class<?> chatMessageTypeClass = this.getServerClass("ChatMessageType");
|
|
Object b = ReflectionUtils.getField(chatMessageTypeClass, "CHAT");
|
|
this.send(player, json, b);
|
|
}
|
|
|
|
@Override
|
|
public void sendJsonStatusMessage(Player player, String json) {
|
|
Class<?> chatMessageTypeClass = this.getServerClass("ChatMessageType");
|
|
Object b = ReflectionUtils.getField(chatMessageTypeClass, "GAME_INFO");
|
|
this.send(player, json, b);
|
|
}
|
|
|
|
@Override
|
|
public String createTranslationMessage(String key, String ... args) {
|
|
return Compatibility1_8.constructTranslationMessage(key, args);
|
|
}
|
|
|
|
@Override
|
|
public void sendInviteMessage(Player player, Player commandSender, String groupName, String joinCommand) {
|
|
this.sendJsonMessage(player, Compatibility1_8.constructInviteMessage(commandSender, groupName, joinCommand));
|
|
}
|
|
|
|
@Override
|
|
public void sendIncompatibleMessage(Player player, String pluginVersion, String pluginName) {
|
|
this.sendJsonMessage(player, Compatibility1_8.constructIncompatibleMessage(pluginVersion, pluginName));
|
|
}
|
|
|
|
@Override
|
|
public ArgumentType<?> playerArgument() {
|
|
Class<?> argumentEntity = this.getServerClass("ArgumentEntity");
|
|
return (ArgumentType)ReflectionUtils.callMethod(argumentEntity, "c");
|
|
}
|
|
|
|
@Override
|
|
public ArgumentType<?> uuidArgument() {
|
|
Class<?> argumentEntity = this.getServerClass("ArgumentUUID");
|
|
return (ArgumentType)ReflectionUtils.callMethod(argumentEntity, "a");
|
|
}
|
|
|
|
private void send(Player player, String json, Object chatMessageType) {
|
|
Object entityPlayer = ReflectionUtils.callMethod((Object)player, "getHandle");
|
|
Object playerConnection = ReflectionUtils.getField(entityPlayer, "playerConnection");
|
|
Class<?> packet = this.getServerClass("Packet");
|
|
Class<?> chatSerializer = this.getServerClass("IChatBaseComponent$ChatSerializer");
|
|
Class<?> iChatBaseComponentClass = this.getServerClass("IChatBaseComponent");
|
|
Object iChatBaseComponent = ReflectionUtils.callMethod(chatSerializer, "a", new Class[]{String.class}, json);
|
|
Class<?> packetPlayOutChatClass = this.getServerClass("PacketPlayOutChat");
|
|
Class<?> chatMessageTypeClass = this.getServerClass("ChatMessageType");
|
|
Object clientboundSystemChatPacket = ReflectionUtils.callConstructor(packetPlayOutChatClass, new Class[]{iChatBaseComponentClass, chatMessageTypeClass, UUID.class}, iChatBaseComponent, chatMessageType, NUL_UUID);
|
|
ReflectionUtils.callMethod(playerConnection, "sendPacket", new Class[]{packet}, clientboundSystemChatPacket);
|
|
}
|
|
}
|
|
|