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

Permissions can extend island range beyond island distance #1047

Closed
tastybento opened this issue Nov 29, 2019 · 3 comments
Closed

Permissions can extend island range beyond island distance #1047

tastybento opened this issue Nov 29, 2019 · 3 comments
Assignees
Labels
Status: Done This issue has been completed or answered. This pull request has been merged. Type: Bug

Comments

@tastybento
Copy link
Member

Description

Describe the bug

Players with a permission of acidisland.island.range.<number> where is greater than the island distance will get an island protection zone that big. It should not be more than the max island distance.

Steps to reproduce the behavior

  1. Give player permission acidisland.island.range.<number> where number is greater than the island distance.
  2. Player should log out and log in.
  3. Do /acid info (player) and see the large range

Expected behavior

It should not be more than the max island distance.

Environment

[02:36:57 INFO]: Running PAPER 1.14.4.
[02:36:57 INFO]: BentoBox version: 1.8.0
[02:36:57 INFO]: Database: JSON2MYSQL
[02:36:57 INFO]: Loaded Game Worlds:
[02:36:57 INFO]: acidisland_world (AcidIsland): Overworld, Nether, End
[02:36:57 INFO]: bskyblock_world (BSkyBlock): Overworld, Nether, End
[02:36:57 INFO]: Loaded Addons:
[02:36:57 INFO]: AcidIsland 1.8.0 (ENABLED)
[02:36:57 INFO]: BentoBox-InvSwitcher 0.0.4 (ENABLED)
[02:36:57 INFO]: BSkyBlock 1.8.0 (ENABLED)
[02:36:57 INFO]: Level 1.8.0 (ENABLED)
[02:36:57 INFO]: WelcomeWarps 1.6.0-SNAPSHOT-b158 (ENABLED)
@tastybento
Copy link
Member Author

Method to calculate permission values was incorrect as well if the default setting was greater than the allocated perm. i.e., it was not possible to give players a perm value of less than the default. This will be fixed.

tastybento added a commit that referenced this issue Nov 29, 2019
Permissions could set the island protection range greater than the
island distance.

This commit also fixes the User method that calculates the max value
from a permission. The default value was being used as the starting
point rather than 0, so it was not possible to set perms to go less than
the default value.

Added test clases around all these items.

#1047
@tastybento tastybento added Status: Done This issue has been completed or answered. This pull request has been merged. and removed Status: In progress Working on the issue. labels Nov 29, 2019
@BONNe
Copy link
Member

BONNe commented Nov 29, 2019

Hmm, wasn't it intended to prevent permission to be smaller then default value?
As in wiki it is written so.
And it makes a sense....

@tastybento
Copy link
Member Author

I am going off the JavaDocs, which has always said "defaultValue the default value; the result may be higher or lower than this", except it was never lower before I fixed the bug:

    /**
     * Get the maximum value of a numerical permission setting.
     * If a player is given an explicit negative number then this is treated as "unlimited" and returned immediately.
     * @param permissionPrefix the start of the perm, e.g., {@code plugin.mypermission}
     * @param defaultValue the default value; the result may be higher or lower than this
     * @return max value
     */

Here's how it should and now does work:

  1. Default value is used if player has no overriding permission.
  2. Default value is used if player has a * permission.
  3. If player has a permission, it overrides the default value
  4. If player has multiple permissions of the same kind but different values, the maximum value is returned.

Can you point me to the Wiki so I can clarify? I couldn't find the reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Done This issue has been completed or answered. This pull request has been merged. Type: Bug
Projects
None yet
Development

No branches or pull requests

2 participants