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

Add ProtocolChangedEvent to the API #3591

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

Outfluencer
Copy link
Contributor

ProtocolChangedEvent is called when the encode or decode protocol of any Connection is changed.

We now can detect if a 1.20.4 player is changing protocol to config or play via API, but it is also possible to detect if the InitialHandler changes protocol from Handshake to Status or Login

@Outfluencer
Copy link
Contributor Author

Bump

import net.md_5.bungee.protocol.Protocol;

/**
* Called when the encode or decode protocol of a {@link Connection} is changed.

This comment was marked as resolved.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

version notice for what?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uhm I was wrong, I only thought this was related to 1.20.2+ somehow

@Janmm14
Copy link
Contributor

Janmm14 commented Apr 16, 2024

If the connection of the event is a server, I am quite sure it is impossible by API to find out to which user the server connection belongs to.

@Outfluencer
Copy link
Contributor Author

If the connection of the event is a server, I am quite sure it is impossible by API to find out to which user the server connection belongs to.

thats right

@Outfluencer
Copy link
Contributor Author

If the connection of the event is a server, I am quite sure it is impossible by API to find out to which user the server connection belongs to.

i'll add api for that

@Outfluencer
Copy link
Contributor Author

Outfluencer commented Apr 16, 2024

do you think we could just add
ProxiedPlayer getPlayer();

in Server.java?

the current docs would need a change,
in the current api design we would need to do this to get the Player of a Server

ProxiedPlayer player = server.getInfo().getPlayers().stream().filter( ( p ) -> ( p.getServer() == server ) ).findAny().get();

@Janmm14
Copy link
Contributor

Janmm14 commented Apr 16, 2024

do you think we could just add ProxiedPlayer getPlayer();

in Server.java?

the current docs would need a change, in the current api design we would need to do this to get the Player of a Server

ProxiedPlayer player = server.getInfo().getPlayers().stream().filter( ( p ) -> ( p.getServer() == server ) ).findAny().get();

Sounds like a valid option to me, could maybe also help certain applications of Server<->Bungee plugin messages.
I would name the method something like getConnectedPlayer() tho, to not get confused too easily as to what the class represents.

@Outfluencer
Copy link
Contributor Author

I don't like getConnectedPlayer as the player can connect to another server and is not connected anymore, but the api would return the player, also returning null if the player is disconnected seems like a bad idea for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants