/* * Decompiled with CFR 0.152. * * Could not load the following classes: * org.bukkit.entity.Player */ package de.maxhenkel.voicechat.net; import de.maxhenkel.voicechat.Voicechat; import de.maxhenkel.voicechat.config.ServerConfig; import de.maxhenkel.voicechat.net.Packet; import de.maxhenkel.voicechat.util.FriendlyByteBuf; import de.maxhenkel.voicechat.util.Key; import de.maxhenkel.voicechat.voice.common.Secret; import java.util.UUID; import org.bukkit.entity.Player; public class SecretPacket implements Packet { public static final Key SECRET = Voicechat.compatibility.createNamespacedKey("secret"); private Secret secret; private int serverPort; private UUID playerUUID; private ServerConfig.Codec codec; private int mtuSize; private double voiceChatDistance; private int keepAlive; private boolean groupsEnabled; private String voiceHost; private boolean allowRecording; public SecretPacket() { } public SecretPacket(Player player, Secret secret, int port, ServerConfig serverConfig, String voiceHost) { this.secret = secret; this.serverPort = port; this.playerUUID = player.getUniqueId(); this.codec = serverConfig.voiceChatCodec.get(); this.mtuSize = serverConfig.voiceChatMtuSize.get(); this.voiceChatDistance = serverConfig.voiceChatDistance.get(); this.keepAlive = serverConfig.keepAlive.get(); this.groupsEnabled = serverConfig.groupsEnabled.get(); this.voiceHost = voiceHost; this.allowRecording = serverConfig.allowRecording.get(); } public Secret getSecret() { return this.secret; } public int getServerPort() { return this.serverPort; } public UUID getPlayerUUID() { return this.playerUUID; } public ServerConfig.Codec getCodec() { return this.codec; } public int getMtuSize() { return this.mtuSize; } public double getVoiceChatDistance() { return this.voiceChatDistance; } public int getKeepAlive() { return this.keepAlive; } public boolean groupsEnabled() { return this.groupsEnabled; } public String getVoiceHost() { return this.voiceHost; } @Override public Key getID() { return SECRET; } public boolean allowRecording() { return this.allowRecording; } @Override public SecretPacket fromBytes(FriendlyByteBuf buf) { this.secret = Secret.fromBytes(buf); this.serverPort = buf.readInt(); this.playerUUID = buf.readUUID(); this.codec = ServerConfig.Codec.values()[buf.readByte()]; this.mtuSize = buf.readInt(); this.voiceChatDistance = buf.readDouble(); this.keepAlive = buf.readInt(); this.groupsEnabled = buf.readBoolean(); this.voiceHost = buf.readUtf(); this.allowRecording = buf.readBoolean(); return this; } @Override public void toBytes(FriendlyByteBuf buf) { this.secret.toBytes(buf); buf.writeInt(this.serverPort); buf.writeUUID(this.playerUUID); buf.writeByte(this.codec.ordinal()); buf.writeInt(this.mtuSize); buf.writeDouble(this.voiceChatDistance); buf.writeInt(this.keepAlive); buf.writeBoolean(this.groupsEnabled); buf.writeUtf(this.voiceHost); buf.writeBoolean(this.allowRecording); } }