mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-12-29 12:37:40 +01:00
Rename "debug" classes to "verbose"
This commit is contained in:
parent
c35ab38f36
commit
f8ad562b95
@ -49,7 +49,6 @@ import me.lucko.luckperms.common.contexts.ContextManager;
|
||||
import me.lucko.luckperms.common.contexts.ServerCalculator;
|
||||
import me.lucko.luckperms.common.core.UuidCache;
|
||||
import me.lucko.luckperms.common.core.model.User;
|
||||
import me.lucko.luckperms.common.debug.DebugHandler;
|
||||
import me.lucko.luckperms.common.dependencies.DependencyManager;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.NoopLocaleManager;
|
||||
@ -73,6 +72,7 @@ import me.lucko.luckperms.common.treeview.PermissionVault;
|
||||
import me.lucko.luckperms.common.utils.BufferedRequest;
|
||||
import me.lucko.luckperms.common.utils.FileWatcher;
|
||||
import me.lucko.luckperms.common.utils.LoggerImpl;
|
||||
import me.lucko.luckperms.common.verbose.VerboseHandler;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.PluginCommand;
|
||||
@ -122,7 +122,7 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
|
||||
private CalculatorFactory calculatorFactory;
|
||||
private BufferedRequest<Void> updateTaskBuffer;
|
||||
private boolean started = false;
|
||||
private DebugHandler debugHandler;
|
||||
private VerboseHandler verboseHandler;
|
||||
private BukkitSenderFactory senderFactory;
|
||||
private PermissionVault permissionVault;
|
||||
|
||||
@ -136,7 +136,7 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
|
||||
LuckPermsPlugin.sendStartupBanner(getConsoleSender(), this);
|
||||
|
||||
ignoringLogs = ConcurrentHashMap.newKeySet();
|
||||
debugHandler = new DebugHandler(scheduler.getAsyncBukkitExecutor(), getVersion());
|
||||
verboseHandler = new VerboseHandler(scheduler.getAsyncBukkitExecutor(), getVersion());
|
||||
permissionVault = new PermissionVault(scheduler.getAsyncBukkitExecutor());
|
||||
|
||||
getLog().info("Loading configuration...");
|
||||
@ -325,7 +325,7 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
|
||||
|
||||
defaultsProvider.close();
|
||||
permissionVault.setShutdown(true);
|
||||
debugHandler.setShutdown(true);
|
||||
verboseHandler.setShutdown(true);
|
||||
|
||||
for (Player player : getServer().getOnlinePlayers()) {
|
||||
Injector.unInject(player, false, false);
|
||||
@ -388,7 +388,7 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
|
||||
worldCalculator = null;
|
||||
calculatorFactory = null;
|
||||
updateTaskBuffer = null;
|
||||
debugHandler = null;
|
||||
verboseHandler = null;
|
||||
senderFactory = null;
|
||||
permissionVault = null;
|
||||
}
|
||||
|
@ -41,7 +41,6 @@ import me.lucko.luckperms.common.contexts.ContextManager;
|
||||
import me.lucko.luckperms.common.contexts.ServerCalculator;
|
||||
import me.lucko.luckperms.common.core.UuidCache;
|
||||
import me.lucko.luckperms.common.core.model.User;
|
||||
import me.lucko.luckperms.common.debug.DebugHandler;
|
||||
import me.lucko.luckperms.common.dependencies.DependencyManager;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.NoopLocaleManager;
|
||||
@ -66,6 +65,7 @@ import me.lucko.luckperms.common.treeview.PermissionVault;
|
||||
import me.lucko.luckperms.common.utils.BufferedRequest;
|
||||
import me.lucko.luckperms.common.utils.FileWatcher;
|
||||
import me.lucko.luckperms.common.utils.LoggerImpl;
|
||||
import me.lucko.luckperms.common.verbose.VerboseHandler;
|
||||
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
@ -99,7 +99,7 @@ public class LPBungeePlugin extends Plugin implements LuckPermsPlugin {
|
||||
private ContextManager<ProxiedPlayer> contextManager;
|
||||
private CalculatorFactory calculatorFactory;
|
||||
private BufferedRequest<Void> updateTaskBuffer;
|
||||
private DebugHandler debugHandler;
|
||||
private VerboseHandler verboseHandler;
|
||||
private BungeeSenderFactory senderFactory;
|
||||
private PermissionVault permissionVault;
|
||||
|
||||
@ -110,7 +110,7 @@ public class LPBungeePlugin extends Plugin implements LuckPermsPlugin {
|
||||
senderFactory = new BungeeSenderFactory(this);
|
||||
log = new LoggerImpl(getConsoleSender());
|
||||
LuckPermsPlugin.sendStartupBanner(getConsoleSender(), this);
|
||||
debugHandler = new DebugHandler(scheduler.getAsyncExecutor(), getVersion());
|
||||
verboseHandler = new VerboseHandler(scheduler.getAsyncExecutor(), getVersion());
|
||||
permissionVault = new PermissionVault(scheduler.getAsyncExecutor());
|
||||
|
||||
getLog().info("Loading configuration...");
|
||||
|
@ -58,7 +58,7 @@ public class PermissionCalculator {
|
||||
public Tristate getPermissionValue(String permission) {
|
||||
permission = permission.toLowerCase();
|
||||
Tristate t = cache.getUnchecked(permission);
|
||||
plugin.getDebugHandler().offer(objectName, permission, t);
|
||||
plugin.getVerboseHandler().offer(objectName, permission, t);
|
||||
plugin.getPermissionVault().offer(permission);
|
||||
return t;
|
||||
}
|
||||
|
@ -28,9 +28,9 @@ import me.lucko.luckperms.common.commands.abstraction.SingleCommand;
|
||||
import me.lucko.luckperms.common.commands.sender.Sender;
|
||||
import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.constants.Permission;
|
||||
import me.lucko.luckperms.common.debug.DebugListener;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.common.utils.Predicates;
|
||||
import me.lucko.luckperms.common.verbose.VerboseListener;
|
||||
|
||||
import io.github.mkremins.fanciful.ChatColor;
|
||||
import io.github.mkremins.fanciful.FancyMessage;
|
||||
@ -66,14 +66,14 @@ public class VerboseCommand extends SingleCommand {
|
||||
|
||||
String filter = filters.isEmpty() ? "" : filters.stream().collect(Collectors.joining(" "));
|
||||
|
||||
if (!DebugListener.isValidFilter(filter)) {
|
||||
if (!VerboseListener.isValidFilter(filter)) {
|
||||
Message.VERBOSE_INVALID_FILTER.send(sender, filter);
|
||||
return CommandResult.FAILURE;
|
||||
}
|
||||
|
||||
boolean notify = !mode.equals("record");
|
||||
|
||||
plugin.getDebugHandler().register(sender, filter, notify);
|
||||
plugin.getVerboseHandler().register(sender, filter, notify);
|
||||
|
||||
if (notify) {
|
||||
if (!filter.equals("")) {
|
||||
@ -93,7 +93,7 @@ public class VerboseCommand extends SingleCommand {
|
||||
}
|
||||
|
||||
if (mode.equals("off") || mode.equals("false") || mode.equals("paste")) {
|
||||
DebugListener listener = plugin.getDebugHandler().unregister(sender.getUuid());
|
||||
VerboseListener listener = plugin.getVerboseHandler().unregister(sender.getUuid());
|
||||
|
||||
if (mode.equals("paste")) {
|
||||
if (listener == null) {
|
||||
|
@ -37,7 +37,6 @@ import me.lucko.luckperms.common.constants.Message;
|
||||
import me.lucko.luckperms.common.contexts.ContextManager;
|
||||
import me.lucko.luckperms.common.core.UuidCache;
|
||||
import me.lucko.luckperms.common.core.model.User;
|
||||
import me.lucko.luckperms.common.debug.DebugHandler;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.managers.GroupManager;
|
||||
import me.lucko.luckperms.common.managers.TrackManager;
|
||||
@ -47,6 +46,7 @@ import me.lucko.luckperms.common.storage.Storage;
|
||||
import me.lucko.luckperms.common.treeview.PermissionVault;
|
||||
import me.lucko.luckperms.common.utils.BufferedRequest;
|
||||
import me.lucko.luckperms.common.utils.FileWatcher;
|
||||
import me.lucko.luckperms.common.verbose.VerboseHandler;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
@ -168,7 +168,7 @@ public interface LuckPermsPlugin {
|
||||
*
|
||||
* @return the debug handler instance
|
||||
*/
|
||||
DebugHandler getDebugHandler();
|
||||
VerboseHandler getVerboseHandler();
|
||||
|
||||
/**
|
||||
* Gets the permission caching instance for the platform.
|
||||
|
@ -20,7 +20,7 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.common.debug;
|
||||
package me.lucko.luckperms.common.verbose;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
@ -20,7 +20,7 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.common.debug;
|
||||
package me.lucko.luckperms.common.verbose;
|
||||
|
||||
import lombok.Setter;
|
||||
|
||||
@ -34,17 +34,17 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
public class DebugHandler implements Runnable {
|
||||
public class VerboseHandler implements Runnable {
|
||||
private final String pluginVersion;
|
||||
|
||||
private final Map<UUID, DebugListener> listeners;
|
||||
private final Map<UUID, VerboseListener> listeners;
|
||||
private final Queue<CheckData> queue;
|
||||
private boolean listening = false;
|
||||
|
||||
@Setter
|
||||
private boolean shutdown = false;
|
||||
|
||||
public DebugHandler(Executor executor, String pluginVersion) {
|
||||
public VerboseHandler(Executor executor, String pluginVersion) {
|
||||
this.pluginVersion = "v" + pluginVersion;
|
||||
listeners = new ConcurrentHashMap<>();
|
||||
queue = new ConcurrentLinkedQueue<>();
|
||||
@ -62,12 +62,12 @@ public class DebugHandler implements Runnable {
|
||||
|
||||
public void register(Sender sender, String filter, boolean notify) {
|
||||
listening = true;
|
||||
listeners.put(sender.getUuid(), new DebugListener(pluginVersion, sender, filter, notify));
|
||||
listeners.put(sender.getUuid(), new VerboseListener(pluginVersion, sender, filter, notify));
|
||||
}
|
||||
|
||||
public DebugListener unregister(UUID uuid) {
|
||||
public VerboseListener unregister(UUID uuid) {
|
||||
flush();
|
||||
DebugListener ret = listeners.remove(uuid);
|
||||
VerboseListener ret = listeners.remove(uuid);
|
||||
if (listeners.isEmpty()) {
|
||||
listening = false;
|
||||
}
|
||||
@ -91,7 +91,7 @@ public class DebugHandler implements Runnable {
|
||||
|
||||
public synchronized void flush() {
|
||||
for (CheckData e; (e = queue.poll()) != null; ) {
|
||||
for (DebugListener listener : listeners.values()) {
|
||||
for (VerboseListener listener : listeners.values()) {
|
||||
listener.acceptData(e);
|
||||
}
|
||||
}
|
@ -20,7 +20,7 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.common.debug;
|
||||
package me.lucko.luckperms.common.verbose;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@ -43,7 +43,7 @@ import java.util.stream.Collectors;
|
||||
import javax.script.ScriptEngine;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public class DebugListener {
|
||||
public class VerboseListener {
|
||||
private static final int DATA_TRUNCATION = 700;
|
||||
private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z");
|
||||
|
@ -42,7 +42,6 @@ import me.lucko.luckperms.common.contexts.ContextManager;
|
||||
import me.lucko.luckperms.common.contexts.ServerCalculator;
|
||||
import me.lucko.luckperms.common.core.UuidCache;
|
||||
import me.lucko.luckperms.common.core.model.User;
|
||||
import me.lucko.luckperms.common.debug.DebugHandler;
|
||||
import me.lucko.luckperms.common.dependencies.DependencyManager;
|
||||
import me.lucko.luckperms.common.locale.LocaleManager;
|
||||
import me.lucko.luckperms.common.locale.NoopLocaleManager;
|
||||
@ -63,6 +62,7 @@ import me.lucko.luckperms.common.treeview.PermissionVault;
|
||||
import me.lucko.luckperms.common.utils.BufferedRequest;
|
||||
import me.lucko.luckperms.common.utils.FileWatcher;
|
||||
import me.lucko.luckperms.common.utils.LoggerImpl;
|
||||
import me.lucko.luckperms.common.verbose.VerboseHandler;
|
||||
import me.lucko.luckperms.sponge.commands.SpongeMainCommand;
|
||||
import me.lucko.luckperms.sponge.contexts.WorldCalculator;
|
||||
import me.lucko.luckperms.sponge.managers.SpongeGroupManager;
|
||||
@ -158,7 +158,7 @@ public class LPSpongePlugin implements LuckPermsPlugin {
|
||||
private ContextManager<Subject> contextManager;
|
||||
private CalculatorFactory calculatorFactory;
|
||||
private BufferedRequest<Void> updateTaskBuffer;
|
||||
private DebugHandler debugHandler;
|
||||
private VerboseHandler verboseHandler;
|
||||
private SpongeSenderFactory senderFactory;
|
||||
private PermissionVault permissionVault;
|
||||
|
||||
@ -169,7 +169,7 @@ public class LPSpongePlugin implements LuckPermsPlugin {
|
||||
senderFactory = new SpongeSenderFactory(this);
|
||||
log = new LoggerImpl(getConsoleSender());
|
||||
LuckPermsPlugin.sendStartupBanner(getConsoleSender(), this);
|
||||
debugHandler = new DebugHandler(scheduler.getAsyncExecutor(), getVersion());
|
||||
verboseHandler = new VerboseHandler(scheduler.getAsyncExecutor(), getVersion());
|
||||
permissionVault = new PermissionVault(scheduler.getAsyncExecutor());
|
||||
timings = new LPTimings(this);
|
||||
|
||||
|
@ -252,7 +252,7 @@ public class PersistedSubject implements LPSubject {
|
||||
public Tristate getPermissionValue(@NonNull ContextSet contexts, @NonNull String node) {
|
||||
try (Timing ignored = service.getPlugin().getTimings().time(LPTiming.INTERNAL_SUBJECT_GET_PERMISSION_VALUE)) {
|
||||
Tristate t = permissionLookupCache.getUnchecked(PermissionLookup.of(node, contexts.makeImmutable()));
|
||||
service.getPlugin().getDebugHandler().offer("local:" + getParentCollection().getCollection() + "/" + identifier, node, t);
|
||||
service.getPlugin().getVerboseHandler().offer("local:" + getParentCollection().getCollection() + "/" + identifier, node, t);
|
||||
return t;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user