BentoBoxWorld / BentoBox

Expandable Minecraft server plugin for island-type games like SkyBlock or AcidIsland.
https://bentobox.world
Eclipse Public License 2.0
334 stars 136 forks source link

Add priority for range calculation #1314

Open Korazza opened 4 years ago

Korazza commented 4 years ago

Description

Here is the thing. /bsb range set command is so much used, because it is the only way to instantly update the range for a player. Now, lets say we have member and owner in the same team. If someone set member's range to something, it overrides the owner's one. And this is correct, but only if the member gets higher range than the owner. If member has a lower range than the owner's one, it should not override it. This is I think something that should absolutely be done into BentoBox, because I am encountering this issue into my server.

Also, try to add a feature so I can set a minimum island range per group or per player please.

Solution

A possible solution to achieve this feature could be to set owner's range to the minimum of the entire team. In this way, if someone set member's range to something lower than the owner's one, it just set the range to what the owner's one is.

I hope you will add this feature because i need it so much, if you wont add this someone needs to find weird solution to this, like developing a new plugin just for this thing. Thank you so much, have a nice work!

tastybento commented 4 years ago

The /bsb range set command actually sets the range of the island not any particular player. That is why it is changing like you see. Ranges are not stored on a per-player basis.

You can use permissions to set ranges: bskyblock.island.range.[NUMBER] where number is the range. Only the island owner's permission counts to the island range.

BONNe commented 4 years ago

@tastybento this comes from discord, but unfortunately, it as misleading description.

The issue is that when someone updates range with a command (set, add, remove) it does not check permission.

So, f.e, I have bskyblock.island.range.50 Then I run the command /bsb range remove 10.

In island information, it will say that range is 40. But if I relog, it resets back to 50, as I have a permission 50.

The thing that must be changed here is that set and remove must check permission value, and use it as a minimal possible value that can be set.

tastybento commented 4 years ago

It cannot check permission value if the player is offline. The design is that you use commands or you use perms. Perms trump commands.

BONNe commented 4 years ago

Hmm, how about storing owner range permission (latest) in the island object?

tastybento commented 4 years ago

Technically, the owner's range permission (if they have one), is stored in the island object - it is the island's range value. So, all checking is going to be moot:

if (newRange != currentRange) {
    // sorry you cannot change the range
}

Now, you could store whether you are using permissions or not, and disallow command changes because the value will be reset when the owner logs in:

if (permsAreUsedToSetRange && commandIsUsedToChangeRange) {
    // Sorry, perms are being used. You cannot use these admin commands
}

Or, Admins could just not use perms.

Admins should decide: user perms or use commands. Am I missing something?

Poslovitch commented 4 years ago

Admins should decide: user perms or use commands.

That's going to be a support burden.

What about disabling the perms and only use commands? Because the perms make no sense since they're applied to the island owner (ideally, they should be applied to islands... but islands are not players) and are causing issues (#1182, this one).

Korazza commented 4 years ago

I am sorry for my misleading description, thank you BONNe. The thing is that if you want dynamic ranges, which is something that bring players to play even more, you MUST use commands since it is the only way to instantly update ranges. I cannot say to players "rejoin to affect your island range" because it is so ugly. Also, if you want to be able to give different ranges on different groups or ranks, you MUST use perms. So I am wondering how could we do that by deciding only perms or commands.

tastybento commented 4 years ago

In that case, just use commands. If you do that then there will be no issue. Just make sure you don’t use permissions for this.

Korazza commented 4 years ago

No issues?? Have you tried it? I do not think so. I am using only commands, just like you said. I tried it, I invited a person to my island team. We have 25 range cause I ranked up before him, he rankups too then and it overrides the island range to 10, a lower level. I want to avoid this. I can give you my server IP if you want to try this.

tastybento commented 4 years ago

I now understand what you are saying:

Description

Is your feature request related to a problem?

The /bsb range set command is an admin command to set the island range but it does so without regard for the current range value.

I want to increase the range of the island based on island members achieving some rank. The island range should never go down. Right now, I am using the /bsb range set command to do this but as I call it every time a player changes rank, it can go down when a lower-ranked player on the island ranks up. I really need a new command that will only set the range if the request is for a higher value.

Describe the solution you'd like us to implement.

I want a command that only changes the island range if it the request is for more than the current island range. For example:

/bsb range set 30 min - this will set the range to a minimum of 30 or keep the current range if it is >30.

e.g., If the current island range is 25, then the range will increase to 30. If the current island range is 50, then the range will stay at 50 and not go down.

Describe alternatives you've considered.

/bsb range add 10 command adds to the current island range as a whole, but I want to set a specific range.

Korazza commented 4 years ago

Well, I am sorry if my request was not so clear, but I did not code this plugin, so I cannot know how your plugin works behind the scene. Your description is exactly what I really need. But again, it is not a complete solution. What about /is reset? It will reset the island completely as it should, but in this case the island range too, so I will need to change it manually to the player. Another issue is when a member leaves his team. He will get the default range even if he has the last rank when running /is create. And this is because range is saved in the island object. So I am wondering what could be a solution to the whole system even with this implementation.

tastybento commented 4 years ago

Edited:

Permissions provide per-user range setting and are what some other admins use to enable what you want. The only two issues for you is that:

(a) you want it set immediately on rank up and (b) you don't want a member's rank to override the owner's rank.

Is this correct?

BTW, what triggers a rank up in your game? It could be possible to set permissions based on rank when it triggers, and also issue the new set command to make the setting instant.

Edit reason: I wanted to clarify that you want the owner's range "rank" to be primary and not the member's.

Korazza commented 4 years ago

Yes it is correct. The rank is actually a luckperms group. I used both permissions and commands, permission to "store'" the user range capability, so when someone resets his island the new one has the rank's range. Commands just to affect this range update immediately. Well, with both permissions and this new command I think it is done. But I think there is another issue with them. There should be also a permission like bskyblock.island.range.min.<value> to use instead of the other one, otherwise if a member brings a higher range to the island and the owner has the permission bskyblock.island.range.<value>, when the owner will rejoin the island will get the value in this permission as its range.

tastybento commented 4 years ago

Yes. Let me think about this.

tastybento commented 4 years ago

Okay. Assuming the owner of the island is the only one who determines the island's range, then this can be done with a command that will set the range only if the player name given is the owner of the island, otherwise it will be ignored. This will mirror the permissions exactly, because only the owner's perms have an affect on island range. All others are ignored. This will enable you to use the same command for every level-up without having to know if the player is an island owner or not.

However, in reading your request, you mention that members of an island also can raise the island's range by their rank. Is that correct? Currently, the game is designed so that only the owner determines the range. This works because there is always an island owner and the owner can never leave an island except by resetting it (or swapping to another owner). Ownership can change between members and the range can down if the owner loses the perm.

If any team member can raise the range, then things become more complex because team members can leave and join at anytime. Each member's range will need storing somewhere for offline reference based on the team membership situation. This kind of handling sounds like it'd best be done in a separate rank/range addon.

Thoughts?

Korazza commented 4 years ago

Yes, I would like also island members to be able to raise the island's range. I think the range addon would be perfect, so you can leave bskyblock being like it is, without storing each member's range. Then if someone needs this feature like me, he can use this addon. I think is the best thing that could be done.