Patch bug with global voice and large amounts of nearby players

This commit is contained in:
ayunami2000 2022-07-26 14:43:47 -04:00
parent e24a5981b8
commit 87c08b886d
4 changed files with 45451 additions and 45604 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1190,15 +1190,11 @@ public class Minecraft implements Runnable {
int prox = 22; int prox = 22;
// cube // cube
if (Math.abs(thePlayer.posX - player.posX) <= prox && Math.abs(thePlayer.posY - player.posY) <= prox && Math.abs(thePlayer.posZ - player.posZ) <= prox) { if (Math.abs(thePlayer.posX - player.posX) <= prox && Math.abs(thePlayer.posY - player.posY) <= prox && Math.abs(thePlayer.posZ - player.posZ) <= prox) {
if (EaglerAdapter.getVoiceChannel() == Voice.VoiceChannel.PROXIMITY) {
EaglerAdapter.addNearbyPlayer(player.username); EaglerAdapter.addNearbyPlayer(player.username);
seenPlayers.add(player.username); seenPlayers.add(player.username);
} else if (EaglerAdapter.getVoiceChannel() == Voice.VoiceChannel.GLOBAL) {
EaglerAdapter.sendVoiceRequestIfNeeded(player.username);
} }
} }
} EaglerAdapter.cleanupNearbyPlayers(seenPlayers);
if (EaglerAdapter.getVoiceChannel() == Voice.VoiceChannel.PROXIMITY) EaglerAdapter.cleanupNearbyPlayers(seenPlayers);
} }
} }

View File

@ -2219,8 +2219,7 @@ public class EaglerAdapterImpl2 {
public static final void addNearbyPlayer(String username) { public static final void addNearbyPlayer(String username) {
recentlyNearbyPlayers.remove(username); recentlyNearbyPlayers.remove(username);
if (nearbyPlayers.add(username)) { if (nearbyPlayers.add(username)) {
if (getVoiceStatus() == Voice.VoiceStatus.DISCONNECTED || getVoiceStatus() == Voice.VoiceStatus.UNAVAILABLE) return; sendVoiceRequestIfNeeded(username);
sendVoiceRequest(username);
} }
} }
@ -2234,7 +2233,7 @@ public class EaglerAdapterImpl2 {
} catch (IOException ignored) { } } catch (IOException ignored) { }
} }
public static final void sendVoiceRequestIfNeeded(String username) { private static final void sendVoiceRequestIfNeeded(String username) {
if (getVoiceStatus() == Voice.VoiceStatus.DISCONNECTED || getVoiceStatus() == Voice.VoiceStatus.UNAVAILABLE) return; if (getVoiceStatus() == Voice.VoiceStatus.DISCONNECTED || getVoiceStatus() == Voice.VoiceStatus.UNAVAILABLE) return;
if (!voiceGains.containsKey(username)) sendVoiceRequest(username); if (!voiceGains.containsKey(username)) sendVoiceRequest(username);
} }
@ -2249,7 +2248,7 @@ public class EaglerAdapterImpl2 {
public static final void removeNearbyPlayer(String username) { public static final void removeNearbyPlayer(String username) {
if (nearbyPlayers.remove(username)) { if (nearbyPlayers.remove(username)) {
if (getVoiceStatus() == Voice.VoiceStatus.DISCONNECTED || getVoiceStatus() == Voice.VoiceStatus.UNAVAILABLE) return; if (getVoiceStatus() == Voice.VoiceStatus.DISCONNECTED || getVoiceStatus() == Voice.VoiceStatus.UNAVAILABLE) return;
recentlyNearbyPlayers.add(username); if (enabledChannel == Voice.VoiceChannel.PROXIMITY) recentlyNearbyPlayers.add(username);
} }
} }