Syrent / SayanVanish

A modular vanish system for Minecraft servers
https://docs.sayandev.org/sayanvanish
67 stars 15 forks source link

PostUnvanishEvent Triggered on Default Users / Vanish State Inconsistent on Switching Servers #99

Closed belphegorspn closed 1 year ago

belphegorspn commented 1 year ago

Server backend version

Purpur 1.19.3 / Pufferfish 1.19.2 / Pufferfish 1.19.3

Server Velocity version

Velocity 3.2.0-SNAPSHOT (git-8a048f05-b220)

VelocityVanish version

3.15.0

Describe the bug

  1. PostUnvanishEvent is triggered to all players every time they join the servers.

  2. Every time a normal user joins the server, they can hear the unvanish sound.

  3. I have also setup an alerts.yml in DiscordSRV to send a message User has Joined the Game when PostUnvanishedEvent is triggered intended to fake broadcast that a staff had just joined the server upon unvanishing themselves. But now, since PostUnvanishedEvent is triggered every time a user joins, It shows double "joined the game" messages.

image

  1. Another issue is that, there is an inconsistency with the vanish state. If I vanish myself on server1, there is a possiblity I will be unvanished in server2. I have done testing, and it only remembers if I left that server vanished or unvanished and it will put me in that state, for example: I left server1 vanished, when I join it I will still be vanished.

Expected behavior

  1. PostUnvanishEvent should only be triggered when a staff does /vanish to unvanishes themselves.

  2. Users should not be able to hear the Unvanish sound.

  3. It should only send a join message on discord when a staff does /vanish to unvanish themselves.

  4. Vanish state should be consistent when switching from server1 to server2 to server3.

Steps to reproduce

For the UnvanishEvent

Step 1: Use the latest VelocityVanish version.

Step 2: Change the sounds to hear the difference when a player vanishes or unvanishes.

  command: ENTITY_EXPERIENCE_ORB_PICKUP
  vanish: BLOCK_BEACON_ACTIVATE
  unvanish: BLOCK_BEACON_DEACTIVATE

Step 3: Join the server with default permission.

Step 4: Observe sounds if you hear BLOCK_BEACON_DEACTIVATE on join then PostUnvanishEvent is triggered.

For the inconsistent vanish state:

Step 1: Have the necessary permission to do /vanish.

Step 2: Be sure you do not have vanish on join permission.

Step 3: Join server 1 then go on vanish.

Step 4: Switch to server 2 and observe if you have the vanish state.

Additional info

No response

Checklist

Syrent commented 1 year ago

I'll try to fix this problem in future updates

Syrent commented 1 year ago

Try using EssentialsX vanish status change event. That may work

  - Trigger: VanishStatusChangeEvent
    Channel: global
    Embed:
      Color: "#808080"
      Author:
        ImageUrl: "https://heads.discordsrv.com/head.png?texture={texture}&uuid=${#event.getAffected().getUUID().toString()}&name=${#event.getAffected().getName()}&overlay"
        Name: '${#event.getAffected().getName() + " is " + (#event.value ? "joined" : "left") + " the server"}'
belphegorspn commented 1 year ago

That wouldn't really work for DiscordSRV's events. The embed color would be both the same for leaving and joining. So, if I fake join it would say I joined on but the embed color would be red. Also, vanishing using VelocityVanish wouldn't trigger that event. I would have to manually do /essentials:vanish for it to show up.

Syrent commented 1 year ago

I think it's fixed in version 3.18.1 https://github.com/Syrent/VelocityVanish/releases/tag/v3.18.1