Aelysium-Group / rusty-connector

A player and server connection manager for Velocity based Minecraft Networks!
GNU General Public License v3.0
77 stars 17 forks source link

Add server locking. #32

Closed TheDeafCreeper closed 1 year ago

TheDeafCreeper commented 1 year ago

This is mostly useful for minigames where you may still want to be able to connect to the server as an admin and/or see the total player count in a family including started games, but don't want players to be put into the server after the game starts.

Currently adds:

TODO:

Once the TODOs are done I'll undraft this, until then feel free to give feedback on implementation/naming.

TheDeafCreeper commented 1 year ago

For the /rc family message I think I'll actually change it from: ---| 1. [Server2](localhost:25567) [0 (XX <> XX) w-0] <<<<< to: ---| 1. [Server2](localhost:25567) [0 (20 <> 30) w-0] xxxxx once I get the load balancers skipping locked servers so that you can still see the player limits.

nathan-i-martin commented 1 year ago

Hmm skipping locked servers could be pretty easily done by just letting the load balancer run, and then immediately afterwards, remove all servers with the locked state (#removeIf() should do the trick if I remember the implementation properly)

TheDeafCreeper commented 1 year ago

Is the list of servers reset every time it runs or would the locked servers have to be added back after getting unlocked?

TheDeafCreeper commented 1 year ago

I think I did what you said? In the sort function I made it filter out all locked server (I tried both before and after, after just did nothing), but that basically just unregisters the server and make it reregister itself, unlocking it.

nathan-i-martin commented 1 year ago

I was thinking about this while driving. I think I want to put a pause on this PR. There's two main reasons:

  1. After thinking about this specific system for locking things, I came up with a more versatile system that I'd like to implement which should be more broadly applicable to different use cases.
  2. I've been wanting to work on adding a family specifically focused on round-based mini-games for a while. If you wanna chat in #contribution about some features that you think would be good that'll help with development. Cause having a family specifically built for round based mini games will be a lot better than trying to cobble together a bunch of disparate features.
TheDeafCreeper commented 1 year ago

fair enough