mirror of
https://github.com/lucko/LuckPerms.git
synced 2025-08-29 17:19:46 +02:00
Include more information about targets in verbose payloads
This commit is contained in:
@@ -28,6 +28,7 @@ package me.lucko.luckperms.bukkit.inject.permissible;
|
|||||||
import me.lucko.luckperms.common.calculator.result.TristateResult;
|
import me.lucko.luckperms.common.calculator.result.TristateResult;
|
||||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||||
import me.lucko.luckperms.common.query.QueryOptionsImpl;
|
import me.lucko.luckperms.common.query.QueryOptionsImpl;
|
||||||
|
import me.lucko.luckperms.common.verbose.VerboseCheckTarget;
|
||||||
import me.lucko.luckperms.common.verbose.VerboseHandler;
|
import me.lucko.luckperms.common.verbose.VerboseHandler;
|
||||||
import me.lucko.luckperms.common.verbose.event.PermissionCheckEvent;
|
import me.lucko.luckperms.common.verbose.event.PermissionCheckEvent;
|
||||||
|
|
||||||
@@ -51,7 +52,7 @@ import java.util.Set;
|
|||||||
public class MonitoredPermissibleBase extends PermissibleBase {
|
public class MonitoredPermissibleBase extends PermissibleBase {
|
||||||
final LuckPermsPlugin plugin;
|
final LuckPermsPlugin plugin;
|
||||||
private final PermissibleBase delegate;
|
private final PermissibleBase delegate;
|
||||||
private final String name;
|
private final VerboseCheckTarget verboseCheckTarget;
|
||||||
|
|
||||||
// remains false until the object has been constructed
|
// remains false until the object has been constructed
|
||||||
// necessary to catch the superclass call to #recalculatePermissions on init
|
// necessary to catch the superclass call to #recalculatePermissions on init
|
||||||
@@ -64,12 +65,12 @@ public class MonitoredPermissibleBase extends PermissibleBase {
|
|||||||
|
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.delegate = delegate;
|
this.delegate = delegate;
|
||||||
this.name = name;
|
this.verboseCheckTarget = VerboseCheckTarget.internal(name);
|
||||||
this.initialised = true;
|
this.initialised = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logCheck(PermissionCheckEvent.Origin origin, String permission, boolean result) {
|
private void logCheck(PermissionCheckEvent.Origin origin, String permission, boolean result) {
|
||||||
this.plugin.getVerboseHandler().offerPermissionCheckEvent(origin, this.name, QueryOptionsImpl.DEFAULT_CONTEXTUAL, permission, TristateResult.of(Tristate.of(result)));
|
this.plugin.getVerboseHandler().offerPermissionCheckEvent(origin, this.verboseCheckTarget, QueryOptionsImpl.DEFAULT_CONTEXTUAL, permission, TristateResult.of(Tristate.of(result)));
|
||||||
this.plugin.getPermissionRegistry().offer(permission);
|
this.plugin.getPermissionRegistry().offer(permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -31,6 +31,8 @@ import me.lucko.luckperms.common.calculator.result.TristateResult;
|
|||||||
import me.lucko.luckperms.common.config.ConfigKeys;
|
import me.lucko.luckperms.common.config.ConfigKeys;
|
||||||
import me.lucko.luckperms.common.model.User;
|
import me.lucko.luckperms.common.model.User;
|
||||||
import me.lucko.luckperms.common.query.QueryOptionsImpl;
|
import me.lucko.luckperms.common.query.QueryOptionsImpl;
|
||||||
|
import me.lucko.luckperms.common.verbose.VerboseCheckTarget;
|
||||||
|
import me.lucko.luckperms.common.verbose.event.PermissionCheckEvent.Origin;
|
||||||
|
|
||||||
import net.luckperms.api.query.QueryOptions;
|
import net.luckperms.api.query.QueryOptions;
|
||||||
import net.luckperms.api.util.Tristate;
|
import net.luckperms.api.util.Tristate;
|
||||||
@@ -70,7 +72,7 @@ public class BungeePermissionCheckListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QueryOptions queryOptions = this.plugin.getContextManager().getQueryOptions(player);
|
QueryOptions queryOptions = this.plugin.getContextManager().getQueryOptions(player);
|
||||||
Tristate result = user.getCachedData().getPermissionData(queryOptions).checkPermission(e.getPermission(), me.lucko.luckperms.common.verbose.event.PermissionCheckEvent.Origin.PLATFORM_PERMISSION_CHECK).result();
|
Tristate result = user.getCachedData().getPermissionData(queryOptions).checkPermission(e.getPermission(), Origin.PLATFORM_PERMISSION_CHECK).result();
|
||||||
if (result == Tristate.UNDEFINED && this.plugin.getConfiguration().get(ConfigKeys.APPLY_BUNGEE_CONFIG_PERMISSIONS)) {
|
if (result == Tristate.UNDEFINED && this.plugin.getConfiguration().get(ConfigKeys.APPLY_BUNGEE_CONFIG_PERMISSIONS)) {
|
||||||
return; // just use the result provided by the proxy when the event was created
|
return; // just use the result provided by the proxy when the event was created
|
||||||
}
|
}
|
||||||
@@ -99,7 +101,7 @@ public class BungeePermissionCheckListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QueryOptions queryOptions = this.plugin.getContextManager().getQueryOptions(player);
|
QueryOptions queryOptions = this.plugin.getContextManager().getQueryOptions(player);
|
||||||
Tristate result = user.getCachedData().getPermissionData(queryOptions).checkPermission(e.getPermission(), me.lucko.luckperms.common.verbose.event.PermissionCheckEvent.Origin.PLATFORM_LOOKUP_CHECK).result();
|
Tristate result = user.getCachedData().getPermissionData(queryOptions).checkPermission(e.getPermission(), Origin.PLATFORM_LOOKUP_CHECK).result();
|
||||||
if (result == Tristate.UNDEFINED && this.plugin.getConfiguration().get(ConfigKeys.APPLY_BUNGEE_CONFIG_PERMISSIONS)) {
|
if (result == Tristate.UNDEFINED && this.plugin.getConfiguration().get(ConfigKeys.APPLY_BUNGEE_CONFIG_PERMISSIONS)) {
|
||||||
return; // just use the result provided by the proxy when the event was created
|
return; // just use the result provided by the proxy when the event was created
|
||||||
}
|
}
|
||||||
@@ -118,9 +120,9 @@ public class BungeePermissionCheckListener implements Listener {
|
|||||||
|
|
||||||
String permission = e.getPermission();
|
String permission = e.getPermission();
|
||||||
Tristate result = Tristate.of(e.hasPermission());
|
Tristate result = Tristate.of(e.hasPermission());
|
||||||
String name = "internal/" + e.getSender().getName();
|
VerboseCheckTarget target = VerboseCheckTarget.internal(e.getSender().getName());
|
||||||
|
|
||||||
this.plugin.getVerboseHandler().offerPermissionCheckEvent(me.lucko.luckperms.common.verbose.event.PermissionCheckEvent.Origin.PLATFORM_PERMISSION_CHECK, name, QueryOptionsImpl.DEFAULT_CONTEXTUAL, permission, TristateResult.of(result));
|
this.plugin.getVerboseHandler().offerPermissionCheckEvent(Origin.PLATFORM_PERMISSION_CHECK, target, QueryOptionsImpl.DEFAULT_CONTEXTUAL, permission, TristateResult.of(result));
|
||||||
this.plugin.getPermissionRegistry().offer(permission);
|
this.plugin.getPermissionRegistry().offer(permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,9 +137,9 @@ public class BungeePermissionCheckListener implements Listener {
|
|||||||
|
|
||||||
String permission = e.getPermission();
|
String permission = e.getPermission();
|
||||||
Tristate result = e.getResult();
|
Tristate result = e.getResult();
|
||||||
String name = "internal/" + e.getSender().getName();
|
VerboseCheckTarget target = VerboseCheckTarget.internal(e.getSender().getName());
|
||||||
|
|
||||||
this.plugin.getVerboseHandler().offerPermissionCheckEvent(me.lucko.luckperms.common.verbose.event.PermissionCheckEvent.Origin.PLATFORM_LOOKUP_CHECK, name, QueryOptionsImpl.DEFAULT_CONTEXTUAL, permission, TristateResult.of(result));
|
this.plugin.getVerboseHandler().offerPermissionCheckEvent(Origin.PLATFORM_LOOKUP_CHECK, target, QueryOptionsImpl.DEFAULT_CONTEXTUAL, permission, TristateResult.of(result));
|
||||||
this.plugin.getPermissionRegistry().offer(permission);
|
this.plugin.getPermissionRegistry().offer(permission);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -26,6 +26,7 @@
|
|||||||
package me.lucko.luckperms.common.cacheddata;
|
package me.lucko.luckperms.common.cacheddata;
|
||||||
|
|
||||||
import me.lucko.luckperms.common.model.HolderType;
|
import me.lucko.luckperms.common.model.HolderType;
|
||||||
|
import me.lucko.luckperms.common.verbose.VerboseCheckTarget;
|
||||||
|
|
||||||
import net.luckperms.api.cacheddata.CachedData;
|
import net.luckperms.api.cacheddata.CachedData;
|
||||||
import net.luckperms.api.query.QueryOptions;
|
import net.luckperms.api.query.QueryOptions;
|
||||||
@@ -41,18 +42,18 @@ public class CacheMetadata {
|
|||||||
private final HolderType holderType;
|
private final HolderType holderType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of the object which owns the cache
|
* The information about the holder for verbose checks
|
||||||
*/
|
*/
|
||||||
private final String objectName;
|
private final VerboseCheckTarget verboseCheckInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The query options
|
* The query options
|
||||||
*/
|
*/
|
||||||
private final QueryOptions queryOptions;
|
private final QueryOptions queryOptions;
|
||||||
|
|
||||||
public CacheMetadata(HolderType holderType, String objectName, QueryOptions queryOptions) {
|
public CacheMetadata(HolderType holderType, VerboseCheckTarget verboseCheckInfo, QueryOptions queryOptions) {
|
||||||
this.holderType = holderType;
|
this.holderType = holderType;
|
||||||
this.objectName = objectName;
|
this.verboseCheckInfo = verboseCheckInfo;
|
||||||
this.queryOptions = queryOptions;
|
this.queryOptions = queryOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,8 +61,8 @@ public class CacheMetadata {
|
|||||||
return this.holderType;
|
return this.holderType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getObjectName() {
|
public VerboseCheckTarget getVerboseCheckInfo() {
|
||||||
return this.objectName;
|
return this.verboseCheckInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public QueryOptions getQueryOptions() {
|
public QueryOptions getQueryOptions() {
|
||||||
|
@@ -27,6 +27,7 @@ package me.lucko.luckperms.common.cacheddata;
|
|||||||
|
|
||||||
import me.lucko.luckperms.common.model.Group;
|
import me.lucko.luckperms.common.model.Group;
|
||||||
import me.lucko.luckperms.common.model.HolderType;
|
import me.lucko.luckperms.common.model.HolderType;
|
||||||
|
import me.lucko.luckperms.common.verbose.VerboseCheckTarget;
|
||||||
|
|
||||||
import net.luckperms.api.cacheddata.CachedDataManager;
|
import net.luckperms.api.cacheddata.CachedDataManager;
|
||||||
import net.luckperms.api.query.QueryOptions;
|
import net.luckperms.api.query.QueryOptions;
|
||||||
@@ -42,7 +43,7 @@ public class GroupCachedDataManager extends HolderCachedDataManager<Group> imple
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected CacheMetadata getMetadataForQueryOptions(QueryOptions queryOptions) {
|
protected CacheMetadata getMetadataForQueryOptions(QueryOptions queryOptions) {
|
||||||
return new CacheMetadata(HolderType.GROUP, this.holder.getPlainDisplayName(), queryOptions);
|
return new CacheMetadata(HolderType.GROUP, VerboseCheckTarget.group(this.holder), queryOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -27,6 +27,7 @@ package me.lucko.luckperms.common.cacheddata;
|
|||||||
|
|
||||||
import me.lucko.luckperms.common.model.HolderType;
|
import me.lucko.luckperms.common.model.HolderType;
|
||||||
import me.lucko.luckperms.common.model.User;
|
import me.lucko.luckperms.common.model.User;
|
||||||
|
import me.lucko.luckperms.common.verbose.VerboseCheckTarget;
|
||||||
|
|
||||||
import net.luckperms.api.cacheddata.CachedDataManager;
|
import net.luckperms.api.cacheddata.CachedDataManager;
|
||||||
import net.luckperms.api.query.QueryOptions;
|
import net.luckperms.api.query.QueryOptions;
|
||||||
@@ -42,7 +43,7 @@ public class UserCachedDataManager extends HolderCachedDataManager<User> impleme
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected CacheMetadata getMetadataForQueryOptions(QueryOptions queryOptions) {
|
protected CacheMetadata getMetadataForQueryOptions(QueryOptions queryOptions) {
|
||||||
return new CacheMetadata(HolderType.USER, this.holder.getPlainDisplayName(), queryOptions);
|
return new CacheMetadata(HolderType.USER, VerboseCheckTarget.user(this.holder), queryOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -28,7 +28,6 @@ package me.lucko.luckperms.common.cacheddata.type;
|
|||||||
import com.google.common.collect.ForwardingMap;
|
import com.google.common.collect.ForwardingMap;
|
||||||
|
|
||||||
import me.lucko.luckperms.common.cacheddata.CacheMetadata;
|
import me.lucko.luckperms.common.cacheddata.CacheMetadata;
|
||||||
import me.lucko.luckperms.common.model.HolderType;
|
|
||||||
import me.lucko.luckperms.common.node.types.Prefix;
|
import me.lucko.luckperms.common.node.types.Prefix;
|
||||||
import me.lucko.luckperms.common.node.types.Suffix;
|
import me.lucko.luckperms.common.node.types.Suffix;
|
||||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||||
@@ -53,39 +52,30 @@ public class MetaCache extends SimpleMetaCache implements CachedMetaData {
|
|||||||
/** The metadata for this cache */
|
/** The metadata for this cache */
|
||||||
private final CacheMetadata metadata;
|
private final CacheMetadata metadata;
|
||||||
|
|
||||||
/** The object name passed to the verbose handler when checks are made */
|
|
||||||
private final String verboseCheckTarget;
|
|
||||||
|
|
||||||
public MetaCache(LuckPermsPlugin plugin, QueryOptions queryOptions, CacheMetadata metadata, MetaAccumulator sourceMeta) {
|
public MetaCache(LuckPermsPlugin plugin, QueryOptions queryOptions, CacheMetadata metadata, MetaAccumulator sourceMeta) {
|
||||||
super(plugin, queryOptions, sourceMeta);
|
super(plugin, queryOptions, sourceMeta);
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.metadata = metadata;
|
this.metadata = metadata;
|
||||||
|
|
||||||
if (this.metadata.getHolderType() == HolderType.GROUP) {
|
|
||||||
this.verboseCheckTarget = "group/" + this.metadata.getObjectName();
|
|
||||||
} else {
|
|
||||||
this.verboseCheckTarget = this.metadata.getObjectName();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getMetaValue(String key, MetaCheckEvent.Origin origin) {
|
public String getMetaValue(String key, MetaCheckEvent.Origin origin) {
|
||||||
String value = super.getMetaValue(key, origin);
|
String value = super.getMetaValue(key, origin);
|
||||||
this.plugin.getVerboseHandler().offerMetaCheckEvent(origin, this.verboseCheckTarget, this.metadata.getQueryOptions(), key, String.valueOf(value));
|
this.plugin.getVerboseHandler().offerMetaCheckEvent(origin, this.metadata.getVerboseCheckInfo(), this.metadata.getQueryOptions(), key, String.valueOf(value));
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPrefix(MetaCheckEvent.Origin origin) {
|
public String getPrefix(MetaCheckEvent.Origin origin) {
|
||||||
String value = super.getPrefix(origin);
|
String value = super.getPrefix(origin);
|
||||||
this.plugin.getVerboseHandler().offerMetaCheckEvent(origin, this.verboseCheckTarget, this.metadata.getQueryOptions(), Prefix.NODE_KEY, String.valueOf(value));
|
this.plugin.getVerboseHandler().offerMetaCheckEvent(origin, this.metadata.getVerboseCheckInfo(), this.metadata.getQueryOptions(), Prefix.NODE_KEY, String.valueOf(value));
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getSuffix(MetaCheckEvent.Origin origin) {
|
public String getSuffix(MetaCheckEvent.Origin origin) {
|
||||||
String value = super.getSuffix(origin);
|
String value = super.getSuffix(origin);
|
||||||
this.plugin.getVerboseHandler().offerMetaCheckEvent(origin, this.verboseCheckTarget, this.metadata.getQueryOptions(), Suffix.NODE_KEY, String.valueOf(value));
|
this.plugin.getVerboseHandler().offerMetaCheckEvent(origin, this.metadata.getVerboseCheckInfo(), this.metadata.getQueryOptions(), Suffix.NODE_KEY, String.valueOf(value));
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,14 +87,14 @@ public class MetaCache extends SimpleMetaCache implements CachedMetaData {
|
|||||||
@Override
|
@Override
|
||||||
public int getWeight(MetaCheckEvent.Origin origin) {
|
public int getWeight(MetaCheckEvent.Origin origin) {
|
||||||
int value = super.getWeight(origin);
|
int value = super.getWeight(origin);
|
||||||
this.plugin.getVerboseHandler().offerMetaCheckEvent(origin, this.verboseCheckTarget, this.metadata.getQueryOptions(), "weight", String.valueOf(value));
|
this.plugin.getVerboseHandler().offerMetaCheckEvent(origin, this.metadata.getVerboseCheckInfo(), this.metadata.getQueryOptions(), "weight", String.valueOf(value));
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @Nullable String getPrimaryGroup(MetaCheckEvent.Origin origin) {
|
public @Nullable String getPrimaryGroup(MetaCheckEvent.Origin origin) {
|
||||||
String value = super.getPrimaryGroup(origin);
|
String value = super.getPrimaryGroup(origin);
|
||||||
this.plugin.getVerboseHandler().offerMetaCheckEvent(origin, this.verboseCheckTarget, this.metadata.getQueryOptions(), "primarygroup", String.valueOf(value));
|
this.plugin.getVerboseHandler().offerMetaCheckEvent(origin, this.metadata.getVerboseCheckInfo(), this.metadata.getQueryOptions(), "primarygroup", String.valueOf(value));
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,7 +120,7 @@ public class MetaCache extends SimpleMetaCache implements CachedMetaData {
|
|||||||
|
|
||||||
String key = (String) k;
|
String key = (String) k;
|
||||||
List<String> values = super.get(key);
|
List<String> values = super.get(key);
|
||||||
MetaCache.this.plugin.getVerboseHandler().offerMetaCheckEvent(this.origin, MetaCache.this.verboseCheckTarget, MetaCache.this.metadata.getQueryOptions(), key, String.valueOf(values));
|
MetaCache.this.plugin.getVerboseHandler().offerMetaCheckEvent(this.origin, MetaCache.this.metadata.getVerboseCheckInfo(), MetaCache.this.metadata.getQueryOptions(), key, String.valueOf(values));
|
||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -29,7 +29,6 @@ import me.lucko.luckperms.common.cache.LoadingMap;
|
|||||||
import me.lucko.luckperms.common.cacheddata.CacheMetadata;
|
import me.lucko.luckperms.common.cacheddata.CacheMetadata;
|
||||||
import me.lucko.luckperms.common.calculator.processor.PermissionProcessor;
|
import me.lucko.luckperms.common.calculator.processor.PermissionProcessor;
|
||||||
import me.lucko.luckperms.common.calculator.result.TristateResult;
|
import me.lucko.luckperms.common.calculator.result.TristateResult;
|
||||||
import me.lucko.luckperms.common.model.HolderType;
|
|
||||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||||
import me.lucko.luckperms.common.verbose.event.PermissionCheckEvent;
|
import me.lucko.luckperms.common.verbose.event.PermissionCheckEvent;
|
||||||
|
|
||||||
@@ -56,19 +55,10 @@ public class PermissionCalculator implements Function<String, TristateResult> {
|
|||||||
/** Loading cache for permission checks */
|
/** Loading cache for permission checks */
|
||||||
private final LoadingMap<String, TristateResult> lookupCache = LoadingMap.of(this);
|
private final LoadingMap<String, TristateResult> lookupCache = LoadingMap.of(this);
|
||||||
|
|
||||||
/** The object name passed to the verbose handler when checks are made */
|
|
||||||
private final String verboseCheckTarget;
|
|
||||||
|
|
||||||
public PermissionCalculator(LuckPermsPlugin plugin, CacheMetadata metadata, Collection<PermissionProcessor> processors) {
|
public PermissionCalculator(LuckPermsPlugin plugin, CacheMetadata metadata, Collection<PermissionProcessor> processors) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.metadata = metadata;
|
this.metadata = metadata;
|
||||||
this.processors = processors.toArray(new PermissionProcessor[0]);
|
this.processors = processors.toArray(new PermissionProcessor[0]);
|
||||||
|
|
||||||
if (this.metadata.getHolderType() == HolderType.GROUP) {
|
|
||||||
this.verboseCheckTarget = "group/" + this.metadata.getObjectName();
|
|
||||||
} else {
|
|
||||||
this.verboseCheckTarget = this.metadata.getObjectName();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -85,7 +75,7 @@ public class PermissionCalculator implements Function<String, TristateResult> {
|
|||||||
TristateResult result = this.lookupCache.get(permission);
|
TristateResult result = this.lookupCache.get(permission);
|
||||||
|
|
||||||
// log this permission lookup to the verbose handler
|
// log this permission lookup to the verbose handler
|
||||||
this.plugin.getVerboseHandler().offerPermissionCheckEvent(origin, this.verboseCheckTarget, this.metadata.getQueryOptions(), permission, result);
|
this.plugin.getVerboseHandler().offerPermissionCheckEvent(origin, this.metadata.getVerboseCheckInfo(), this.metadata.getQueryOptions(), permission, result);
|
||||||
|
|
||||||
// return the result
|
// return the result
|
||||||
return result;
|
return result;
|
||||||
|
@@ -0,0 +1,113 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of LuckPerms, licensed under the MIT License.
|
||||||
|
*
|
||||||
|
* Copyright (c) lucko (Luck) <luck@lucko.me>
|
||||||
|
* Copyright (c) contributors
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package me.lucko.luckperms.common.verbose;
|
||||||
|
|
||||||
|
import me.lucko.luckperms.common.model.Group;
|
||||||
|
import me.lucko.luckperms.common.model.User;
|
||||||
|
|
||||||
|
import net.luckperms.api.model.PermissionHolder;
|
||||||
|
|
||||||
|
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class VerboseCheckTarget {
|
||||||
|
|
||||||
|
public static final String USER_TYPE = PermissionHolder.Identifier.USER_TYPE;
|
||||||
|
public static final String GROUP_TYPE = PermissionHolder.Identifier.GROUP_TYPE;
|
||||||
|
public static final String INTERNAL_TYPE = "internal";
|
||||||
|
|
||||||
|
public static VerboseCheckTarget user(User user) {
|
||||||
|
return new VerboseCheckTarget(USER_TYPE, user.getPlainDisplayName(), user.getUniqueId());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static VerboseCheckTarget group(Group group) {
|
||||||
|
return new VerboseCheckTarget(GROUP_TYPE, group.getPlainDisplayName(), null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static VerboseCheckTarget internal(String name) {
|
||||||
|
return new VerboseCheckTarget(INTERNAL_TYPE, name, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static VerboseCheckTarget of(String type, String name) {
|
||||||
|
return new VerboseCheckTarget(type, name, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private final String type;
|
||||||
|
private final String name;
|
||||||
|
private final UUID id;
|
||||||
|
private final String desc;
|
||||||
|
|
||||||
|
private VerboseCheckTarget(String type, String name, UUID id) {
|
||||||
|
this.type = type;
|
||||||
|
this.name = name;
|
||||||
|
this.id = id;
|
||||||
|
|
||||||
|
if (this.type.equals(USER_TYPE)) {
|
||||||
|
this.desc = this.name;
|
||||||
|
} else {
|
||||||
|
this.desc = this.type + '/' + this.name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return this.type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return this.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public @Nullable UUID getId() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String describe() {
|
||||||
|
return this.desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) return true;
|
||||||
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
|
VerboseCheckTarget that = (VerboseCheckTarget) o;
|
||||||
|
return this.type.equals(that.type) && this.name.equals(that.name) && Objects.equals(this.id, that.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(this.type, this.name, this.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "VerboseCheckTarget{" +
|
||||||
|
"type=" + this.type + ", " +
|
||||||
|
"name=" + this.name + ", " +
|
||||||
|
"id=" + this.id + '}';
|
||||||
|
}
|
||||||
|
}
|
@@ -74,7 +74,7 @@ public class VerboseHandler implements AutoCloseable {
|
|||||||
* @param permission the permission which was checked for
|
* @param permission the permission which was checked for
|
||||||
* @param result the result of the permission check
|
* @param result the result of the permission check
|
||||||
*/
|
*/
|
||||||
public void offerPermissionCheckEvent(PermissionCheckEvent.Origin origin, String checkTarget, QueryOptions checkQueryOptions, String permission, TristateResult result) {
|
public void offerPermissionCheckEvent(PermissionCheckEvent.Origin origin, VerboseCheckTarget checkTarget, QueryOptions checkQueryOptions, String permission, TristateResult result) {
|
||||||
// don't bother even processing the check if there are no listeners registered
|
// don't bother even processing the check if there are no listeners registered
|
||||||
if (!this.listening) {
|
if (!this.listening) {
|
||||||
return;
|
return;
|
||||||
@@ -100,7 +100,7 @@ public class VerboseHandler implements AutoCloseable {
|
|||||||
* @param key the meta key which was checked for
|
* @param key the meta key which was checked for
|
||||||
* @param result the result of the meta check
|
* @param result the result of the meta check
|
||||||
*/
|
*/
|
||||||
public void offerMetaCheckEvent(MetaCheckEvent.Origin origin, String checkTarget, QueryOptions checkQueryOptions, String key, String result) {
|
public void offerMetaCheckEvent(MetaCheckEvent.Origin origin, VerboseCheckTarget checkTarget, QueryOptions checkQueryOptions, String key, String result) {
|
||||||
// don't bother even processing the check if there are no listeners registered
|
// don't bother even processing the check if there are no listeners registered
|
||||||
if (!this.listening) {
|
if (!this.listening) {
|
||||||
return;
|
return;
|
||||||
|
@@ -155,14 +155,14 @@ public class VerboseListener {
|
|||||||
if (event instanceof PermissionCheckEvent) {
|
if (event instanceof PermissionCheckEvent) {
|
||||||
PermissionCheckEvent permissionEvent = (PermissionCheckEvent) event;
|
PermissionCheckEvent permissionEvent = (PermissionCheckEvent) event;
|
||||||
Message.VERBOSE_LOG_PERMISSION.send(this.notifiedSender,
|
Message.VERBOSE_LOG_PERMISSION.send(this.notifiedSender,
|
||||||
permissionEvent.getCheckTarget(),
|
permissionEvent.getCheckTarget().describe(),
|
||||||
permissionEvent.getPermission(),
|
permissionEvent.getPermission(),
|
||||||
permissionEvent.getResult().result()
|
permissionEvent.getResult().result()
|
||||||
);
|
);
|
||||||
} else if (event instanceof MetaCheckEvent) {
|
} else if (event instanceof MetaCheckEvent) {
|
||||||
MetaCheckEvent metaEvent = (MetaCheckEvent) event;
|
MetaCheckEvent metaEvent = (MetaCheckEvent) event;
|
||||||
Message.VERBOSE_LOG_META.send(this.notifiedSender,
|
Message.VERBOSE_LOG_META.send(this.notifiedSender,
|
||||||
metaEvent.getCheckTarget(),
|
metaEvent.getCheckTarget().describe(),
|
||||||
metaEvent.getKey(),
|
metaEvent.getKey(),
|
||||||
metaEvent.getResult()
|
metaEvent.getResult()
|
||||||
);
|
);
|
||||||
@@ -177,14 +177,14 @@ public class VerboseListener {
|
|||||||
if (event instanceof PermissionCheckEvent) {
|
if (event instanceof PermissionCheckEvent) {
|
||||||
PermissionCheckEvent permissionEvent = (PermissionCheckEvent) event;
|
PermissionCheckEvent permissionEvent = (PermissionCheckEvent) event;
|
||||||
component = Message.VERBOSE_LOG_PERMISSION.build(
|
component = Message.VERBOSE_LOG_PERMISSION.build(
|
||||||
permissionEvent.getCheckTarget(),
|
permissionEvent.getCheckTarget().describe(),
|
||||||
permissionEvent.getPermission(),
|
permissionEvent.getPermission(),
|
||||||
permissionEvent.getResult().result()
|
permissionEvent.getResult().result()
|
||||||
);
|
);
|
||||||
} else if (event instanceof MetaCheckEvent) {
|
} else if (event instanceof MetaCheckEvent) {
|
||||||
MetaCheckEvent metaEvent = (MetaCheckEvent) event;
|
MetaCheckEvent metaEvent = (MetaCheckEvent) event;
|
||||||
component = Message.VERBOSE_LOG_META.build(
|
component = Message.VERBOSE_LOG_META.build(
|
||||||
metaEvent.getCheckTarget(),
|
metaEvent.getCheckTarget().describe(),
|
||||||
metaEvent.getKey(),
|
metaEvent.getKey(),
|
||||||
metaEvent.getResult()
|
metaEvent.getResult()
|
||||||
);
|
);
|
||||||
|
@@ -26,6 +26,7 @@
|
|||||||
package me.lucko.luckperms.common.verbose.event;
|
package me.lucko.luckperms.common.verbose.event;
|
||||||
|
|
||||||
import me.lucko.luckperms.common.util.gson.JObject;
|
import me.lucko.luckperms.common.util.gson.JObject;
|
||||||
|
import me.lucko.luckperms.common.verbose.VerboseCheckTarget;
|
||||||
|
|
||||||
import net.luckperms.api.query.QueryOptions;
|
import net.luckperms.api.query.QueryOptions;
|
||||||
|
|
||||||
@@ -46,7 +47,7 @@ public class MetaCheckEvent extends VerboseEvent {
|
|||||||
*/
|
*/
|
||||||
private final String result;
|
private final String result;
|
||||||
|
|
||||||
public MetaCheckEvent(Origin origin, String checkTarget, QueryOptions checkQueryOptions, long checkTime, Throwable checkTrace, String checkThread, String key, String result) {
|
public MetaCheckEvent(Origin origin, VerboseCheckTarget checkTarget, QueryOptions checkQueryOptions, long checkTime, Throwable checkTrace, String checkThread, String key, String result) {
|
||||||
super(checkTarget, checkQueryOptions, checkTime, checkTrace, checkThread);
|
super(checkTarget, checkQueryOptions, checkTime, checkTrace, checkThread);
|
||||||
this.origin = origin;
|
this.origin = origin;
|
||||||
this.key = key;
|
this.key = key;
|
||||||
@@ -76,7 +77,7 @@ public class MetaCheckEvent extends VerboseEvent {
|
|||||||
@Override
|
@Override
|
||||||
public boolean eval(String variable) {
|
public boolean eval(String variable) {
|
||||||
return variable.equals("meta") ||
|
return variable.equals("meta") ||
|
||||||
getCheckTarget().equalsIgnoreCase(variable) ||
|
getCheckTarget().describe().equalsIgnoreCase(variable) ||
|
||||||
getKey().toLowerCase().startsWith(variable.toLowerCase()) ||
|
getKey().toLowerCase().startsWith(variable.toLowerCase()) ||
|
||||||
getResult().equalsIgnoreCase(variable);
|
getResult().equalsIgnoreCase(variable);
|
||||||
}
|
}
|
||||||
|
@@ -27,6 +27,7 @@ package me.lucko.luckperms.common.verbose.event;
|
|||||||
|
|
||||||
import me.lucko.luckperms.common.calculator.result.TristateResult;
|
import me.lucko.luckperms.common.calculator.result.TristateResult;
|
||||||
import me.lucko.luckperms.common.util.gson.JObject;
|
import me.lucko.luckperms.common.util.gson.JObject;
|
||||||
|
import me.lucko.luckperms.common.verbose.VerboseCheckTarget;
|
||||||
|
|
||||||
import net.luckperms.api.query.QueryOptions;
|
import net.luckperms.api.query.QueryOptions;
|
||||||
|
|
||||||
@@ -47,7 +48,7 @@ public class PermissionCheckEvent extends VerboseEvent {
|
|||||||
*/
|
*/
|
||||||
private final TristateResult result;
|
private final TristateResult result;
|
||||||
|
|
||||||
public PermissionCheckEvent(Origin origin, String checkTarget, QueryOptions checkQueryOptions, long checkTime, Throwable checkTrace, String checkThread, String permission, TristateResult result) {
|
public PermissionCheckEvent(Origin origin, VerboseCheckTarget checkTarget, QueryOptions checkQueryOptions, long checkTime, Throwable checkTrace, String checkThread, String permission, TristateResult result) {
|
||||||
super(checkTarget, checkQueryOptions, checkTime, checkTrace, checkThread);
|
super(checkTarget, checkQueryOptions, checkTime, checkTrace, checkThread);
|
||||||
this.origin = origin;
|
this.origin = origin;
|
||||||
this.permission = permission;
|
this.permission = permission;
|
||||||
@@ -89,7 +90,7 @@ public class PermissionCheckEvent extends VerboseEvent {
|
|||||||
@Override
|
@Override
|
||||||
public boolean eval(String variable) {
|
public boolean eval(String variable) {
|
||||||
return variable.equals("permission") ||
|
return variable.equals("permission") ||
|
||||||
getCheckTarget().equalsIgnoreCase(variable) ||
|
getCheckTarget().describe().equalsIgnoreCase(variable) ||
|
||||||
getPermission().toLowerCase().startsWith(variable.toLowerCase()) ||
|
getPermission().toLowerCase().startsWith(variable.toLowerCase()) ||
|
||||||
getResult().result().name().equalsIgnoreCase(variable);
|
getResult().result().name().equalsIgnoreCase(variable);
|
||||||
}
|
}
|
||||||
|
@@ -30,6 +30,7 @@ import com.google.gson.JsonObject;
|
|||||||
import me.lucko.luckperms.common.util.StackTracePrinter;
|
import me.lucko.luckperms.common.util.StackTracePrinter;
|
||||||
import me.lucko.luckperms.common.util.gson.JArray;
|
import me.lucko.luckperms.common.util.gson.JArray;
|
||||||
import me.lucko.luckperms.common.util.gson.JObject;
|
import me.lucko.luckperms.common.util.gson.JObject;
|
||||||
|
import me.lucko.luckperms.common.verbose.VerboseCheckTarget;
|
||||||
import me.lucko.luckperms.common.verbose.expression.BooleanExpressionCompiler.VariableEvaluator;
|
import me.lucko.luckperms.common.verbose.expression.BooleanExpressionCompiler.VariableEvaluator;
|
||||||
|
|
||||||
import net.luckperms.api.context.Context;
|
import net.luckperms.api.context.Context;
|
||||||
@@ -37,6 +38,7 @@ import net.luckperms.api.query.QueryMode;
|
|||||||
import net.luckperms.api.query.QueryOptions;
|
import net.luckperms.api.query.QueryOptions;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a verbose event.
|
* Represents a verbose event.
|
||||||
@@ -46,7 +48,7 @@ public abstract class VerboseEvent implements VariableEvaluator {
|
|||||||
/**
|
/**
|
||||||
* The name of the entity which was checked
|
* The name of the entity which was checked
|
||||||
*/
|
*/
|
||||||
private final String checkTarget;
|
private final VerboseCheckTarget checkTarget;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The query options used for the check
|
* The query options used for the check
|
||||||
@@ -68,7 +70,7 @@ public abstract class VerboseEvent implements VariableEvaluator {
|
|||||||
*/
|
*/
|
||||||
private final String checkThread;
|
private final String checkThread;
|
||||||
|
|
||||||
protected VerboseEvent(String checkTarget, QueryOptions checkQueryOptions, long checkTime, Throwable checkTrace, String checkThread) {
|
protected VerboseEvent(VerboseCheckTarget checkTarget, QueryOptions checkQueryOptions, long checkTime, Throwable checkTrace, String checkThread) {
|
||||||
this.checkTarget = checkTarget;
|
this.checkTarget = checkTarget;
|
||||||
this.checkQueryOptions = checkQueryOptions;
|
this.checkQueryOptions = checkQueryOptions;
|
||||||
this.checkTime = checkTime;
|
this.checkTime = checkTime;
|
||||||
@@ -76,7 +78,7 @@ public abstract class VerboseEvent implements VariableEvaluator {
|
|||||||
this.checkThread = checkThread;
|
this.checkThread = checkThread;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCheckTarget() {
|
public VerboseCheckTarget getCheckTarget() {
|
||||||
return this.checkTarget;
|
return this.checkTarget;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,7 +103,15 @@ public abstract class VerboseEvent implements VariableEvaluator {
|
|||||||
public JsonObject toJson(StackTracePrinter tracePrinter) {
|
public JsonObject toJson(StackTracePrinter tracePrinter) {
|
||||||
return new JObject()
|
return new JObject()
|
||||||
.add("who", new JObject()
|
.add("who", new JObject()
|
||||||
.add("identifier", this.checkTarget)
|
.add("identifier", this.checkTarget.describe())
|
||||||
|
.add("type", this.checkTarget.getType())
|
||||||
|
.add("name", this.checkTarget.getName())
|
||||||
|
.consume(obj -> {
|
||||||
|
UUID uuid = this.checkTarget.getId();
|
||||||
|
if (uuid != null) {
|
||||||
|
obj.add("uuid", uuid.toString());
|
||||||
|
}
|
||||||
|
})
|
||||||
)
|
)
|
||||||
.add("queryMode", this.checkQueryOptions.mode().name().toLowerCase())
|
.add("queryMode", this.checkQueryOptions.mode().name().toLowerCase())
|
||||||
.consume(obj -> {
|
.consume(obj -> {
|
||||||
|
@@ -28,6 +28,8 @@ package me.lucko.luckperms.fabric.listeners;
|
|||||||
import me.lucko.fabric.api.permissions.v0.PermissionCheckEvent;
|
import me.lucko.fabric.api.permissions.v0.PermissionCheckEvent;
|
||||||
import me.lucko.luckperms.common.calculator.result.TristateResult;
|
import me.lucko.luckperms.common.calculator.result.TristateResult;
|
||||||
import me.lucko.luckperms.common.query.QueryOptionsImpl;
|
import me.lucko.luckperms.common.query.QueryOptionsImpl;
|
||||||
|
import me.lucko.luckperms.common.verbose.VerboseCheckTarget;
|
||||||
|
import me.lucko.luckperms.common.verbose.event.PermissionCheckEvent.Origin;
|
||||||
import me.lucko.luckperms.fabric.LPFabricPlugin;
|
import me.lucko.luckperms.fabric.LPFabricPlugin;
|
||||||
import me.lucko.luckperms.fabric.model.MixinUser;
|
import me.lucko.luckperms.fabric.model.MixinUser;
|
||||||
|
|
||||||
@@ -79,7 +81,9 @@ public class PermissionCheckListener {
|
|||||||
private TriState onOtherPermissionCheck(CommandSource source, String permission) {
|
private TriState onOtherPermissionCheck(CommandSource source, String permission) {
|
||||||
if (source instanceof ServerCommandSource) {
|
if (source instanceof ServerCommandSource) {
|
||||||
String name = ((ServerCommandSource) source).getName();
|
String name = ((ServerCommandSource) source).getName();
|
||||||
this.plugin.getVerboseHandler().offerPermissionCheckEvent(me.lucko.luckperms.common.verbose.event.PermissionCheckEvent.Origin.PLATFORM_PERMISSION_CHECK, name, QueryOptionsImpl.DEFAULT_CONTEXTUAL, permission, TristateResult.UNDEFINED);
|
VerboseCheckTarget target = VerboseCheckTarget.internal(name);
|
||||||
|
|
||||||
|
this.plugin.getVerboseHandler().offerPermissionCheckEvent(Origin.PLATFORM_PERMISSION_CHECK, target, QueryOptionsImpl.DEFAULT_CONTEXTUAL, permission, TristateResult.UNDEFINED);
|
||||||
this.plugin.getPermissionRegistry().offer(permission);
|
this.plugin.getPermissionRegistry().offer(permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -28,6 +28,7 @@ package me.lucko.luckperms.nukkit.inject.permissible;
|
|||||||
import me.lucko.luckperms.common.calculator.result.TristateResult;
|
import me.lucko.luckperms.common.calculator.result.TristateResult;
|
||||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||||
import me.lucko.luckperms.common.query.QueryOptionsImpl;
|
import me.lucko.luckperms.common.query.QueryOptionsImpl;
|
||||||
|
import me.lucko.luckperms.common.verbose.VerboseCheckTarget;
|
||||||
import me.lucko.luckperms.common.verbose.VerboseHandler;
|
import me.lucko.luckperms.common.verbose.VerboseHandler;
|
||||||
import me.lucko.luckperms.common.verbose.event.PermissionCheckEvent;
|
import me.lucko.luckperms.common.verbose.event.PermissionCheckEvent;
|
||||||
|
|
||||||
@@ -50,7 +51,7 @@ import java.util.Map;
|
|||||||
public class MonitoredPermissibleBase extends PermissibleBase {
|
public class MonitoredPermissibleBase extends PermissibleBase {
|
||||||
final LuckPermsPlugin plugin;
|
final LuckPermsPlugin plugin;
|
||||||
private final PermissibleBase delegate;
|
private final PermissibleBase delegate;
|
||||||
private final String name;
|
private final VerboseCheckTarget verboseCheckTarget;
|
||||||
|
|
||||||
// remains false until the object has been constructed
|
// remains false until the object has been constructed
|
||||||
// necessary to catch the superclass call to #recalculatePermissions on init
|
// necessary to catch the superclass call to #recalculatePermissions on init
|
||||||
@@ -63,12 +64,12 @@ public class MonitoredPermissibleBase extends PermissibleBase {
|
|||||||
|
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.delegate = delegate;
|
this.delegate = delegate;
|
||||||
this.name = name;
|
this.verboseCheckTarget = VerboseCheckTarget.internal(name);
|
||||||
this.initialised = true;
|
this.initialised = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logCheck(PermissionCheckEvent.Origin origin, String permission, boolean result) {
|
private void logCheck(PermissionCheckEvent.Origin origin, String permission, boolean result) {
|
||||||
this.plugin.getVerboseHandler().offerPermissionCheckEvent(origin, this.name, QueryOptionsImpl.DEFAULT_CONTEXTUAL, permission, TristateResult.of(Tristate.of(result)));
|
this.plugin.getVerboseHandler().offerPermissionCheckEvent(origin, this.verboseCheckTarget, QueryOptionsImpl.DEFAULT_CONTEXTUAL, permission, TristateResult.of(Tristate.of(result)));
|
||||||
this.plugin.getPermissionRegistry().offer(permission);
|
this.plugin.getPermissionRegistry().offer(permission);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -39,6 +39,7 @@ import me.lucko.luckperms.common.calculator.processor.WildcardProcessor;
|
|||||||
import me.lucko.luckperms.common.metastacking.SimpleMetaStackDefinition;
|
import me.lucko.luckperms.common.metastacking.SimpleMetaStackDefinition;
|
||||||
import me.lucko.luckperms.common.metastacking.StandardStackElements;
|
import me.lucko.luckperms.common.metastacking.StandardStackElements;
|
||||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||||
|
import me.lucko.luckperms.common.verbose.VerboseCheckTarget;
|
||||||
import me.lucko.luckperms.sponge.calculator.FixedDefaultsProcessor;
|
import me.lucko.luckperms.sponge.calculator.FixedDefaultsProcessor;
|
||||||
|
|
||||||
import net.luckperms.api.metastacking.DuplicateRemovalFunction;
|
import net.luckperms.api.metastacking.DuplicateRemovalFunction;
|
||||||
@@ -67,7 +68,8 @@ public class CalculatedSubjectCachedDataManager extends AbstractCachedDataManage
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected CacheMetadata getMetadataForQueryOptions(QueryOptions queryOptions) {
|
protected CacheMetadata getMetadataForQueryOptions(QueryOptions queryOptions) {
|
||||||
return new CacheMetadata(null, this.subject.getParentCollection().getIdentifier() + "/" + this.subject.getIdentifier(), queryOptions);
|
VerboseCheckTarget target = VerboseCheckTarget.of(this.subject.getParentCollection().getIdentifier(), this.subject.getIdentifier());
|
||||||
|
return new CacheMetadata(null, target, queryOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -35,6 +35,7 @@ import com.velocitypowered.api.proxy.Player;
|
|||||||
|
|
||||||
import me.lucko.luckperms.common.calculator.result.TristateResult;
|
import me.lucko.luckperms.common.calculator.result.TristateResult;
|
||||||
import me.lucko.luckperms.common.query.QueryOptionsImpl;
|
import me.lucko.luckperms.common.query.QueryOptionsImpl;
|
||||||
|
import me.lucko.luckperms.common.verbose.VerboseCheckTarget;
|
||||||
import me.lucko.luckperms.common.verbose.event.PermissionCheckEvent;
|
import me.lucko.luckperms.common.verbose.event.PermissionCheckEvent;
|
||||||
import me.lucko.luckperms.velocity.LPVelocityPlugin;
|
import me.lucko.luckperms.velocity.LPVelocityPlugin;
|
||||||
import me.lucko.luckperms.velocity.service.CompatibilityUtil;
|
import me.lucko.luckperms.velocity.service.CompatibilityUtil;
|
||||||
@@ -75,12 +76,12 @@ public class MonitoringPermissionCheckListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private final class MonitoredPermissionFunction implements PermissionFunction {
|
private final class MonitoredPermissionFunction implements PermissionFunction {
|
||||||
private final String name;
|
private final VerboseCheckTarget verboseCheckTarget;
|
||||||
private final PermissionFunction delegate;
|
private final PermissionFunction delegate;
|
||||||
|
|
||||||
MonitoredPermissionFunction(PermissionSubject subject, PermissionFunction delegate) {
|
MonitoredPermissionFunction(PermissionSubject subject, PermissionFunction delegate) {
|
||||||
this.delegate = delegate;
|
this.delegate = delegate;
|
||||||
this.name = "internal/" + determineName(subject);
|
this.verboseCheckTarget = VerboseCheckTarget.internal(determineName(subject));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -90,7 +91,7 @@ public class MonitoringPermissionCheckListener {
|
|||||||
// report result
|
// report result
|
||||||
Tristate result = CompatibilityUtil.convertTristate(setting);
|
Tristate result = CompatibilityUtil.convertTristate(setting);
|
||||||
|
|
||||||
MonitoringPermissionCheckListener.this.plugin.getVerboseHandler().offerPermissionCheckEvent(PermissionCheckEvent.Origin.PLATFORM_LOOKUP_CHECK, this.name, QueryOptionsImpl.DEFAULT_CONTEXTUAL, permission, TristateResult.of(result));
|
MonitoringPermissionCheckListener.this.plugin.getVerboseHandler().offerPermissionCheckEvent(PermissionCheckEvent.Origin.PLATFORM_LOOKUP_CHECK, this.verboseCheckTarget, QueryOptionsImpl.DEFAULT_CONTEXTUAL, permission, TristateResult.of(result));
|
||||||
MonitoringPermissionCheckListener.this.plugin.getPermissionRegistry().offer(permission);
|
MonitoringPermissionCheckListener.this.plugin.getPermissionRegistry().offer(permission);
|
||||||
|
|
||||||
return setting;
|
return setting;
|
||||||
|
Reference in New Issue
Block a user