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
103 lines
3.2 KiB
Java
103 lines
3.2 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*
|
|
* Could not load the following classes:
|
|
* javax.annotation.Nullable
|
|
*/
|
|
package de.maxhenkel.voicechat.plugins.impl.packets;
|
|
|
|
import de.maxhenkel.voicechat.api.packets.EntitySoundPacket;
|
|
import de.maxhenkel.voicechat.plugins.impl.packets.LocationalSoundPacketImpl;
|
|
import de.maxhenkel.voicechat.plugins.impl.packets.SoundPacketImpl;
|
|
import de.maxhenkel.voicechat.voice.common.PlayerSoundPacket;
|
|
import de.maxhenkel.voicechat.voice.common.Utils;
|
|
import java.util.UUID;
|
|
import javax.annotation.Nullable;
|
|
|
|
public class EntitySoundPacketImpl
|
|
extends SoundPacketImpl
|
|
implements EntitySoundPacket {
|
|
private final PlayerSoundPacket packet;
|
|
|
|
public EntitySoundPacketImpl(PlayerSoundPacket packet) {
|
|
super(packet);
|
|
this.packet = packet;
|
|
}
|
|
|
|
@Override
|
|
public UUID getEntityUuid() {
|
|
return this.packet.getSender();
|
|
}
|
|
|
|
@Override
|
|
public boolean isWhispering() {
|
|
return this.packet.isWhispering();
|
|
}
|
|
|
|
@Override
|
|
public float getDistance() {
|
|
return this.packet.getDistance();
|
|
}
|
|
|
|
public PlayerSoundPacket getPacket() {
|
|
return this.packet;
|
|
}
|
|
|
|
@Override
|
|
public UUID getChannelId() {
|
|
return this.packet.getChannelId();
|
|
}
|
|
|
|
public static class BuilderImpl
|
|
extends SoundPacketImpl.BuilderImpl<BuilderImpl, EntitySoundPacket>
|
|
implements EntitySoundPacket.Builder<BuilderImpl> {
|
|
protected UUID entityUuid;
|
|
protected boolean whispering;
|
|
protected float distance;
|
|
|
|
public BuilderImpl(SoundPacketImpl soundPacket) {
|
|
super(soundPacket);
|
|
if (soundPacket instanceof EntitySoundPacketImpl) {
|
|
EntitySoundPacketImpl p = (EntitySoundPacketImpl)soundPacket;
|
|
this.entityUuid = p.getEntityUuid();
|
|
this.whispering = p.isWhispering();
|
|
this.distance = p.getDistance();
|
|
} else {
|
|
this.distance = soundPacket instanceof LocationalSoundPacketImpl ? ((LocationalSoundPacketImpl)soundPacket).getDistance() : Utils.getDefaultDistance();
|
|
}
|
|
}
|
|
|
|
public BuilderImpl(UUID channelId, UUID sender, byte[] opusEncodedData, long sequenceNumber, @Nullable String category) {
|
|
super(channelId, sender, opusEncodedData, sequenceNumber, category);
|
|
this.distance = Utils.getDefaultDistance();
|
|
}
|
|
|
|
@Override
|
|
public BuilderImpl entityUuid(UUID entityUuid) {
|
|
this.entityUuid = entityUuid;
|
|
return this;
|
|
}
|
|
|
|
@Override
|
|
public BuilderImpl whispering(boolean whispering) {
|
|
this.whispering = whispering;
|
|
return this;
|
|
}
|
|
|
|
@Override
|
|
public BuilderImpl distance(float distance) {
|
|
this.distance = distance;
|
|
return this;
|
|
}
|
|
|
|
@Override
|
|
public EntitySoundPacket build() {
|
|
if (this.entityUuid == null) {
|
|
throw new IllegalStateException("entityUuid missing");
|
|
}
|
|
return new EntitySoundPacketImpl(new PlayerSoundPacket(this.channelId, this.entityUuid, this.opusEncodedData, this.sequenceNumber, this.whispering, this.distance, this.category));
|
|
}
|
|
}
|
|
}
|
|
|