Closed Guillaume-Lebegue closed 3 years ago
@Guillaume-Lebegue I'm sorry I don't understand. What do you mean by "reset" in this context?
Sorry, wasn't sure myself how to call it.
Originally, I asked for LimitsJoinPermCheckEvent because when someone joined or logged in, it resets the limits for his island. By reset, I mean the change that I could make with upgrade to the limits where canceled and brought back to the default value. So you made LimitsJoinPermCheckEvent for stoping the whole process of checking permission.
However, now, I'm asked to enable permission for limits that are not managed by upgrade. Which is legit. So you have just implemented LimitsPermCheckEvent where I can check what was detected via permissions to only cancel what was concerned. But to use it, I must stop using LimitsJoinPermCheckEvent as it would disable everything. But disabling it mean that the reset will come back.
I was understanding you right until the last sentence. :smile:
So you have just implemented LimitsPermCheckEvent where I can check what was detected via permissions to only cancel what was concerned.
Yes, exactly.
But to use it, I must stop using LimitsJoinPermCheckEvent as it would disable everything.
Yes, that makes sense, because LimitsJoinPermCheckEvent just stops all setting based on permissions.
But disabling it mean that the reset will come back.
^^ This part I do not understand. Please explain more. What is being reset? What is being disabled? Can you tell me in code what you want to happen?
For example, with an upgrade about anvil. When doing the upgrade, I'm getting the material limits from the BlockLimitsListener. Then I compute the new limit, that I then set for the island with the BlockLimitsListener. However, when someone logs in, it cancels the new number that I had set in BlockLimitsListener and put back the number from the config.
If I had to guess, this come from the clear at line 60 of src/main/java/world/bentobox/limits/listeners/JoinListener.java
if (ibc != null) {
// Clear permission limits
ibc.getEntityLimits().clear();
ibc.getEntityGroupLimits().clear();
ibc.getBlockLimits().clear();
}
When doing the upgrade, I'm getting the material limits from the BlockLimitsListener. Then I compute the new limit, that I then set for the island with the BlockLimitsListener. However, when someone logs in, it cancels the new number that I had set in BlockLimitsListener and put back the number from the config.
When I player logs in, I have to clear all the permission-based settings because there is no information on what has been removed. For example, say a player is given permission to have 50 droppers, but then the admin removes that permission, the next time the player logs in I have to start from scratch, otherwise the player will still have the 50 dropper ability.
Instead of canceling the LimitsPermCheckEvent
are you able to set it every time for the player?
In other words, when a player logs in, their limits are set as follows:
LimitsPermCheckEvent
is fired for each permission that the player has.LimitsPermCheckEvent
modify the permission value based on the player or leave it alone.LimitsPermCheckEvent
are used to set the player's limits.So, you must respond to the player's limits every time the event is fired and not cancel the event.
I guess I can do that. I'll just code something to simulate how much the limits need to be increased.
Is your feature request related to a problem? Please describe. Following of #111. I have updated the upgrade addon to use LimitsPermCheckEvent instead of LimitsJoinPermCheckEvent for stopping permission about upgrades. However, I can't stop the reset anymore.
Describe the solution you'd like Maybe add something to LimitsJoinPermCheckEvent that I can set so limits are not reset