Fixes #1996 - Jail should also block gamemode changes #2875
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.
PR Synopsis
Fixes #1996
This PR introduces a change that would prevent jailed players from having their gamemode changed.
Rationale
As stated in the original issue, "Some plugins like CreativeParkour attempt to teleport and alter the player's gamemode. The teleport is blocked of course, but they end up in creative gamemode."
The changes proposed cancel
PlayerGameModeChangeEvent
if the target player is currently jailed in order to resolve this issue.Impact
This is a very broad method of blocking players from changing gamemodes. If an admin wanted to change the player's gamemode, they will need to unjail them before doing so and then rejail them as necessary.
People who might expect the gamemode of jailed users to be capable of change (such as the fictional admins mentioned above) may find this to be inconvenient. However, I personally don't know of anyone who would need to do this. Again, it is still possible to change the player's gamemode by unjailing and rejailing in the potential rare case that it is necessary to do so.