diff --git a/common/src/main/java/me/lucko/luckperms/common/verbose/VerboseHandler.java b/common/src/main/java/me/lucko/luckperms/common/verbose/VerboseHandler.java index 5a9162ee4..146323624 100644 --- a/common/src/main/java/me/lucko/luckperms/common/verbose/VerboseHandler.java +++ b/common/src/main/java/me/lucko/luckperms/common/verbose/VerboseHandler.java @@ -80,11 +80,12 @@ public class VerboseHandler implements AutoCloseable { return; } + long time = System.currentTimeMillis(); Throwable trace = new Throwable(); String thread = Thread.currentThread().getName(); // add the check data to a queue to be processed later. - this.queue.offer(new PermissionCheckEvent(origin, checkTarget, checkQueryOptions, trace, thread, permission, result)); + this.queue.offer(new PermissionCheckEvent(origin, checkTarget, checkQueryOptions, time, trace, thread, permission, result)); } /** @@ -105,11 +106,12 @@ public class VerboseHandler implements AutoCloseable { return; } + long time = System.currentTimeMillis(); Throwable trace = new Throwable(); String thread = Thread.currentThread().getName(); // add the check data to a queue to be processed later. - this.queue.offer(new MetaCheckEvent(origin, checkTarget, checkQueryOptions, trace, thread, key, result)); + this.queue.offer(new MetaCheckEvent(origin, checkTarget, checkQueryOptions, time, trace, thread, key, result)); } /** diff --git a/common/src/main/java/me/lucko/luckperms/common/verbose/event/MetaCheckEvent.java b/common/src/main/java/me/lucko/luckperms/common/verbose/event/MetaCheckEvent.java index f43b40eb5..d3eeb3dba 100644 --- a/common/src/main/java/me/lucko/luckperms/common/verbose/event/MetaCheckEvent.java +++ b/common/src/main/java/me/lucko/luckperms/common/verbose/event/MetaCheckEvent.java @@ -46,8 +46,8 @@ public class MetaCheckEvent extends VerboseEvent { */ private final String result; - public MetaCheckEvent(Origin origin, String checkTarget, QueryOptions checkQueryOptions, Throwable checkTrace, String checkThread, String key, String result) { - super(checkTarget, checkQueryOptions, checkTrace, checkThread); + public MetaCheckEvent(Origin origin, String checkTarget, QueryOptions checkQueryOptions, long checkTime, Throwable checkTrace, String checkThread, String key, String result) { + super(checkTarget, checkQueryOptions, checkTime, checkTrace, checkThread); this.origin = origin; this.key = key; this.result = result; diff --git a/common/src/main/java/me/lucko/luckperms/common/verbose/event/PermissionCheckEvent.java b/common/src/main/java/me/lucko/luckperms/common/verbose/event/PermissionCheckEvent.java index 52253cbd7..5cb9f03f0 100644 --- a/common/src/main/java/me/lucko/luckperms/common/verbose/event/PermissionCheckEvent.java +++ b/common/src/main/java/me/lucko/luckperms/common/verbose/event/PermissionCheckEvent.java @@ -47,8 +47,8 @@ public class PermissionCheckEvent extends VerboseEvent { */ private final TristateResult result; - public PermissionCheckEvent(Origin origin, String checkTarget, QueryOptions checkQueryOptions, Throwable checkTrace, String checkThread, String permission, TristateResult result) { - super(checkTarget, checkQueryOptions, checkTrace, checkThread); + public PermissionCheckEvent(Origin origin, String checkTarget, QueryOptions checkQueryOptions, long checkTime, Throwable checkTrace, String checkThread, String permission, TristateResult result) { + super(checkTarget, checkQueryOptions, checkTime, checkTrace, checkThread); this.origin = origin; this.permission = permission; this.result = result; diff --git a/common/src/main/java/me/lucko/luckperms/common/verbose/event/VerboseEvent.java b/common/src/main/java/me/lucko/luckperms/common/verbose/event/VerboseEvent.java index e6248e214..2ab503a66 100644 --- a/common/src/main/java/me/lucko/luckperms/common/verbose/event/VerboseEvent.java +++ b/common/src/main/java/me/lucko/luckperms/common/verbose/event/VerboseEvent.java @@ -53,6 +53,11 @@ public abstract class VerboseEvent implements VariableEvaluator { */ private final QueryOptions checkQueryOptions; + /** + * The time when the check took place + */ + private final long checkTime; + /** * The throwable created when the check took place */ @@ -63,9 +68,10 @@ public abstract class VerboseEvent implements VariableEvaluator { */ private final String checkThread; - protected VerboseEvent(String checkTarget, QueryOptions checkQueryOptions, Throwable checkTrace, String checkThread) { + protected VerboseEvent(String checkTarget, QueryOptions checkQueryOptions, long checkTime, Throwable checkTrace, String checkThread) { this.checkTarget = checkTarget; this.checkQueryOptions = checkQueryOptions; + this.checkTime = checkTime; this.checkTrace = checkTrace; this.checkThread = checkThread; } @@ -78,6 +84,10 @@ public abstract class VerboseEvent implements VariableEvaluator { return this.checkQueryOptions; } + public long getCheckTime() { + return this.checkTime; + } + public StackTraceElement[] getCheckTrace() { return this.checkTrace.getStackTrace(); } @@ -105,6 +115,7 @@ public abstract class VerboseEvent implements VariableEvaluator { ); } }) + .add("time", this.checkTime) .add("trace", new JArray() .consume(arr -> { int overflow = tracePrinter.process(getCheckTrace(), StackTracePrinter.elementToString(arr::add));