Search in sources :

Example 1 with VerboseCheckTarget

use of me.lucko.luckperms.common.verbose.VerboseCheckTarget in project LuckPerms by lucko.

the class BungeePermissionCheckListener method onOtherTristateCheck.

@EventHandler(priority = EventPriority.HIGHEST)
public void onOtherTristateCheck(TristateCheckEvent e) {
    if (e.getSender() instanceof ProxiedPlayer) {
        return;
    }
    Objects.requireNonNull(e.getPermission(), "permission");
    Objects.requireNonNull(e.getSender(), "sender");
    String permission = e.getPermission();
    Tristate result = e.getResult();
    VerboseCheckTarget target = VerboseCheckTarget.internal(e.getSender().getName());
    this.plugin.getVerboseHandler().offerPermissionCheckEvent(CheckOrigin.PLATFORM_API_HAS_PERMISSION_SET, target, QueryOptionsImpl.DEFAULT_CONTEXTUAL, permission, TristateResult.forMonitoredResult(result));
    this.plugin.getPermissionRegistry().offer(permission);
}
Also used : ProxiedPlayer(net.md_5.bungee.api.connection.ProxiedPlayer) Tristate(net.luckperms.api.util.Tristate) VerboseCheckTarget(me.lucko.luckperms.common.verbose.VerboseCheckTarget) EventHandler(net.md_5.bungee.event.EventHandler)

Example 2 with VerboseCheckTarget

use of me.lucko.luckperms.common.verbose.VerboseCheckTarget in project LuckPerms by lucko.

the class BungeePermissionCheckListener method onOtherPermissionCheck.

@EventHandler(priority = EventPriority.HIGHEST)
public void onOtherPermissionCheck(PermissionCheckEvent e) {
    if (e.getSender() instanceof ProxiedPlayer) {
        return;
    }
    Objects.requireNonNull(e.getPermission(), "permission");
    Objects.requireNonNull(e.getSender(), "sender");
    String permission = e.getPermission();
    Tristate result = Tristate.of(e.hasPermission());
    VerboseCheckTarget target = VerboseCheckTarget.internal(e.getSender().getName());
    this.plugin.getVerboseHandler().offerPermissionCheckEvent(CheckOrigin.PLATFORM_API_HAS_PERMISSION, target, QueryOptionsImpl.DEFAULT_CONTEXTUAL, permission, TristateResult.forMonitoredResult(result));
    this.plugin.getPermissionRegistry().offer(permission);
}
Also used : ProxiedPlayer(net.md_5.bungee.api.connection.ProxiedPlayer) Tristate(net.luckperms.api.util.Tristate) VerboseCheckTarget(me.lucko.luckperms.common.verbose.VerboseCheckTarget) EventHandler(net.md_5.bungee.event.EventHandler)

Example 3 with VerboseCheckTarget

use of me.lucko.luckperms.common.verbose.VerboseCheckTarget in project LuckPerms by lucko.

the class PermissionCheckListener method onOtherPermissionCheck.

private TriState onOtherPermissionCheck(CommandSource source, String permission) {
    if (source instanceof ServerCommandSource) {
        String name = ((ServerCommandSource) source).getName();
        VerboseCheckTarget target = VerboseCheckTarget.internal(name);
        this.plugin.getVerboseHandler().offerPermissionCheckEvent(CheckOrigin.PLATFORM_API_HAS_PERMISSION, target, QueryOptionsImpl.DEFAULT_CONTEXTUAL, permission, TristateResult.UNDEFINED);
        this.plugin.getPermissionRegistry().offer(permission);
    }
    return TriState.DEFAULT;
}
Also used : VerboseCheckTarget(me.lucko.luckperms.common.verbose.VerboseCheckTarget) ServerCommandSource(net.minecraft.server.command.ServerCommandSource)

Aggregations

VerboseCheckTarget (me.lucko.luckperms.common.verbose.VerboseCheckTarget)3 Tristate (net.luckperms.api.util.Tristate)2 ProxiedPlayer (net.md_5.bungee.api.connection.ProxiedPlayer)2 EventHandler (net.md_5.bungee.event.EventHandler)2 ServerCommandSource (net.minecraft.server.command.ServerCommandSource)1