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

Add /op and /deop commands #192

Merged
merged 5 commits into from
Jul 11, 2017
Merged

Add /op and /deop commands #192

merged 5 commits into from
Jul 11, 2017

Conversation

satoshinm
Copy link
Contributor

Adds two simple convenient commands, /op to add a player to Admin rank, and /deop to add to Default rank.

These commands just call out to /rank, which can already be used for this purpose, but /op and /deop are more intuitive. The lack of /op was confusing for myself when first starting to use Cuberite, and not only me: cuberite/cuberite#3684 cuberite/cuberite#1835 it is also in the FAQ:

https://forum.cuberite.org/thread-1596.html

Q: How can I make myself operator?
A: You can use the rank ...

but #158 notes a caveat, the Operator rank does not have full privileges, by "opping" a player the admin likely intends to add to the Admin rank instead. This pull request implements the suggestion:

Example: To get Operator in Cuberite you need to execute /rank [player] Admin(Note that the Operator rank has not the full permissions!), but most players are familar with /op [player]. So the /op command should be defined as a shortcut to the /rank ... Admin command.

@NiLSPACE
Copy link
Member

NiLSPACE commented Jul 9, 2017

This won't work if someone removed or renamed the admin rank.

@madmaxoft
Copy link
Member

You should add a support function that would search through all rank for the one that has a * permission, using cRankManager:GetAllRanks and cRankManager:GetRankPermisions. Don't forget to handle the case when no such rank exists (fail the /op command with a proper message).

@satoshinm
Copy link
Contributor Author

Changed to iterate to find the '*' permission rank for /op (GetAdminRank()), and use the default rank for /deop (GetDefaultRank()), removing the hardcoded Admin and Default rank names, hows this?

@madmaxoft
Copy link
Member

Looks good, thanks.

@NiLSPACE NiLSPACE merged commit 8f21401 into cuberite:master Jul 11, 2017
@NiLSPACE
Copy link
Member

Thanks, this will likely prevent many confused users :)

@satoshinm satoshinm deleted the op branch July 12, 2017 02:16
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.

3 participants