mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2025-01-01 14:07:56 +01:00
Fire PermRefreshEvent in sponge too
This commit is contained in:
parent
4aa753515d
commit
6fc00976a0
@ -23,6 +23,8 @@
|
|||||||
package me.lucko.luckperms.users;
|
package me.lucko.luckperms.users;
|
||||||
|
|
||||||
import me.lucko.luckperms.LPSpongePlugin;
|
import me.lucko.luckperms.LPSpongePlugin;
|
||||||
|
import me.lucko.luckperms.api.event.events.UserPermissionRefreshEvent;
|
||||||
|
import me.lucko.luckperms.api.implementation.internal.UserLink;
|
||||||
import org.spongepowered.api.entity.living.player.Player;
|
import org.spongepowered.api.entity.living.player.Player;
|
||||||
import org.spongepowered.api.util.Tristate;
|
import org.spongepowered.api.util.Tristate;
|
||||||
|
|
||||||
@ -46,6 +48,7 @@ class SpongeUser extends User {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void refreshPermissions() {
|
public void refreshPermissions() {
|
||||||
|
plugin.doSync(() -> {
|
||||||
Optional<Player> p = plugin.getGame().getServer().getPlayer(plugin.getUuidCache().getExternalUUID(getUuid()));
|
Optional<Player> p = plugin.getGame().getServer().getPlayer(plugin.getUuidCache().getExternalUUID(getUuid()));
|
||||||
if (!p.isPresent()) return;
|
if (!p.isPresent()) return;
|
||||||
|
|
||||||
@ -59,5 +62,7 @@ class SpongeUser extends User {
|
|||||||
final String world = player.getWorld().getName();
|
final String world = player.getWorld().getName();
|
||||||
Map<String, Boolean> local = getLocalPermissions(getPlugin().getConfiguration().getServer(), world, null);
|
Map<String, Boolean> local = getLocalPermissions(getPlugin().getConfiguration().getServer(), world, null);
|
||||||
local.entrySet().forEach(e -> player.getSubjectData().setPermission(Collections.emptySet(), e.getKey(), Tristate.fromBoolean(e.getValue())));
|
local.entrySet().forEach(e -> player.getSubjectData().setPermission(Collections.emptySet(), e.getKey(), Tristate.fromBoolean(e.getValue())));
|
||||||
|
plugin.getApiProvider().fireEventAsync(new UserPermissionRefreshEvent(new UserLink(this)));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user