Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #1996 - Jail should also block gamemode changes #2875

Merged
merged 1 commit into from
Dec 12, 2019

Conversation

caojohnny
Copy link
Contributor

@caojohnny caojohnny commented Dec 11, 2019

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.

Blocks players from experiencing any gamemode changes while they are jailed
Copy link
Member

@pop4959 pop4959 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks fine, I'd suggest avoiding the * import though

@mdcfe mdcfe merged commit 3b51b23 into EssentialsX:2.x Dec 12, 2019
@caojohnny
Copy link
Contributor Author

caojohnny commented Dec 12, 2019

@pop4959 Is there any particular reason why that should be the case? Is the goal here minimal diffs or is there some other benefit that I'm currently unaware of?

@pop4959
Copy link
Member

pop4959 commented Dec 12, 2019

Mostly just nitpicking, which is why I approved anyways. Feel free to google the pros/cons of using * imports. Normally, there isn't really any noticeable difference though, so it's a fairly trivial matter. IntelliJ automatically merges imports into a * import when you hit 5, unless you change the default settings within the IDE.

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.

Jail should also block gamemode changes
3 participants