net.luckperms.api.event.user.UserDataRecalculateEvent Java Examples

The following examples show how to use net.luckperms.api.event.user.UserDataRecalculateEvent. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HookLuckPerms.java    From NametagEdit with GNU General Public License v3.0 5 votes vote down vote up
private void onUserDataRecalculateEvent(UserDataRecalculateEvent event) {
    User user = event.getUser();
    Player player = Bukkit.getPlayer(user.getUniqueId());
    if (player != null) {
        handler.applyTagToPlayer(player, false);
    }
}
 
Example #2
Source File: EventDispatcher.java    From LuckPerms with MIT License 5 votes vote down vote up
public void dispatchDataRecalculate(PermissionHolder holder) {
    if (holder.getType() == HolderType.USER) {
        User user = (User) holder;
        post(UserDataRecalculateEvent.class, () -> generate(UserDataRecalculateEvent.class, user.getApiProxy(), user.getCachedData()));
    } else {
        Group group = (Group) holder;
        post(GroupDataRecalculateEvent.class, () -> generate(GroupDataRecalculateEvent.class, group.getApiProxy(), group.getCachedData()));
    }
}
 
Example #3
Source File: LuckPermsEventHandler.java    From GriefDefender with MIT License 4 votes vote down vote up
public LuckPermsEventHandler(LuckPerms luckPermsApi) {
    this.luckPermsApi = luckPermsApi;
    this.luckPermsApi.getEventBus().subscribe(GroupDataRecalculateEvent.class, this::onGroupDataRecalculate);
    this.luckPermsApi.getEventBus().subscribe(UserDataRecalculateEvent.class, this::onUserDataRecalculate);
}
 
Example #4
Source File: LuckPermsEventHandler.java    From GriefDefender with MIT License 4 votes vote down vote up
public void onUserDataRecalculate(UserDataRecalculateEvent event) {
    final GDPermissionHolder holder = PermissionHolderCache.getInstance().getOrCreateUser(event.getUser().getUniqueId());
    PermissionHolderCache.getInstance().getOrCreatePermissionCache(holder).invalidateAll();
    PermissionHolderCache.getInstance().getOrCreatePermissionCache(GriefDefenderPlugin.DEFAULT_HOLDER).invalidateAll();
}
 
Example #5
Source File: LuckPermsEventHandler.java    From GriefDefender with MIT License 4 votes vote down vote up
public LuckPermsEventHandler(LuckPerms luckPermsApi) {
    this.luckPermsApi = luckPermsApi;
    this.luckPermsApi.getEventBus().subscribe(GroupDataRecalculateEvent.class, this::onGroupDataRecalculate);
    this.luckPermsApi.getEventBus().subscribe(UserDataRecalculateEvent.class, this::onUserDataRecalculate);
}
 
Example #6
Source File: LuckPermsEventHandler.java    From GriefDefender with MIT License 4 votes vote down vote up
public void onUserDataRecalculate(UserDataRecalculateEvent event) {
    final GDPermissionHolder holder = PermissionHolderCache.getInstance().getOrCreateUser(event.getUser().getUniqueId());
    PermissionHolderCache.getInstance().getOrCreatePermissionCache(holder).invalidateAll();
    PermissionHolderCache.getInstance().getOrCreatePermissionCache(GriefDefenderPlugin.DEFAULT_HOLDER).invalidateAll();
}
 
Example #7
Source File: HookLuckPerms.java    From NametagEdit with GNU General Public License v3.0 4 votes vote down vote up
public HookLuckPerms(NametagHandler handler) {
    this.handler = handler;
    LuckPerms api = LuckPermsProvider.get();
    EventBus eventBus = api.getEventBus();
    eventBus.subscribe(UserDataRecalculateEvent.class, this::onUserDataRecalculateEvent);
}
 
Example #8
Source File: BukkitCommandListUpdater.java    From LuckPerms with MIT License 4 votes vote down vote up
@Override
public void bind(EventBus bus) {
    bus.subscribe(UserDataRecalculateEvent.class, this::onUserDataRecalculate);
    bus.subscribe(ContextUpdateEvent.class, this::onContextUpdate);
}
 
Example #9
Source File: BukkitCommandListUpdater.java    From LuckPerms with MIT License 4 votes vote down vote up
private void onUserDataRecalculate(UserDataRecalculateEvent e) {
    requestUpdate(e.getUser().getUniqueId());
}
 
Example #10
Source File: BukkitAutoOpListener.java    From LuckPerms with MIT License 4 votes vote down vote up
@Override
public void bind(EventBus bus) {
    bus.subscribe(UserDataRecalculateEvent.class, this::onUserDataRecalculate);
    bus.subscribe(ContextUpdateEvent.class, this::onContextUpdate);
}
 
Example #11
Source File: BukkitAutoOpListener.java    From LuckPerms with MIT License 4 votes vote down vote up
private void onUserDataRecalculate(UserDataRecalculateEvent e) {
    User user = ApiUser.cast(e.getUser());
    this.plugin.getBootstrap().getPlayer(user.getUniqueId()).ifPresent(p -> refreshAutoOp(p, false));
}
 
Example #12
Source File: NukkitAutoOpListener.java    From LuckPerms with MIT License 4 votes vote down vote up
@Override
public void bind(EventBus bus) {
    bus.subscribe(UserDataRecalculateEvent.class, this::onUserDataRecalculate);
    bus.subscribe(ContextUpdateEvent.class, this::onContextUpdate);
}
 
Example #13
Source File: NukkitAutoOpListener.java    From LuckPerms with MIT License 4 votes vote down vote up
private void onUserDataRecalculate(UserDataRecalculateEvent e) {
    User user = ApiUser.cast(e.getUser());
    this.plugin.getBootstrap().getPlayer(user.getUniqueId()).ifPresent(this::refreshAutoOp);
}