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
85 lines
3.3 KiB
Java
85 lines
3.3 KiB
Java
/*
|
|
* 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));
|
|
}
|
|
}
|
|
|