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
123 lines
3.4 KiB
Java
123 lines
3.4 KiB
Java
/*
|
|
* 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<SecretPacket> {
|
|
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);
|
|
}
|
|
}
|
|
|