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

Permission problem on set border type command #102

Closed
myavuzokumus opened this issue Apr 30, 2023 · 7 comments · Fixed by #130
Closed

Permission problem on set border type command #102

myavuzokumus opened this issue Apr 30, 2023 · 7 comments · Fixed by #130
Assignees
Labels
enhancement New feature or request in progress task is actively being worked on

Comments

@myavuzokumus
Copy link

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 tastybento self-assigned this May 11, 2023
@tastybento tastybento added the bug Something isn't working label May 11, 2023
tastybento added a commit that referenced this issue May 11, 2023
@tastybento
Copy link
Member

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
Copy link
Author

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.

tastybento added a commit that referenced this issue Jan 2, 2024
* Version 3.2.1

* Remove potential NPE issues

* Version 3.3.0

* Added config option to show or not show particles.

* Add Chinese Translation (#63)

* Rename zh_CN.json to zh_CN.yml (#64)

I'm so stupid. I made a mistake in the format. sorry!

* Add a clearer message when WBAPI is not found (#65)

It is not mandatory to use WorldBorderAPI, so it should be clear for the user
that they have a choice besides integrating with it.

* Remove `hooked` field (refactor) (#66)

Removing the `hooked` field because it was used locally
and could be removed as a simple refactoring to shorter and simpler code.

* Unify wording of WBAPI-excluded configs (#67)

* Unify wording of WBAPI-excluded configs

* Add `show-particles` to README

* Clarify message for show-particles setting

* Implement per-player border type (#69)

* Rename PlayerBorder.barrier to show

* Move player event handlers to PlayerListener

* Remove PlayerBorder

* Implement PerPlayerBorderProxy

Currently defaulting to Customer (non-wbapi) border

* Add BorderTypeCommand

* Create BorderType

* Add messages to BorderTypeCommand

* Prepare PerPlayerBorderProxy for handling edge cases

The user may not have a border type set, then we return with the default.
The user's border type may be unavailable now for two reasons:
1. Border type has been disabled after a server/plugin restart
2. Border type is obsolete and does not exist anymore (forward compatibility).

* Fix message reference at BorderTypeCommand

* Use null for missing wbapiBorder

It is fine since it is never used

* Avoid wbapi "border show" spam on player move

* At command, replace args.isEmpty() with size() != 1

To also show help if more parameters are passed than necessary

* Small refactor

* Fix set-type permission in addon.yml

* Update README

Co-authored-by: tastybento <[email protected]>

* Cleanup documentation (#70)

* Remove commented code

* Purify config.yml

As I see, this is just another place to duplicate our settings, documentation and changes to these.
This file is generated if missing.

* Cleanup Settings.java

This is another place where we duplicated documentation.

* Purify README.md

* Fix failing test: testIsUseWbapi

* Revert "Cleanup Settings.java"

This reverts commit f8e931c.

* Format Settings.java and add documentation link

* Regenerate config.yml

* Avoid raw Optional#get

* Enum elements should be all caps by convention.

* Use isEmpty.

Using Collection.size() to test for emptiness works, but using
Collection.isEmpty() makes the code more readable and can be more
performant. The time complexity of any isEmpty() method implementation
should be O(1) whereas some implementations of size() can be O(n).

In this case, it's not a big deal, just a code smell.

* Map to new variable

* 1.18 support for Particle.BARRIER_BLOCK

* Translate id.yml via GitLocalize (#71)

Co-authored-by: Alunite? <[email protected]>

* Translate hu.yml via GitLocalize (#72)

Co-authored-by: VerusBungee <[email protected]>

* Taiwan translation (#73)

* Translate zh-TW.yml via GitLocalize

* Update zh-TW.yml

Co-authored-by: davgo0103 <[email protected]>
Co-authored-by: tastybento <[email protected]>

* korean translation (#74)

* Translate ko.yml via GitLocalize

* Update ko.yml

Co-authored-by: chickiyeah <[email protected]>
Co-authored-by: tastybento <[email protected]>

* Polish translation (#75)

* Translate pl.yml via GitLocalize

* Update pl.yml

Co-authored-by: PICIGIT <[email protected]>
Co-authored-by: tastybento <[email protected]>

* Switch to use new Bukkit / Paper WorldBorder API (#78)

* Switch to use new Bukkit / Paper WorldBorder API

* Fix nether vanilla border (#80)

Vanilla World Border automatically converts coordinates by dimension multiplayer.
So in the nether it is required to counter it with extra processing.

Co-authored-by: BuildTools <[email protected]>

* disabled enderpearls and chorus fruits + fix (#82)

* run show task ; teleport visitors back in boundaries, bypass spectators (#83)

* Implement a toggle between border types just by writing border type command.

Requested by #87

* Implement new placeholder: %border_type%

Requested by #86

* Disable border changing from other worlds.

This could lead to a showing up a virtual border where it should not be.

* Translate ru.yml via GitLocalize (#93)

Co-authored-by: Marmur2020 <[email protected]>

* Translate pl.yml via GitLocalize (#92)

Co-authored-by: wiktorm12 <[email protected]>

* Update French translation (#91)

* Translate fr.yml via GitLocalize

* Translate fr.yml via GitLocalize

Co-authored-by: HipppB <[email protected]>
Co-authored-by: organizatsiya <[email protected]>

* Translate de.yml via GitLocalize (#89)

Co-authored-by: 0x4096 <[email protected]>

* Update Spanish translation (#90)

* Translate es.yml via GitLocalize

* Translate es.yml via GitLocalize

Co-authored-by: roy0510 <[email protected]>
Co-authored-by: plebexer <[email protected]>

* Update to Java 17

* Permission cannot have a - in it.

Changed the permission for the type command to "border.type" instead of
"border.set-type" because with the hyphen in it, Bukkit always grants
the permission for some reason.

Addresses #96

* Added test class for type command

Had to make some classes non-final so they can be mocked.

* Added IslandBorderCommand test class

* Add ${argLine} to get jacoco coverage

* Fix code smells.

* Fix code smell

* Fix Jacoco errors

* Use default settings in config if player does not have permissions. (#98)

Redoes the config.yml as well.
Adds test classes.

Relates to #97

* Config types (#99)

* Use default settings in config if player does not have permissions.

Redoes the config.yml as well.
Adds test classes.

Relates to #97

* Remove unused import.

* Adds offset config to enable border to be bigger than protection range

#75
Adds test class for ShowBarrier.

* Added ShowVirtualWorldBorder test class

#75

* Finishes up #97

* Fixes #100. Island border was set for home island not visitor's island.

* Fix addon.yml

#102

* Update Github Action build script

* Added distribution required for Github Action

* Update Jacoco

* Update pom.xml

* support < 0 in coloured virtual border (#103)

* Translate vi.yml via GitLocalize (#104)

Co-authored-by: Danh <[email protected]>

* Translate ja.yml via GitLocalize (#105)

Co-authored-by: mt-gitlocalize <[email protected]>

* Czech translation (#106)

* Translate cs.yml via GitLocalize

* Translate cs.yml via GitLocalize

---------

Co-authored-by: mt-gitlocalize <[email protected]>
Co-authored-by: tastybento <[email protected]>

* Croatian translation (#107)

* Translate hr.yml via GitLocalize

* Translate hr.yml via GitLocalize

---------

Co-authored-by: mt-gitlocalize <[email protected]>
Co-authored-by: tastybento <[email protected]>

* Translate ko.yml via GitLocalize (#109)

Co-authored-by: mt-gitlocalize <[email protected]>

* Italian translation (#108)

* Translate it.yml via GitLocalize

* Translate it.yml via GitLocalize

---------

Co-authored-by: mt-gitlocalize <[email protected]>
Co-authored-by: tastybento <[email protected]>

* Translate nl.yml via GitLocalize (#110)

Co-authored-by: mt-gitlocalize <[email protected]>

* Portuguese translation (#111)

* Translate pt.yml via GitLocalize

* Translate pt.yml via GitLocalize

---------

Co-authored-by: mt-gitlocalize <[email protected]>
Co-authored-by: tastybento <[email protected]>

* Translate ro.yml via GitLocalize (#112)

Co-authored-by: tastybento <[email protected]>

* Translate tr.yml via GitLocalize (#113)

Co-authored-by: mt-gitlocalize <[email protected]>

* Translate zh-CN.yml via GitLocalize (#114)

Co-authored-by: mt-gitlocalize <[email protected]>

* Translate zh-TW.yml via GitLocalize (#115)

Co-authored-by: mt-gitlocalize <[email protected]>

* BentoBox 2.0.0 API

* Translate uk.yml via GitLocalize (#117)

Co-authored-by: GIGABAIT <[email protected]>

* Version 4.2

* Adds option to not give a safety block. Fixes #118

---------

Co-authored-by: hutu <[email protected]>
Co-authored-by: Károly Ozsvárt <[email protected]>
Co-authored-by: gitlocalize-app[bot] <55277160+gitlocalize-app[bot]@users.noreply.github.com>
Co-authored-by: Alunite? <[email protected]>
Co-authored-by: VerusBungee <[email protected]>
Co-authored-by: davgo0103 <[email protected]>
Co-authored-by: chickiyeah <[email protected]>
Co-authored-by: PICIGIT <[email protected]>
Co-authored-by: evlad <[email protected]>
Co-authored-by: BuildTools <[email protected]>
Co-authored-by: BONNe <[email protected]>
Co-authored-by: Marmur2020 <[email protected]>
Co-authored-by: wiktorm12 <[email protected]>
Co-authored-by: HipppB <[email protected]>
Co-authored-by: organizatsiya <[email protected]>
Co-authored-by: 0x4096 <[email protected]>
Co-authored-by: roy0510 <[email protected]>
Co-authored-by: plebexer <[email protected]>
Co-authored-by: the456gamer <[email protected]>
Co-authored-by: Danh <[email protected]>
Co-authored-by: mt-gitlocalize <[email protected]>
Co-authored-by: GIGABAIT <[email protected]>
@myavuzokumus
Copy link
Author

@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 tastybento reopened this Jul 25, 2024
@tastybento
Copy link
Member

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
Copy link
Author

myavuzokumus commented Jul 25, 2024

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 tastybento added enhancement New feature or request in progress task is actively being worked on and removed bug Something isn't working labels Jul 25, 2024
@tastybento tastybento linked a pull request Jul 25, 2024 that will close this issue
@tastybento
Copy link
Member

@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.

@tastybento tastybento reopened this Jul 25, 2024
@myavuzokumus
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request in progress task is actively being worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants