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

Rank Management #2220

Merged
merged 8 commits into from
Nov 10, 2023
Merged

Rank Management #2220

merged 8 commits into from
Nov 10, 2023

Conversation

tastybento
Copy link
Member

This enables ranks to be managed via commands. For example, an admin could remove the Trusted rank, as requested in #1798

@tastybento tastybento linked an issue Nov 5, 2023 that may be closed by this pull request
@tastybento
Copy link
Member Author

The BentoBox command to manage ranks is /bbox rank and has the following forms:

  • bbox rank list - this lists the registered and active ranks (see below for example)
  • bbox rank add <rank-reference> <rank value> - this adds a rank.
  • bbox rank remove <rank-reference> - removes the named rank.

Adding ranks

The rank reference is the locale reference for the rank. Default ones are found in the ranks section of the locale files, but technically, they could be anywhere in that file. If you want to make a custom rank, then add it using this command and then also add it to the locale file. This is the current English section:

ranks:
  owner: Owner
  sub-owner: Sub-Owner
  member: Member
  trusted: Trusted
  coop: Coop
  visitor: Visitor
  banned: Banned
  admin: Admin
  mod: Mod

If you use tab-complete, it will suggest the default references that are currently unregistered.

The rank value determines the rank order. Anything less than 0 is banned. 0 is a visitor, and anything above 0 can be an island rank. As you can see, there are some ranks registered by default that are not currently used. This needs to be a whole number.

Removing ranks

Remove a rank by just referencing the rank reference. You should be able to use tab-complete to get a list.

If the coop or trusted ranks are removed, and the server restarted, the associated commands to coop or trust someone will not be available for anyone. The commands are linked to the reference and not the rank value, so, you should be able to change the rank value.

Ranks List Example

> bbox rank list
[13:28:03 INFO]: Registered ranks are as follows:
[13:28:03 INFO]: Banned: ranks.banned -1
[13:28:03 INFO]: Visitor: ranks.visitor 0
[13:28:03 INFO]: Coop: ranks.coop 200
[13:28:03 INFO]: Member: ranks.member 500
[13:28:03 INFO]: Sub-Owner: ranks.sub-owner 900
[13:28:03 INFO]: Owner: ranks.owner 1000
[13:28:03 INFO]: Mod: ranks.mod 5000
[13:28:03 INFO]: Admin: ranks.admin 10000

Database storage

The ranks are stored in the database in the Ranks table/folder. If you are using JSON, it will look something like this:

{
  "rankReference": {
    "ranks.banned": -1,
    "ranks.visitor": 0,
    "ranks.coop": 200,
    "ranks.member": 500,
    "ranks.sub-owner": 900,
    "ranks.owner": 1000,
    "ranks.mod": 5000,
    "ranks.admin": 10000
  }
}

The values are read when the server starts and written when the add/remove command is used.

@tastybento tastybento requested a review from BONNe November 5, 2023 21:44
@tastybento tastybento marked this pull request as ready for review November 5, 2023 21:44
@tastybento
Copy link
Member Author

Here's an example of a couple of custom ranks:

> bbox rank list
[13:52:18 INFO]: Registered ranks are as follows:
[13:52:18 INFO]: Really Banned: ranks.really-banned -100
[13:52:18 INFO]: Banned: ranks.banned -1
[13:52:18 INFO]: Visitor: ranks.visitor 0
[13:52:18 INFO]: Coop: ranks.coop 200
[13:52:18 INFO]: Member: ranks.member 500
[13:52:18 INFO]: Test rank: ranks.test 550
[13:52:18 INFO]: Sub-Owner: ranks.sub-owner 900
[13:52:18 INFO]: Owner: ranks.owner 1000
[13:52:18 INFO]: Mod: ranks.mod 5000
[13:52:18 INFO]: Admin: ranks.admin 10000
Screenshot 2023-11-05 at 1 52 45 PM

@tastybento tastybento added the Type: Enhancement Improvement or modification which is usually a new feature. label Nov 5, 2023
@BONNe
Copy link
Member

BONNe commented Nov 10, 2023

Hi tastybento. I have a question about invite command. You can COOP and TRUST only if these ranks exist.

So, if someone removed coop and trust ranks, and added their own ranks in between. How would that player be invited to the island without losing their own island?
F.e. test rank with value 499 (under member situation). He is not a member, but must be invited to the island to set test rank

@tastybento
Copy link
Member Author

Hi tastybento. I have a question about invite command. You can COOP and TRUST only if these ranks exist.

So, if someone removed coop and trust ranks, and added their own ranks in between. How would that player be invited to the island without losing their own island? F.e. test rank with value 499 (under member situation). He is not a member, but must be invited to the island to set test rank

Yes, this part of the ranks system is undeveloped. Right now, the only way to get into these ranks is for the promote command to be used or for an admin to "gift" the rank via some other way, like a command shop. If we get requests, we can build on it.

Right now, this PR is mainly to put the infrastructure in to be able to remove and add the ranks. Next work can be add ways to use them!

@tastybento tastybento merged commit 24148f3 into develop Nov 10, 2023
1 check passed
@tastybento tastybento deleted the rank_management branch November 10, 2023 18:53
Copy link

sonarcloud bot commented Nov 10, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 5 Code Smells

29.6% 29.6% Coverage
0.0% 0.0% Duplication

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Improvement or modification which is usually a new feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Disable the Trusted role.
2 participants