Files
AsminVoicechat/source/decompiled/de/maxhenkel/voicechat/plugins/impl/audiochannel/StaticAudioChannelImpl.java
T
asminme bbccd4a815
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
first commit
2026-10-24 15:18:03 +02:00

114 lines
3.8 KiB
Java

/*
* Decompiled with CFR 0.152.
*
* Could not load the following classes:
* org.bukkit.Bukkit
* org.bukkit.entity.Player
*/
package de.maxhenkel.voicechat.plugins.impl.audiochannel;
import de.maxhenkel.voicechat.api.VoicechatConnection;
import de.maxhenkel.voicechat.api.audiochannel.StaticAudioChannel;
import de.maxhenkel.voicechat.api.packets.MicrophonePacket;
import de.maxhenkel.voicechat.plugins.impl.ServerPlayerImpl;
import de.maxhenkel.voicechat.plugins.impl.VoicechatServerApiImpl;
import de.maxhenkel.voicechat.plugins.impl.audiochannel.AudioChannelImpl;
import de.maxhenkel.voicechat.voice.common.GroupSoundPacket;
import de.maxhenkel.voicechat.voice.server.ClientConnection;
import de.maxhenkel.voicechat.voice.server.Group;
import de.maxhenkel.voicechat.voice.server.Server;
import de.maxhenkel.voicechat.voice.server.ServerGroupManager;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
public class StaticAudioChannelImpl
extends AudioChannelImpl
implements StaticAudioChannel {
protected boolean bypassGroupIsolation;
protected final Set<UUID> targets = new HashSet<UUID>();
public StaticAudioChannelImpl(UUID channelId, Server server) {
super(channelId, server);
}
@Override
public void send(byte[] opusData) {
this.broadcast(new GroupSoundPacket(this.channelId, this.channelId, opusData, this.sequenceNumber.getAndIncrement(), this.category));
}
@Override
public void send(MicrophonePacket packet) {
this.send(packet.getOpusEncodedData());
}
@Override
public void flush() {
GroupSoundPacket packet = new GroupSoundPacket(this.channelId, this.channelId, new byte[0], this.sequenceNumber.getAndIncrement(), this.category);
this.broadcast(packet);
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
*/
private void broadcast(GroupSoundPacket packet) {
Set<UUID> set = this.targets;
synchronized (set) {
ServerGroupManager groupManager = this.server.getGroupManager();
for (UUID target : this.targets) {
Group playerGroup;
Player player;
ClientConnection connection = this.server.getConnection(target);
if (connection == null || (player = Bukkit.getPlayer((UUID)target)) == null || !this.bypassGroupIsolation && (playerGroup = groupManager.getPlayerGroup(player)) != null && playerGroup.isIsolated() || this.filter != null && !this.filter.test(new ServerPlayerImpl(player))) continue;
VoicechatServerApiImpl.sendPacket(player, packet);
}
}
}
@Override
public void setBypassGroupIsolation(boolean bypassGroupIsolation) {
this.bypassGroupIsolation = bypassGroupIsolation;
}
@Override
public boolean bypassesGroupIsolation() {
return this.bypassGroupIsolation;
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
*/
@Override
public void addTarget(VoicechatConnection target) {
Set<UUID> set = this.targets;
synchronized (set) {
this.targets.add(target.getPlayer().getUuid());
}
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
*/
@Override
public void removeTarget(VoicechatConnection target) {
Set<UUID> set = this.targets;
synchronized (set) {
this.targets.remove(target.getPlayer().getUuid());
}
}
/*
* WARNING - Removed try catching itself - possible behaviour change.
*/
@Override
public void clearTargets() {
Set<UUID> set = this.targets;
synchronized (set) {
this.targets.clear();
}
}
}