BentoBoxWorld / Border

Adds a world border around islands
Eclipse Public License 2.0
13 stars 8 forks source link

Permission problem on set border type command #102

Closed myavuzokumus closed 4 months ago

myavuzokumus commented 1 year ago

Expected behavior

Player must be able to use "/is border type" without the "bskyblock.border.toggle" permission.

Observed/Actual behavior

Player cannot use "/is border type" without "bskylock.border.toggle". Also broken permission is "bskyblock.border.set-type" still in addon.yml.

Steps/models to reproduce

Try "/is border type" command without "bskylock.border.toggle" permission.

BentoBox version

image

Plugin list

No response

Other

No response

tastybento commented 1 year ago

I fixed the addon.yml.

For your use case, I assume you want to force players to have the border but allow them to decide the type. That's interesting, and wasn't anticipated. Then again, the type command was added after.

For the permission thing though, it's not possible because type is a sub command of border. You have to have permission to use border to be able to use border type.

One way to change this would be to make the toggling a sub command, like /is border on or /is border off and then have a third permission. The "/is border" command would then do nothing except show help.

myavuzokumus commented 1 year ago

That's okay for me. Border toggle command can be /is border toggle instead of /is border on or /is border off. Or both can be.

myavuzokumus commented 4 months ago

@tastybento I still need that command :D. So can't you make the "/is border toggle" command to a sub-command? Through this, the "/is border" command will just send a help message and we can get it done. (I guess we don't need /is border on/off command. Just make the "toggle" command to a sub-command will be enough.)

tastybento commented 4 months ago

Sorry, I'm trying to remember the history here. Right now this was closed because doing just /is border will toggle on and off. Are you saying you want an /is border toggle command as well? Why would that be needed?

myavuzokumus commented 4 months ago

The player wants to change the island border type with /is border type. But he also needs the main permission to change it. That permission is "..border.toggle". When I look at the code, I see that the main command is /is border and the "type" command seems to sub from it. Therefore, it also needs the permission of the toggle command. In short, I want the player to be able to change the type of the island borders without closing borders, which is why this issue was started in the first place.

Footnote: I corrected the code on my side and created a new ToggleBorderCommand class to show the main command only as a help message. But since I'm still new to this, there must be something I'm doing wrong and I don't know much about writing tests yet. So I didn't want to bother you with my code here.

tastybento commented 4 months ago

@myavuzokumus Okay, what I've done is add an explicit /is bordertype command with the permission [gamemode].border.bordertype so you can give players the ability to switch the border type without being able to turn them off. The permission is not given by default, so you'll need to do that. You can test the snapshot from the ci.bentobox.world and let me know if that works for you. I tested it and it works well from what I can see.

myavuzokumus commented 4 months ago

Thank you very much. It works without a problem! ❤️