{"action":"closed","issue":{"url":"https://api.github.com/repos/PEXPlugins/PermissionsEx/issues/2609","repository_url":"https://api.github.com/repos/PEXPlugins/PermissionsEx","labels_url":"https://api.github.com/repos/PEXPlugins/PermissionsEx/issues/2609/labels{/name}","comments_url":"https://api.github.com/repos/PEXPlugins/PermissionsEx/issues/2609/comments","events_url":"https://api.github.com/repos/PEXPlugins/PermissionsEx/issues/2609/events","html_url":"https://github.com/PEXPlugins/PermissionsEx/issues/2609","id":196479478,"number":2609,"title":"API question","user":{"login":"Haarolean","id":1494347,"avatar_url":"https://avatars.githubusercontent.com/u/1494347?v=3","gravatar_id":"","url":"https://api.github.com/users/Haarolean","html_url":"https://github.com/Haarolean","followers_url":"https://api.github.com/users/Haarolean/followers","following_url":"https://api.github.com/users/Haarolean/following{/other_user}","gists_url":"https://api.github.com/users/Haarolean/gists{/gist_id}","starred_url":"https://api.github.com/users/Haarolean/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Haarolean/subscriptions","organizations_url":"https://api.github.com/users/Haarolean/orgs","repos_url":"https://api.github.com/users/Haarolean/repos","events_url":"https://api.github.com/users/Haarolean/events{/privacy}","received_events_url":"https://api.github.com/users/Haarolean/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-12-19T17:53:01Z","updated_at":"2016-12-21T21:22:48Z","closed_at":"2016-12-21T21:22:48Z","body":"Hello,\r\n\r\nI'm using PEX' API for managing players groups.\r\nI've got few problems:\r\n1) When changing groups results don't take effect until player relogs/permissions reloaded\r\n2) Reloading with manager.reset(); doesn't work?\r\n\r\nAt the moment I have such code:\r\n```\r\nPermissionUser u = PermissionsEx.getUser(player.getPlayer());\r\nu.getParents(null).forEach(u::removeGroup);\r\nString newgroup = (String) winner1.value;\r\nu.addGroup(newgroup);\r\nPermissionManager manager = PermissionsEx.getPermissionManager();\r\ntry {\r\n    manager.reset();\r\n} catch (PermissionBackendException e) {/*smth here*/}\r\n```\r\n\r\nI 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.\r\n\r\nSo, it looks like:\r\n\r\nAction: Set the group to group 'A'\r\nplayer has no groups now\r\nAction: /pex reload\r\nplayer is in group 'A' now\r\nAction: Set the group to group 'B'\r\nplayer is in group 'A' now\r\nAction: Set the group to group 'C'\r\nplayer is in group 'B' now\r\nAction: /pex reload\r\nplayer is in group 'C' now\r\n\r\nSo, questions:\r\n1) What is the proper way to save the results? \r\n2) What is the difference between manager.reset(); and /pex reload?\r\n3) How to refresh the player's cache or whatever to make him get his group without any additional movements?"}}
{"actor":{"display_login":"Haarolean"}}