endstone icon indicating copy to clipboard operation
endstone copied to clipboard

Make fields public for ServerListPingEvent

Open theaddonn opened this issue 1 year ago • 2 comments

This pr just makes some fields public for the ServerListPingEvent. This is helpful since you may want to modify stuff like the port or Minecraft Version shown. This PR is likely missing some stuff since this would also require to change some underlying python bindings, but eh..

Also, any reason we are using .h instead of .hpp?

theaddonn avatar Oct 11 '24 14:10 theaddonn

Codecov Report

Attention: Patch coverage is 12.29630% with 592 lines in your changes missing coverage. Please review.

Project coverage is 8.02%. Comparing base (b8e78c6) to head (219c890). Report is 149 commits behind head on main.

Files with missing lines Patch % Lines
src/endstone_core/ban/player_ban_list.cpp 45.55% 29 Missing and 69 partials :warning:
src/endstone_core/packs/endstone_pack_source.cpp 0.00% 73 Missing :warning:
src/endstone_core/plugin/plugin_manager.cpp 0.00% 45 Missing :warning:
src/endstone_core/command/defaults/ban_command.cpp 0.00% 41 Missing :warning:
src/endstone_core/player.cpp 0.00% 37 Missing :warning:
src/endstone_core/level/level.cpp 0.00% 33 Missing :warning:
src/endstone_core/server.cpp 0.00% 33 Missing :warning:
src/endstone_core/command/command_map.cpp 0.00% 31 Missing :warning:
src/endstone_core/lang/language.cpp 0.00% 27 Missing :warning:
.../endstone_core/command/defaults/pardon_command.cpp 0.00% 26 Missing :warning:
... and 13 more
Additional details and impacted files
@@           Coverage Diff            @@
##            main     #75      +/-   ##
========================================
+ Coverage   7.29%   8.02%   +0.73%     
========================================
  Files         55      62       +7     
  Lines       3071    4384    +1313     
  Branches    1349    1895     +546     
========================================
+ Hits         224     352     +128     
- Misses      2669    3776    +1107     
- Partials     178     256      +78     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Oct 11 '24 14:10 codecov[bot]

This PR instead of making the needed fields public, adds methods to set the local port (ipv4 & pv6) as well as the guid

theaddonn avatar Oct 11 '24 15:10 theaddonn

Thank you for the pull request! These fields were intentionally kept read-only, as modifying these values doesn't affect their appearance in the server list. I am wondering about the practical usage of making these fields writable with these setters?

wu-vincent avatar Oct 16 '24 17:10 wu-vincent

Hey, the reason why local port should be writable as there is a chance for a port mismatch to happen when dealing with proxies. As when the proxy is on one port while the server is on another port the server MOTD ping will container the servers port and not the port of the proxy. This can confuse clients into believing the server does not exist in the server list.

Dingsel avatar Oct 16 '24 18:10 Dingsel

@Dingsel That makes sense to me, although I think the proxy should ideally handle the ping response from backend servers, rather than the backend servers managing it directly. But I assume the proxies aren't that advanced yet.

@theaddonn One more thing before I merge this PR—could you also add the Python bindings for these setters?

wu-vincent avatar Oct 17 '24 12:10 wu-vincent

@wu-vincent The proxy are that advanced, but it introduces a lot more overhead.. which can easily be avoided by just changing the needed data on the backend server directly.

theaddonn avatar Oct 17 '24 13:10 theaddonn