Skip to content

New Feature: [re]join a running game#771

Open
tadhunt wants to merge 4 commits intogarbagemule:masterfrom
tadhunt:feature/rejoin
Open

New Feature: [re]join a running game#771
tadhunt wants to merge 4 commits intogarbagemule:masterfrom
tadhunt:feature/rejoin

Conversation

@tadhunt
Copy link
Contributor

@tadhunt tadhunt commented Sep 9, 2023

Summary

  • This is a…
    • Bug fix
    • Feature addition
    • Documentation
    • Refactoring
    • Minor / simple change (like a typo)
    • Other
  • Describe this change in 1-2 sentences:

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.rejoin config 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.

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
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.

1 participant