Skip to content
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

Open
envizar opened this issue Jul 28, 2023 · 5 comments
Open

Issue related to vanish #358

envizar opened this issue Jul 28, 2023 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@envizar
Copy link

envizar commented Jul 28, 2023

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

@Apehum Apehum added the bug Something isn't working label Jul 29, 2023
@Apehum Apehum self-assigned this Jul 29, 2023
@Apehum
Copy link
Member

Apehum commented Jul 31, 2023

Should be fixed in prerelease:
https://github.com/plasmoapp/plasmo-voice/releases/tag/2.0.7

@ydal251
Copy link

ydal251 commented Nov 26, 2023

This seems to still be an issue in 2.0.7 and 2.1.0+3821a2f-SNAPSHOT. The vanished player's skin is changed to a default skin, but they are still shown in the volume list. If the player that isn't vanished sends a reload packet with /vrc then the vanished player correctly disappears from their volume list just as if someone was vanished when they first joined the server.
image

It also appears when reappearing from vanish a /vrc needs to be sent by the reappearing player to appear in the volume list again for others

Using Premium Vanish 2.8.13, Paper 1.20.2-297, and Fabric 1.20.2 clients

@Apehum
Copy link
Member

Apehum commented Dec 30, 2023

Hide/show in the volume menu on player vanish/unvanish should be fixed in 2.0.8 prerelease:
https://github.com/plasmoapp/plasmo-voice/releases/tag/2.0.8

@codeHusky
Copy link
Contributor

codeHusky commented Feb 24, 2024

appears to still be an issue on the 2.0.8 prerelease when using EssentialsX @Apehum

@codeHusky
Copy link
Contributor

codeHusky commented Feb 24, 2024

after some closer examination and testing, it seems the current logic for vanish doesn't work.

https://github.com/plasmoapp/plasmo-voice/blob/2c935130b95b8e40c04bcf29336b909255b9ad8d/server/common/src/main/java/su/plo/voice/server/connection/VoiceTcpServerConnectionManager.java#L162C88-L162C106

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants