Geyser icon indicating copy to clipboard operation
Geyser copied to clipboard

Send event when Geyser shows other player to client

Open tomhmagic opened this issue 3 months ago • 0 comments

What feature do you want to see added?

Send off an event when Geyser shows/spawns a player for the client to return both connections in the API

I made something similar using ProtocolLib and listening to their spawnEntity packet, filtering if it was a player and then sending both players to this event. However it would be nice to handle this with connections being passed through.

public class PlayerEnterRenderEvent extends Event {
    private static final HandlerList handlers = new HandlerList();
    private final Player observer;
    private final Player enteringPlayer;

    public PlayerEnterRenderEvent(Player observer, Player enteringPlayer) {
        this.observer = observer;
        this.enteringPlayer = enteringPlayer;
    }

    public Player getObserver() {
        return observer;
    }

    public Player getEnteringPlayer() {
        return enteringPlayer;
    }

    @Override
    public HandlerList getHandlers() {
        return handlers;
    }

    public static HandlerList getHandlerList() {
        return handlers;
    }
}

Are there any alternatives?

As above I've created my own Bukkit version using ProtocolLib. However it won't work for Bedrock players as it is called before the client received the player from geyser.

tomhmagic avatar Apr 06 '24 20:04 tomhmagic