net.luckperms.api.LuckPerms Java Examples
The following examples show how to use
net.luckperms.api.LuckPerms.
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: PermissionsManagerInitializationTest.java From AuthMeReloaded with GNU General Public License v3.0 | 6 votes |
private void setUpForPermissionSystemTest() { if (permissionsSystemType == LUCK_PERMS) { LuckPerms api = mock(LuckPerms.class); ReflectionTestUtils.setField(LuckPermsProvider.class, null, "instance", api); } else if (permissionsSystemType == PERMISSIONS_EX) { throw new AssumptionViolatedException( "PermissionsEx instance cannot be mocked because of missing dependencies -- skipping"); } else if (permissionsSystemType == Z_PERMISSIONS) { ZPermissionsService zPermissionsService = mock(ZPermissionsService.class); given(servicesManager.load(ZPermissionsService.class)).willReturn(zPermissionsService); } else if (permissionsSystemType == VAULT) { setUpForVault(); } else { throw new IllegalStateException("Unhandled permission systems type: " + permissionsSystemType); } }
Example #2
Source File: GeneratedEventClass.java From LuckPerms with MIT License | 6 votes |
/** * Creates a new instance of the event class. * * @param api an instance of the LuckPerms API * @param properties the event properties * @return the event instance * @throws Throwable if something goes wrong */ public LuckPermsEvent newInstance(LuckPerms api, Object... properties) throws Throwable { if (properties.length != this.setters.length) { throw new IllegalStateException("Unexpected number of properties. given: " + properties.length + ", expected: " + this.setters.length); } // create a new instance of the event final AbstractEvent event = (AbstractEvent) this.constructor.invokeExact(api); // set the properties onto the event instance for (int i = 0; i < this.setters.length; i++) { MethodHandle setter = this.setters[i]; Object value = properties[i]; setter.invokeExact(event, value); } return event; }
Example #3
Source File: LuckPermsHook.java From DiscordSRV with GNU General Public License v3.0 | 5 votes |
public LuckPermsHook() { luckPerms = Bukkit.getServicesManager().load(LuckPerms.class); // update events if (!DiscordSRV.config().getStringList("DisabledPluginHooks").contains("LuckPerms-GroupUpdates")) { subscriptions.add(luckPerms.getEventBus().subscribe(UserTrackEvent.class, event -> handle(event.getUser().getUniqueId()))); subscriptions.add(luckPerms.getEventBus().subscribe(NodeAddEvent.class, event -> handle(event, event.getNode(), true))); subscriptions.add(luckPerms.getEventBus().subscribe(NodeRemoveEvent.class, event -> handle(event, event.getNode(), false))); } // contexts if (!DiscordSRV.config().getStringList("DisabledPluginHooks").contains("LuckPerms-Contexts")) { luckPerms.getContextManager().registerCalculator(this); } }
Example #4
Source File: ApiRegistrationUtil.java From LuckPerms with MIT License | 5 votes |
public static void registerProvider(LuckPerms luckPermsApi) { try { REGISTER.invoke(null, luckPermsApi); } catch (Exception e) { e.printStackTrace(); } }
Example #5
Source File: LPSpongePlugin.java From LuckPerms with MIT License | 4 votes |
@Override protected void registerApiOnPlatform(LuckPerms api) { this.bootstrap.getGame().getServiceManager().setProvider(this.bootstrap, LuckPerms.class, api); }
Example #6
Source File: LuckPermsBridge.java From LunaChat with GNU Lesser General Public License v3.0 | 4 votes |
private LuckPermsBridge(LuckPerms api) { this.api = api; }
Example #7
Source File: AbstractEvent.java From LuckPerms with MIT License | 4 votes |
@Override public @NonNull LuckPerms getLuckPerms() { return this.api; }
Example #8
Source File: AbstractEvent.java From LuckPerms with MIT License | 4 votes |
protected AbstractEvent(LuckPerms api) { this.api = api; }
Example #9
Source File: LPVelocityPlugin.java From LuckPerms with MIT License | 4 votes |
@Override protected void registerApiOnPlatform(LuckPerms api) { // Velocity doesn't have a services manager }
Example #10
Source File: LPNukkitPlugin.java From LuckPerms with MIT License | 4 votes |
@Override protected void registerApiOnPlatform(LuckPerms api) { this.bootstrap.getServer().getServiceManager().register(LuckPerms.class, api, this.bootstrap, ServicePriority.NORMAL); }
Example #11
Source File: LuckPermsEventHandler.java From GriefDefender with MIT License | 4 votes |
public LuckPermsEventHandler(LuckPerms luckPermsApi) { this.luckPermsApi = luckPermsApi; this.luckPermsApi.getEventBus().subscribe(GroupDataRecalculateEvent.class, this::onGroupDataRecalculate); this.luckPermsApi.getEventBus().subscribe(UserDataRecalculateEvent.class, this::onUserDataRecalculate); }
Example #12
Source File: LPBungeePlugin.java From LuckPerms with MIT License | 4 votes |
@Override protected void registerApiOnPlatform(LuckPerms api) { // BungeeCord doesn't have a services manager }
Example #13
Source File: LPBukkitPlugin.java From LuckPerms with MIT License | 4 votes |
@Override protected void registerApiOnPlatform(LuckPerms api) { this.bootstrap.getServer().getServicesManager().register(LuckPerms.class, api, this.bootstrap, ServicePriority.Normal); }
Example #14
Source File: HookLuckPerms.java From NametagEdit with GNU General Public License v3.0 | 4 votes |
public HookLuckPerms(NametagHandler handler) { this.handler = handler; LuckPerms api = LuckPermsProvider.get(); EventBus eventBus = api.getEventBus(); eventBus.subscribe(UserDataRecalculateEvent.class, this::onUserDataRecalculateEvent); }
Example #15
Source File: LuckPermsProvider.java From GriefDefender with MIT License | 4 votes |
public LuckPerms getApi() { return this.luckPermsApi; }
Example #16
Source File: LuckPermsProvider.java From GriefDefender with MIT License | 4 votes |
public LuckPermsProvider() { final ProviderRegistration<LuckPerms> service = Sponge.getServiceManager().getRegistration(LuckPerms.class).orElse(null); this.luckPermsApi = service.getProvider(); }
Example #17
Source File: LuckPermsEventHandler.java From GriefDefender with MIT License | 4 votes |
public LuckPermsEventHandler(LuckPerms luckPermsApi) { this.luckPermsApi = luckPermsApi; this.luckPermsApi.getEventBus().subscribe(GroupDataRecalculateEvent.class, this::onGroupDataRecalculate); this.luckPermsApi.getEventBus().subscribe(UserDataRecalculateEvent.class, this::onUserDataRecalculate); }
Example #18
Source File: LuckPermsProvider.java From GriefDefender with MIT License | 4 votes |
public LuckPerms getApi() { return this.luckPermsApi; }
Example #19
Source File: LuckPermsProvider.java From GriefDefender with MIT License | 4 votes |
public LuckPermsProvider() { this.luckPermsApi = Bukkit.getServicesManager().getRegistration(LuckPerms.class).getProvider(); this.luckPermsApi.getContextManager().registerCalculator(new ClaimContextCalculator()); }
Example #20
Source File: LuckPermsEvent.java From LuckPerms with MIT License | 2 votes |
/** * Get the API instance this event was dispatched from * * @return the api instance */ @NonNull LuckPerms getLuckPerms();
Example #21
Source File: AbstractLuckPermsPlugin.java From LuckPerms with MIT License | votes |
protected abstract void registerApiOnPlatform(LuckPerms api);