-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue related to vanish #358
Comments
Should be fixed in prerelease: |
Hide/show in the volume menu on player vanish/unvanish should be fixed in 2.0.8 prerelease: |
appears to still be an issue on the 2.0.8 prerelease when using EssentialsX @Apehum |
after some closer examination and testing, it seems the current logic for vanish doesn't work. This line of code currently sends the player disconnect packet to the person vanishing, which completely breaks their clientside voice connection. The test used is sending the packet if the user can see the vanished user, rather than if the user cannot see the user. This should be reasonably be inverted. Here's code that works at the moment on my server. PaperVoiceLoader loader = (PaperVoiceLoader) Bukkit.getPluginManager().getPlugin("PlasmoVoice");
Field voiceField = PaperVoiceLoader.class.getDeclaredField("voiceServer");
voiceField.setAccessible(true);
PaperVoiceServer voiceServer = (PaperVoiceServer) voiceField.get(loader);
Events.subscribe(VanishStatusChangeEvent.class, EventPriority.MONITOR)
.handler(e -> {
Player relevant = Players.getNullable(e.getAffected().getUUID());
if(relevant == null) return;
VoiceServerPlayer voiceServerPlayer = voiceServer.getPlayerManager().wrap(relevant);
if(!voiceServerPlayer.hasVoiceChat()) return;
if (e.getValue()) {
// newly vanished
Schedulers.sync().runLater(() -> {
voiceServer.getTcpConnectionManager().broadcast(new PlayerDisconnectPacket(voiceServerPlayer.getInstance().getUUID()), (player1) -> {
SubserverTools.getInstance().getLogger().info("Test? " + voiceServerPlayer.getInstance().getName() + " vs " + player1.getInstance().getName());
return !voiceServerPlayer.getInstance().getUUID().equals(player1.getInstance().getUUID()) && !player1.getInstance().canSee(voiceServerPlayer.getInstance());
});
},1L).bindWith(consumer);
} else {
// unvanishing
Schedulers.sync()
.runLater(() -> voiceServer.getTcpConnectionManager().broadcastPlayerInfoUpdate(voiceServerPlayer), 1L)
.bindWith(consumer);
}
}).bindWith(consumer); This isn't entirely foolproof (the behavior makes vanished players disappear from the voice list slightly differently than actual logouts since they get a default skin for a few ms before they disappear) but it's most of the way there. |
When players in vanish join they appear in "players volume" list
Hiding players in "players volume" list work if player joins when already vanished player is playing on server
I use PremiumVanish as vanish plugin
The text was updated successfully, but these errors were encountered: