From 5c760aabd45a02358d94594fbfd92d058a223d90 Mon Sep 17 00:00:00 2001 From: Luck Date: Thu, 1 Sep 2016 13:00:22 +0100 Subject: [PATCH] Fire PermissionRefreshEvent after the nodes have actually updated --- .../src/main/java/me/lucko/luckperms/users/BukkitUser.java | 7 ++++--- .../src/main/java/me/lucko/luckperms/users/SpongeUser.java | 2 -- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/bukkit/src/main/java/me/lucko/luckperms/users/BukkitUser.java b/bukkit/src/main/java/me/lucko/luckperms/users/BukkitUser.java index 377a8d78..372ec0b3 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/users/BukkitUser.java +++ b/bukkit/src/main/java/me/lucko/luckperms/users/BukkitUser.java @@ -106,12 +106,13 @@ public class BukkitUser extends User { /* Must be called sync, as #recalculatePermissions is an unmodified Bukkit API call that is absolutely not thread safe. Shouldn't be too taxing on the server. This only gets called when permissions have actually changed, which is like once per user per login, assuming their permissions don't get modified. */ - plugin.doSync(() -> attachment.getPermissible().recalculatePermissions()); + plugin.doSync(() -> { + attachment.getPermissible().recalculatePermissions(); + plugin.getApiProvider().fireEventAsync(new UserPermissionRefreshEvent(new UserLink(this))); + }); } catch (Exception e) { e.printStackTrace(); } - - plugin.getApiProvider().fireEventAsync(new UserPermissionRefreshEvent(new UserLink(this))); } } diff --git a/sponge/src/main/java/me/lucko/luckperms/users/SpongeUser.java b/sponge/src/main/java/me/lucko/luckperms/users/SpongeUser.java index b4cb38e9..f816ceb8 100644 --- a/sponge/src/main/java/me/lucko/luckperms/users/SpongeUser.java +++ b/sponge/src/main/java/me/lucko/luckperms/users/SpongeUser.java @@ -43,8 +43,6 @@ class SpongeUser extends User { @Override public void refreshPermissions() { - plugin.getApiProvider().fireEventAsync(new UserPermissionRefreshEvent(new UserLink(this))); - // Do nothing. Should be grabbed from PermissionService. /* plugin.doSync(() -> {