first commit
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
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
This commit is contained in:
commit
bbccd4a815
454 files changed
+45050
No files matched your search
+192
@@ -0,0 +1,192 @@
|
||||
/*
|
||||
* 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.Position;
|
||||
import de.maxhenkel.voicechat.api.packets.ConvertablePacket;
|
||||
import de.maxhenkel.voicechat.api.packets.EntitySoundPacket;
|
||||
import de.maxhenkel.voicechat.api.packets.LocationalSoundPacket;
|
||||
import de.maxhenkel.voicechat.api.packets.SoundPacket;
|
||||
import de.maxhenkel.voicechat.api.packets.StaticSoundPacket;
|
||||
import de.maxhenkel.voicechat.plugins.impl.PositionImpl;
|
||||
import de.maxhenkel.voicechat.plugins.impl.packets.EntitySoundPacketImpl;
|
||||
import de.maxhenkel.voicechat.plugins.impl.packets.LocationalSoundPacketImpl;
|
||||
import de.maxhenkel.voicechat.plugins.impl.packets.StaticSoundPacketImpl;
|
||||
import de.maxhenkel.voicechat.voice.common.GroupSoundPacket;
|
||||
import de.maxhenkel.voicechat.voice.common.LocationSoundPacket;
|
||||
import de.maxhenkel.voicechat.voice.common.PlayerSoundPacket;
|
||||
import de.maxhenkel.voicechat.voice.common.Utils;
|
||||
import java.util.UUID;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class ConvertablePacketImpl
|
||||
implements ConvertablePacket {
|
||||
@Override
|
||||
public EntitySoundPacket.Builder<?> entitySoundPacketBuilder() {
|
||||
return new GenericEntitySoundPacketBuilder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LocationalSoundPacket.Builder<?> locationalSoundPacketBuilder() {
|
||||
return new GenericLocationalSoundPacketBuilder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public StaticSoundPacket.Builder<?> staticSoundPacketBuilder() {
|
||||
return new GenericStaticSoundPacketBuilder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntitySoundPacket toEntitySoundPacket(UUID entityUuid, boolean whispering) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LocationalSoundPacket toLocationalSoundPacket(Position position) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public StaticSoundPacket toStaticSoundPacket() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public static class GenericEntitySoundPacketBuilder
|
||||
extends GenericSoundPacketBuilder<GenericEntitySoundPacketBuilder, EntitySoundPacket>
|
||||
implements EntitySoundPacket.Builder<GenericEntitySoundPacketBuilder> {
|
||||
protected UUID entityUuid;
|
||||
protected boolean whispering;
|
||||
protected Float distance;
|
||||
|
||||
@Override
|
||||
public GenericEntitySoundPacketBuilder entityUuid(UUID entityUuid) {
|
||||
this.entityUuid = entityUuid;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GenericEntitySoundPacketBuilder whispering(boolean whispering) {
|
||||
this.whispering = whispering;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GenericEntitySoundPacketBuilder distance(float distance) {
|
||||
this.distance = Float.valueOf(distance);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntitySoundPacket build() {
|
||||
this.checkRequiredFields();
|
||||
if (this.entityUuid == null) {
|
||||
throw new IllegalStateException("Entity UUID must be set");
|
||||
}
|
||||
if (this.distance == null) {
|
||||
this.distance = Float.valueOf(Utils.getDefaultDistance());
|
||||
}
|
||||
return new EntitySoundPacketImpl(new PlayerSoundPacket(this.channelId, this.entityUuid, this.opusEncodedData, this.sequenceNumber, this.whispering, this.distance.floatValue(), this.category));
|
||||
}
|
||||
}
|
||||
|
||||
public static class GenericLocationalSoundPacketBuilder
|
||||
extends GenericSoundPacketBuilder<GenericLocationalSoundPacketBuilder, LocationalSoundPacket>
|
||||
implements LocationalSoundPacket.Builder<GenericLocationalSoundPacketBuilder> {
|
||||
protected PositionImpl position;
|
||||
protected Float distance;
|
||||
|
||||
@Override
|
||||
public GenericLocationalSoundPacketBuilder position(Position position) {
|
||||
this.position = (PositionImpl)position;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GenericLocationalSoundPacketBuilder distance(float distance) {
|
||||
this.distance = Float.valueOf(distance);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LocationalSoundPacket build() {
|
||||
this.checkRequiredFields();
|
||||
if (this.position == null) {
|
||||
throw new IllegalStateException("Position must be set");
|
||||
}
|
||||
if (this.distance == null) {
|
||||
this.distance = Float.valueOf(Utils.getDefaultDistance());
|
||||
}
|
||||
return new LocationalSoundPacketImpl(new LocationSoundPacket(this.channelId, this.sender, this.position.getPosition(), this.opusEncodedData, this.sequenceNumber, this.distance.floatValue(), this.category));
|
||||
}
|
||||
}
|
||||
|
||||
public static class GenericStaticSoundPacketBuilder
|
||||
extends GenericSoundPacketBuilder<GenericStaticSoundPacketBuilder, StaticSoundPacket>
|
||||
implements StaticSoundPacket.Builder<GenericStaticSoundPacketBuilder> {
|
||||
@Override
|
||||
public StaticSoundPacket build() {
|
||||
return new StaticSoundPacketImpl(new GroupSoundPacket(this.channelId, this.sender, this.opusEncodedData, this.sequenceNumber, this.category));
|
||||
}
|
||||
}
|
||||
|
||||
public static abstract class GenericSoundPacketBuilder<T extends SoundPacket.Builder<T, P>, P extends SoundPacket>
|
||||
implements SoundPacket.Builder<T, P> {
|
||||
@Nullable
|
||||
protected UUID channelId;
|
||||
@Nullable
|
||||
protected UUID sender;
|
||||
@Nullable
|
||||
protected byte[] opusEncodedData;
|
||||
@Nullable
|
||||
protected Long sequenceNumber;
|
||||
@Nullable
|
||||
protected String category;
|
||||
|
||||
@Override
|
||||
public T channelId(UUID channelId) {
|
||||
this.channelId = channelId;
|
||||
return (T)this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T sender(UUID sender) {
|
||||
this.sender = sender;
|
||||
return (T)this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T opusEncodedData(byte[] data) {
|
||||
this.opusEncodedData = data;
|
||||
return (T)this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T sequenceNumber(long sequenceNumber) {
|
||||
this.sequenceNumber = sequenceNumber;
|
||||
return (T)this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T category(@Nullable String category) {
|
||||
this.category = category;
|
||||
return (T)this;
|
||||
}
|
||||
|
||||
public void checkRequiredFields() {
|
||||
if (this.channelId == null) {
|
||||
throw new IllegalStateException("Channel id must be set");
|
||||
}
|
||||
if (this.sequenceNumber == null) {
|
||||
throw new IllegalStateException("Sequence number must be set");
|
||||
}
|
||||
if (this.opusEncodedData == null) {
|
||||
throw new IllegalStateException("Opus encoded data must be set");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* 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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* 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.Position;
|
||||
import de.maxhenkel.voicechat.api.packets.LocationalSoundPacket;
|
||||
import de.maxhenkel.voicechat.plugins.impl.PositionImpl;
|
||||
import de.maxhenkel.voicechat.plugins.impl.packets.EntitySoundPacketImpl;
|
||||
import de.maxhenkel.voicechat.plugins.impl.packets.SoundPacketImpl;
|
||||
import de.maxhenkel.voicechat.voice.common.LocationSoundPacket;
|
||||
import de.maxhenkel.voicechat.voice.common.Utils;
|
||||
import java.util.UUID;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class LocationalSoundPacketImpl
|
||||
extends SoundPacketImpl
|
||||
implements LocationalSoundPacket {
|
||||
private final LocationSoundPacket packet;
|
||||
private final PositionImpl position;
|
||||
|
||||
public LocationalSoundPacketImpl(LocationSoundPacket packet) {
|
||||
super(packet);
|
||||
this.packet = packet;
|
||||
this.position = new PositionImpl(packet.getLocation());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Position getPosition() {
|
||||
return this.position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDistance() {
|
||||
return this.packet.getDistance();
|
||||
}
|
||||
|
||||
public LocationSoundPacket getPacket() {
|
||||
return this.packet;
|
||||
}
|
||||
|
||||
public static class BuilderImpl
|
||||
extends SoundPacketImpl.BuilderImpl<BuilderImpl, LocationalSoundPacket>
|
||||
implements LocationalSoundPacket.Builder<BuilderImpl> {
|
||||
protected PositionImpl position;
|
||||
protected float distance;
|
||||
|
||||
public BuilderImpl(SoundPacketImpl soundPacket) {
|
||||
super(soundPacket);
|
||||
if (soundPacket instanceof LocationalSoundPacketImpl) {
|
||||
LocationalSoundPacketImpl p = (LocationalSoundPacketImpl)soundPacket;
|
||||
this.position = p.position;
|
||||
this.distance = p.getDistance();
|
||||
} else {
|
||||
this.distance = soundPacket instanceof EntitySoundPacketImpl ? ((EntitySoundPacketImpl)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 position(Position position) {
|
||||
this.position = (PositionImpl)position;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BuilderImpl distance(float distance) {
|
||||
this.distance = distance;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LocationalSoundPacket build() {
|
||||
if (this.position == null) {
|
||||
throw new IllegalStateException("position missing");
|
||||
}
|
||||
return new LocationalSoundPacketImpl(new LocationSoundPacket(this.channelId, this.sender, this.position.getPosition(), this.opusEncodedData, this.sequenceNumber, this.distance, this.category));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.152.
|
||||
*/
|
||||
package de.maxhenkel.voicechat.plugins.impl.packets;
|
||||
|
||||
import de.maxhenkel.voicechat.api.Position;
|
||||
import de.maxhenkel.voicechat.api.packets.EntitySoundPacket;
|
||||
import de.maxhenkel.voicechat.api.packets.LocationalSoundPacket;
|
||||
import de.maxhenkel.voicechat.api.packets.MicrophonePacket;
|
||||
import de.maxhenkel.voicechat.api.packets.StaticSoundPacket;
|
||||
import de.maxhenkel.voicechat.plugins.impl.PositionImpl;
|
||||
import de.maxhenkel.voicechat.plugins.impl.packets.EntitySoundPacketImpl;
|
||||
import de.maxhenkel.voicechat.plugins.impl.packets.LocationalSoundPacketImpl;
|
||||
import de.maxhenkel.voicechat.plugins.impl.packets.StaticSoundPacketImpl;
|
||||
import de.maxhenkel.voicechat.voice.common.GroupSoundPacket;
|
||||
import de.maxhenkel.voicechat.voice.common.LocationSoundPacket;
|
||||
import de.maxhenkel.voicechat.voice.common.MicPacket;
|
||||
import de.maxhenkel.voicechat.voice.common.PlayerSoundPacket;
|
||||
import de.maxhenkel.voicechat.voice.common.Utils;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
public class MicrophonePacketImpl
|
||||
implements MicrophonePacket {
|
||||
private final MicPacket packet;
|
||||
private final UUID sender;
|
||||
|
||||
public MicrophonePacketImpl(MicPacket packet, UUID sender) {
|
||||
this.packet = packet;
|
||||
this.sender = sender;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWhispering() {
|
||||
return this.packet.isWhispering();
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getOpusEncodedData() {
|
||||
return this.packet.getData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOpusEncodedData(byte[] data) {
|
||||
this.packet.setData(Objects.requireNonNull(data));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntitySoundPacket.Builder<?> entitySoundPacketBuilder() {
|
||||
return new EntitySoundPacketImpl.BuilderImpl(this.sender, this.sender, this.packet.getData(), this.packet.getSequenceNumber(), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LocationalSoundPacket.Builder<?> locationalSoundPacketBuilder() {
|
||||
return new LocationalSoundPacketImpl.BuilderImpl(this.sender, this.sender, this.packet.getData(), this.packet.getSequenceNumber(), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StaticSoundPacket.Builder<?> staticSoundPacketBuilder() {
|
||||
return new StaticSoundPacketImpl.BuilderImpl(this.sender, this.sender, this.packet.getData(), this.packet.getSequenceNumber(), null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public EntitySoundPacket toEntitySoundPacket(UUID entityUuid, boolean whispering) {
|
||||
return new EntitySoundPacketImpl(new PlayerSoundPacket(this.sender, entityUuid, this.packet.getData(), this.packet.getSequenceNumber(), whispering, Utils.getDefaultDistance(), null));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public LocationalSoundPacket toLocationalSoundPacket(Position position) {
|
||||
if (position instanceof PositionImpl) {
|
||||
return new LocationalSoundPacketImpl(new LocationSoundPacket(this.sender, this.sender, ((PositionImpl)position).getPosition(), this.packet.getData(), this.packet.getSequenceNumber(), Utils.getDefaultDistance(), null));
|
||||
}
|
||||
throw new IllegalArgumentException("position is not an instance of PositionImpl");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public StaticSoundPacket toStaticSoundPacket() {
|
||||
return new StaticSoundPacketImpl(new GroupSoundPacket(this.sender, this.sender, this.packet.getData(), this.packet.getSequenceNumber(), null));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,166 @@
|
||||
/*
|
||||
* 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.Position;
|
||||
import de.maxhenkel.voicechat.api.packets.EntitySoundPacket;
|
||||
import de.maxhenkel.voicechat.api.packets.LocationalSoundPacket;
|
||||
import de.maxhenkel.voicechat.api.packets.SoundPacket;
|
||||
import de.maxhenkel.voicechat.api.packets.StaticSoundPacket;
|
||||
import de.maxhenkel.voicechat.plugins.impl.PositionImpl;
|
||||
import de.maxhenkel.voicechat.plugins.impl.packets.EntitySoundPacketImpl;
|
||||
import de.maxhenkel.voicechat.plugins.impl.packets.LocationalSoundPacketImpl;
|
||||
import de.maxhenkel.voicechat.plugins.impl.packets.StaticSoundPacketImpl;
|
||||
import de.maxhenkel.voicechat.voice.common.GroupSoundPacket;
|
||||
import de.maxhenkel.voicechat.voice.common.LocationSoundPacket;
|
||||
import de.maxhenkel.voicechat.voice.common.PlayerSoundPacket;
|
||||
import de.maxhenkel.voicechat.voice.common.SoundPacket;
|
||||
import de.maxhenkel.voicechat.voice.common.Utils;
|
||||
import java.util.UUID;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class SoundPacketImpl
|
||||
implements de.maxhenkel.voicechat.api.packets.SoundPacket {
|
||||
private final SoundPacket<?> packet;
|
||||
|
||||
public SoundPacketImpl(SoundPacket<?> packet) {
|
||||
this.packet = packet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getChannelId() {
|
||||
return this.packet.getChannelId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getSender() {
|
||||
return this.packet.getSender();
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getOpusEncodedData() {
|
||||
return this.packet.getData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getSequenceNumber() {
|
||||
return this.packet.getSequenceNumber();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getCategory() {
|
||||
return this.packet.getCategory();
|
||||
}
|
||||
|
||||
public SoundPacket<?> getPacket() {
|
||||
return this.packet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntitySoundPacket.Builder<?> entitySoundPacketBuilder() {
|
||||
return new EntitySoundPacketImpl.BuilderImpl(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LocationalSoundPacket.Builder<?> locationalSoundPacketBuilder() {
|
||||
return new LocationalSoundPacketImpl.BuilderImpl(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StaticSoundPacket.Builder<?> staticSoundPacketBuilder() {
|
||||
return new StaticSoundPacketImpl.BuilderImpl(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntitySoundPacket toEntitySoundPacket(UUID entityUuid, boolean whispering) {
|
||||
return new EntitySoundPacketImpl(new PlayerSoundPacket(this.packet.getChannelId(), entityUuid, this.packet.getData(), this.packet.getSequenceNumber(), whispering, this.getDistance(), null));
|
||||
}
|
||||
|
||||
@Override
|
||||
public LocationalSoundPacket toLocationalSoundPacket(Position position) {
|
||||
if (position instanceof PositionImpl) {
|
||||
return new LocationalSoundPacketImpl(new LocationSoundPacket(this.packet.getChannelId(), this.packet.getSender(), ((PositionImpl)position).getPosition(), this.packet.getData(), this.packet.getSequenceNumber(), this.getDistance(), null));
|
||||
}
|
||||
throw new IllegalArgumentException("position is not an instance of PositionImpl");
|
||||
}
|
||||
|
||||
private float getDistance() {
|
||||
if (this instanceof EntitySoundPacket) {
|
||||
return ((EntitySoundPacket)((Object)this)).getDistance();
|
||||
}
|
||||
if (this instanceof LocationalSoundPacket) {
|
||||
return ((LocationalSoundPacket)((Object)this)).getDistance();
|
||||
}
|
||||
return Utils.getDefaultDistance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public StaticSoundPacket toStaticSoundPacket() {
|
||||
return new StaticSoundPacketImpl(new GroupSoundPacket(this.packet.getChannelId(), this.packet.getSender(), this.packet.getData(), this.packet.getSequenceNumber(), null));
|
||||
}
|
||||
|
||||
public static abstract class BuilderImpl<T extends BuilderImpl<T, P>, P extends de.maxhenkel.voicechat.api.packets.SoundPacket>
|
||||
implements SoundPacket.Builder<T, P> {
|
||||
protected UUID channelId;
|
||||
protected UUID sender;
|
||||
protected byte[] opusEncodedData;
|
||||
protected long sequenceNumber;
|
||||
@Nullable
|
||||
protected String category;
|
||||
|
||||
public BuilderImpl(SoundPacketImpl soundPacket) {
|
||||
this.channelId = soundPacket.getChannelId();
|
||||
this.sender = soundPacket.getSender();
|
||||
this.opusEncodedData = soundPacket.getOpusEncodedData();
|
||||
this.sequenceNumber = soundPacket.getSequenceNumber();
|
||||
this.category = soundPacket.getCategory();
|
||||
}
|
||||
|
||||
public BuilderImpl(UUID channelId, UUID sender, byte[] opusEncodedData, long sequenceNumber, @Nullable String category) {
|
||||
this.channelId = channelId;
|
||||
this.sender = sender;
|
||||
this.opusEncodedData = opusEncodedData;
|
||||
this.sequenceNumber = sequenceNumber;
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T channelId(UUID channelId) {
|
||||
if (channelId == null) {
|
||||
throw new IllegalArgumentException("channelId can't be null");
|
||||
}
|
||||
this.channelId = channelId;
|
||||
return (T)this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T sender(UUID sender) {
|
||||
this.sender = sender;
|
||||
return (T)this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T opusEncodedData(byte[] data) {
|
||||
this.opusEncodedData = data;
|
||||
return (T)this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T sequenceNumber(long sequenceNumber) {
|
||||
this.sequenceNumber = sequenceNumber;
|
||||
return (T)this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T category(@Nullable String category) {
|
||||
this.category = category;
|
||||
return (T)this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* 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.StaticSoundPacket;
|
||||
import de.maxhenkel.voicechat.plugins.impl.packets.SoundPacketImpl;
|
||||
import de.maxhenkel.voicechat.voice.common.GroupSoundPacket;
|
||||
import java.util.UUID;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class StaticSoundPacketImpl
|
||||
extends SoundPacketImpl
|
||||
implements StaticSoundPacket {
|
||||
public StaticSoundPacketImpl(GroupSoundPacket packet) {
|
||||
super(packet);
|
||||
}
|
||||
|
||||
public static class BuilderImpl
|
||||
extends SoundPacketImpl.BuilderImpl<BuilderImpl, StaticSoundPacket>
|
||||
implements StaticSoundPacket.Builder<BuilderImpl> {
|
||||
public BuilderImpl(SoundPacketImpl soundPacket) {
|
||||
super(soundPacket);
|
||||
}
|
||||
|
||||
public BuilderImpl(UUID channelId, UUID sender, byte[] opusEncodedData, long sequenceNumber, @Nullable String category) {
|
||||
super(channelId, sender, opusEncodedData, sequenceNumber, category);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StaticSoundPacket build() {
|
||||
return new StaticSoundPacketImpl(new GroupSoundPacket(this.channelId, this.sender, this.opusEncodedData, this.sequenceNumber, this.category));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user