New Feature: [re]join a running game#771
Open
tadhunt wants to merge 4 commits intogarbagemule:masterfrom
Open
Conversation
The only remaining warnings with these changes are deprecation warnings mostly from the Spigot 1.19 API but also a few from Java itself
* add settings.rejoin config option to enable rejoining the running game (default = false) * fix bossbar so it shows up for rejoined players * fix duplicate entries in scoreboard for rejoined players
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
I run some servers with MobArena for young children, and one of the most often voiced complaints is that once they die they have to wait until the game ends before they can rejoin. There is already a issue tracking this request with some interesting discussion about the challenge. I'm not sure whether this addresses the full set of challenges described there, but it works very well for our use case.
Problem
Solution
When the
settings.rejoinconfig file option is enabled (true),startArena()has been updated to run through the set of things it needs to do to add a player to the game, without doing all of the "start the arena" stuff. That new code is self contained in a new function,addReadyPlayers()and is only called when the arena is already running (and the rejoin feature is enabled).Additionally, the scoreboard ended up with duplicate entries for rejoined players (one greyed out and one not), so I've also updated the scoreboard logic to only do the "fake" weirdness (which I don't really understand) if rejoin is not enabled. This seems to do the trick (except dead players that don't rejoin won't get greyed out, I guess).
In
addReadyPlayers(), I also needed to add the player to any active bosses healthbars, otherwise the healthbar wouldn't show up when they rejoined.Action
Review & playtesting would be much appreciated. I suspect based on the reading of #664 that there are likely to be interactions with other features which don't work correctly. However, we haven't noticed any issues with the basic features we're using (pretty much a stock config).
You can find the build from the github action here: https://github.com/tadhunt/MobArena/actions/runs/6132540696
I've only tested this PR in a branch that also contains #769 since all of my development and testing is on top of that, so if that PR doesn't get integrated, it's worth doing some more playtesting with just this PR to make sure there aren't any lingering issues.