Syrent / SayanVanish

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

[bungee] sync event fires between platforms #324

Closed jehendeoff closed 2 months ago

jehendeoff commented 3 months ago

Hi again, I created a very simple test plugin to listen to sayan vanish's event (on bungeecord), but I can't manage to get it to fire, is that normal or just misconfiguration ? here's the (bungeecord) class where the event happens (I did getProxy().getPluginManager().registerListener(this, new VanishEvent());) VanishEvent.class

public class VanishEvent implements Listener {
    public VanishEvent(){
    }

    @EventHandler
    private void onBungeeUserVanishEvent(BungeeUserVanishEvent event) {
        System.out.println("VANISH"); //never seen on bungeecord's console
    }
    @EventHandler
    private void onBungeeUserUnVanishEvent(BungeeUserUnVanishEvent event) {
        System.out.println("UNVANISH"); //never seen on bungeecord's console either
    }
}

I have configured mysql and redis on my backend (paper) and front-end (bungeecord) database.yml

method: SQL
sql:
    method: MYSQL
    host: 192.168.0.100
    port: 3306
    database: sayanvanish
    username: sayanvanish
    password: REDACTED
    pool-properties:
        maximum-pool-size: 10
        minimum-idle: 10
        maximum-lifetime: 1800000
        keepalive-time: 0
        connection-timeout: 5000
        use-ssl: false
        verify-server-certificate: false
        allow-public-key-retrieval: true
    table-prefix: sayanvanish_
redis:
    type: STANDALONE
    standalone:
        host: 192.168.0.100
        port: 6379
        user: ''
        password: ''
        ssl: false
use-cache-when-available: true

and activated proxy mode in settings.yml

I have no errors in mariadb, redis, bungeecord and paper. I think that the bungeecord plugin isn't communicating with the paper one, I don't know how they should (redis ? plugin message ? mysql ?), nor how to debug this.

if you want me to run some debugging step, I'll be happy to do so

Syrent commented 3 months ago

It will only trigger if the player is vanished through BungeeCord (such as when a plugin uses SayanVanishBungeeAPI to vanish the player). I plan to create a custom event API that operates independently of the platform. This might take a few days as I don't have time to work on it right now.

jehendeoff commented 3 months ago

oh, then if a player is vanishes through bungeecord (/velocity), will it also vanishes the player on paper ? if so, would it be viable to make the /vanish command on the proxy, disable the /vanish command on paper (when in proxy-mode) and trigger the bukkit event when the proxy says to vanish a player ?

Syrent commented 3 months ago

Using the bungee API for player vanishing on backend servers is possible but not generally recommended as the default approach. It introduces complexity with state passing between the proxy and backend servers. However, as a temporary solution to quickly get it working, it's not a bad idea.

Syrent commented 2 months ago

Added sync_events feature in latest 1.3.1 snapshot