Delivery enum
Пакет: com.hypixel.hytale.server.core.modules.voice
Файл: com/hypixel/hytale/server/core/modules/voice/PlayerVoiceFrame.java
Поля (1)
| Модификаторы | Тип | Имя |
|---|---|---|
|
NONE,
PROXIMITY, |
EXPLICIT |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.core.modules.voice;
class="kw">import com.hypixel.hytale.server.core.universe.PlayerRef;
class="kw">import java.util.Collection;
class="kw">import java.util.HashSet;
class="kw">import java.util.Set;
class="kw">import java.util.UUID;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">import org.joml.Vector3d;
class="kw">import org.joml.Vector3dc;
class="kw">public class="kw">final class PlayerVoiceFrame {
class="kw">private class="kw">final PlayerRef speaker;
class="kw">private class="kw">final int entityNetworkId;
@Nullable
class="kw">private class="kw">final UUID worldId;
class="kw">private class="kw">final boolean dead;
class="kw">private class="kw">final short sequenceNumber;
class="kw">private class="kw">final int timestamp;
@Nullable
class="kw">private Vector3d position;
class="kw">private boolean underwater;
@Nonnull
class="kw">private byte[] opus;
class="kw">private PlayerVoiceFrame.Delivery delivery;
@Nullable
class="kw">private Set<UUID> allowedListeners;
@Nullable
class="kw">private Set<UUID> excludedListeners;
@Nullable
class="kw">private Collection<UUID> explicitListeners;
PlayerVoiceFrame(@Nonnull PlayerRef var1, @Nullable VoiceModule.PositionSnapshot var2, boolean var3, @Nonnull byte[] var4, short var5, int var6) {
this.speaker = var1;
this.dead = var3;
this.opus = var4;
this.sequenceNumber = var5;
this.timestamp = var6;
if (var2 != null) {
this.position = new Vector3d(var2.position());
this.underwater = var2.isUnderwater();
this.worldId = var2.worldId();
this.entityNetworkId = var2.networkId();
} else {
this.worldId = null;
this.entityNetworkId = 0;
}
this.delivery = var3 ? PlayerVoiceFrame.Delivery.NONE : PlayerVoiceFrame.Delivery.PROXIMITY;
}
@Nonnull
class="kw">public PlayerRef speaker() {
class="kw">return this.speaker;
}
@Nullable
class="kw">public UUID worldId() {
class="kw">return this.worldId;
}
class="kw">public int entityNetworkId() {
class="kw">return this.entityNetworkId;
}
class="kw">public short sequenceNumber() {
class="kw">return this.sequenceNumber;
}
class="kw">public int timestamp() {
class="kw">return this.timestamp;
}
class="kw">public boolean speakerDead() {
class="kw">return this.dead;
}
@Nullable
class="kw">public Vector3dc position() {
class="kw">return this.position;
}
class="kw">public boolean underwater() {
class="kw">return this.underwater;
}
@Nonnull
class="kw">public byte[] opus() {
class="kw">return this.opus;
}
class="kw">public void setPosition(@Nonnull Vector3dc var1) {
if (!var1.isFinite()) {
throw new IllegalArgumentException("Voice position must be finite, got " + var1);
}
this.position = new Vector3d(var1);
}
class="kw">public void setUnderwater(boolean var1) {
this.underwater = var1;
}
class="kw">public void setOpus(@Nonnull byte[] var1) {
if (var1.length != 0 && var1.length <= 512) {
this.opus = var1;
} else {
throw new IllegalArgumentException("Opus frame must be 1 to 512 bytes, got " + var1.length);
}
}
class="kw">public void drop() {
this.delivery = PlayerVoiceFrame.Delivery.NONE;
}
class="kw">public void deliverByProximity() {
this.delivery = PlayerVoiceFrame.Delivery.PROXIMITY;
this.allowedListeners = null;
this.excludedListeners = null;
}
class="kw">public void restrictProximityTo(@Nonnull Set<UUID> var1) {
this.delivery = PlayerVoiceFrame.Delivery.PROXIMITY;
this.allowedListeners = var1;
}
class="kw">public void excludeListener(@Nonnull UUID var1) {
if (this.excludedListeners == null) {
this.excludedListeners = new HashSet<>();
}
this.excludedListeners.add(var1);
}
class="kw">public void deliverTo(@Nonnull Collection<UUID> var1) {
this.delivery = PlayerVoiceFrame.Delivery.EXPLICIT;
this.explicitListeners = var1;
}
@Nonnull
UUID speakerId() {
class="kw">return this.speaker.getUuid();
}
@Nonnull
PlayerVoiceFrame.Delivery delivery() {
class="kw">return this.delivery;
}
@Nullable
Set<UUID> allowedListeners() {
class="kw">return this.allowedListeners;
}
@Nullable
Set<UUID> excludedListeners() {
class="kw">return this.excludedListeners;
}
@Nonnull
Collection<UUID> explicitListeners() {
class="kw">return this.explicitListeners == null ? Set.of() : this.explicitListeners;
}
enum Delivery {
NONE,
PROXIMITY,
EXPLICIT;
Delivery() {
}
}
}