API question
Haarolean opened this issue ยท 1 comments
Hello,
I'm using PEX' API for managing players groups.
I've got few problems:
- When changing groups results don't take effect until player relogs/permissions reloaded
- Reloading with manager.reset(); doesn't work?
At the moment I have such code:
PermissionUser u = PermissionsEx.getUser(player.getPlayer());
u.getParents(null).forEach(u::removeGroup);
String newgroup = (String) winner1.value;
u.addGroup(newgroup);
PermissionManager manager = PermissionsEx.getPermissionManager();
try {
manager.reset();
} catch (PermissionBackendException e) {/*smth here*/}
I get an unexpected result: when changing player's group first time (let's think that I have 20 groups and I choose random one each time I execute this code) after executing this code player will have no groups until this code will be run again, then he'll get pre-last (sic!) group. This can be fixed running /pex reload.
So, it looks like:
Action: Set the group to group 'A'
player has no groups now
Action: /pex reload
player is in group 'A' now
Action: Set the group to group 'B'
player is in group 'A' now
Action: Set the group to group 'C'
player is in group 'B' now
Action: /pex reload
player is in group 'C' now
So, questions:
- What is the proper way to save the results?
- What is the difference between manager.reset(); and /pex reload?
- How to refresh the player's cache or whatever to make him get his group without any additional movements?