Rename "debug" classes to "verbose"

This commit is contained in:
Luck 2017-03-19 21:04:10 +00:00
parent c35ab38f36
commit f8ad562b95
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
10 changed files with 30 additions and 30 deletions

View File

@ -49,7 +49,6 @@ import me.lucko.luckperms.common.contexts.ContextManager;
import me.lucko.luckperms.common.contexts.ServerCalculator; import me.lucko.luckperms.common.contexts.ServerCalculator;
import me.lucko.luckperms.common.core.UuidCache; import me.lucko.luckperms.common.core.UuidCache;
import me.lucko.luckperms.common.core.model.User; 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.dependencies.DependencyManager;
import me.lucko.luckperms.common.locale.LocaleManager; import me.lucko.luckperms.common.locale.LocaleManager;
import me.lucko.luckperms.common.locale.NoopLocaleManager; 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.BufferedRequest;
import me.lucko.luckperms.common.utils.FileWatcher; import me.lucko.luckperms.common.utils.FileWatcher;
import me.lucko.luckperms.common.utils.LoggerImpl; import me.lucko.luckperms.common.utils.LoggerImpl;
import me.lucko.luckperms.common.verbose.VerboseHandler;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.command.PluginCommand; import org.bukkit.command.PluginCommand;
@ -122,7 +122,7 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
private CalculatorFactory calculatorFactory; private CalculatorFactory calculatorFactory;
private BufferedRequest<Void> updateTaskBuffer; private BufferedRequest<Void> updateTaskBuffer;
private boolean started = false; private boolean started = false;
private DebugHandler debugHandler; private VerboseHandler verboseHandler;
private BukkitSenderFactory senderFactory; private BukkitSenderFactory senderFactory;
private PermissionVault permissionVault; private PermissionVault permissionVault;
@ -136,7 +136,7 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
LuckPermsPlugin.sendStartupBanner(getConsoleSender(), this); LuckPermsPlugin.sendStartupBanner(getConsoleSender(), this);
ignoringLogs = ConcurrentHashMap.newKeySet(); ignoringLogs = ConcurrentHashMap.newKeySet();
debugHandler = new DebugHandler(scheduler.getAsyncBukkitExecutor(), getVersion()); verboseHandler = new VerboseHandler(scheduler.getAsyncBukkitExecutor(), getVersion());
permissionVault = new PermissionVault(scheduler.getAsyncBukkitExecutor()); permissionVault = new PermissionVault(scheduler.getAsyncBukkitExecutor());
getLog().info("Loading configuration..."); getLog().info("Loading configuration...");
@ -325,7 +325,7 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
defaultsProvider.close(); defaultsProvider.close();
permissionVault.setShutdown(true); permissionVault.setShutdown(true);
debugHandler.setShutdown(true); verboseHandler.setShutdown(true);
for (Player player : getServer().getOnlinePlayers()) { for (Player player : getServer().getOnlinePlayers()) {
Injector.unInject(player, false, false); Injector.unInject(player, false, false);
@ -388,7 +388,7 @@ public class LPBukkitPlugin extends JavaPlugin implements LuckPermsPlugin {
worldCalculator = null; worldCalculator = null;
calculatorFactory = null; calculatorFactory = null;
updateTaskBuffer = null; updateTaskBuffer = null;
debugHandler = null; verboseHandler = null;
senderFactory = null; senderFactory = null;
permissionVault = null; permissionVault = null;
} }

View File

@ -41,7 +41,6 @@ import me.lucko.luckperms.common.contexts.ContextManager;
import me.lucko.luckperms.common.contexts.ServerCalculator; import me.lucko.luckperms.common.contexts.ServerCalculator;
import me.lucko.luckperms.common.core.UuidCache; import me.lucko.luckperms.common.core.UuidCache;
import me.lucko.luckperms.common.core.model.User; 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.dependencies.DependencyManager;
import me.lucko.luckperms.common.locale.LocaleManager; import me.lucko.luckperms.common.locale.LocaleManager;
import me.lucko.luckperms.common.locale.NoopLocaleManager; 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.BufferedRequest;
import me.lucko.luckperms.common.utils.FileWatcher; import me.lucko.luckperms.common.utils.FileWatcher;
import me.lucko.luckperms.common.utils.LoggerImpl; 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.connection.ProxiedPlayer;
import net.md_5.bungee.api.plugin.Plugin; import net.md_5.bungee.api.plugin.Plugin;
@ -99,7 +99,7 @@ public class LPBungeePlugin extends Plugin implements LuckPermsPlugin {
private ContextManager<ProxiedPlayer> contextManager; private ContextManager<ProxiedPlayer> contextManager;
private CalculatorFactory calculatorFactory; private CalculatorFactory calculatorFactory;
private BufferedRequest<Void> updateTaskBuffer; private BufferedRequest<Void> updateTaskBuffer;
private DebugHandler debugHandler; private VerboseHandler verboseHandler;
private BungeeSenderFactory senderFactory; private BungeeSenderFactory senderFactory;
private PermissionVault permissionVault; private PermissionVault permissionVault;
@ -110,7 +110,7 @@ public class LPBungeePlugin extends Plugin implements LuckPermsPlugin {
senderFactory = new BungeeSenderFactory(this); senderFactory = new BungeeSenderFactory(this);
log = new LoggerImpl(getConsoleSender()); log = new LoggerImpl(getConsoleSender());
LuckPermsPlugin.sendStartupBanner(getConsoleSender(), this); LuckPermsPlugin.sendStartupBanner(getConsoleSender(), this);
debugHandler = new DebugHandler(scheduler.getAsyncExecutor(), getVersion()); verboseHandler = new VerboseHandler(scheduler.getAsyncExecutor(), getVersion());
permissionVault = new PermissionVault(scheduler.getAsyncExecutor()); permissionVault = new PermissionVault(scheduler.getAsyncExecutor());
getLog().info("Loading configuration..."); getLog().info("Loading configuration...");

View File

@ -58,7 +58,7 @@ public class PermissionCalculator {
public Tristate getPermissionValue(String permission) { public Tristate getPermissionValue(String permission) {
permission = permission.toLowerCase(); permission = permission.toLowerCase();
Tristate t = cache.getUnchecked(permission); Tristate t = cache.getUnchecked(permission);
plugin.getDebugHandler().offer(objectName, permission, t); plugin.getVerboseHandler().offer(objectName, permission, t);
plugin.getPermissionVault().offer(permission); plugin.getPermissionVault().offer(permission);
return t; return t;
} }

View File

@ -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.commands.sender.Sender;
import me.lucko.luckperms.common.constants.Message; import me.lucko.luckperms.common.constants.Message;
import me.lucko.luckperms.common.constants.Permission; 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.plugin.LuckPermsPlugin;
import me.lucko.luckperms.common.utils.Predicates; 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.ChatColor;
import io.github.mkremins.fanciful.FancyMessage; import io.github.mkremins.fanciful.FancyMessage;
@ -66,14 +66,14 @@ public class VerboseCommand extends SingleCommand {
String filter = filters.isEmpty() ? "" : filters.stream().collect(Collectors.joining(" ")); String filter = filters.isEmpty() ? "" : filters.stream().collect(Collectors.joining(" "));
if (!DebugListener.isValidFilter(filter)) { if (!VerboseListener.isValidFilter(filter)) {
Message.VERBOSE_INVALID_FILTER.send(sender, filter); Message.VERBOSE_INVALID_FILTER.send(sender, filter);
return CommandResult.FAILURE; return CommandResult.FAILURE;
} }
boolean notify = !mode.equals("record"); boolean notify = !mode.equals("record");
plugin.getDebugHandler().register(sender, filter, notify); plugin.getVerboseHandler().register(sender, filter, notify);
if (notify) { if (notify) {
if (!filter.equals("")) { if (!filter.equals("")) {
@ -93,7 +93,7 @@ public class VerboseCommand extends SingleCommand {
} }
if (mode.equals("off") || mode.equals("false") || mode.equals("paste")) { 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 (mode.equals("paste")) {
if (listener == null) { if (listener == null) {

View File

@ -37,7 +37,6 @@ import me.lucko.luckperms.common.constants.Message;
import me.lucko.luckperms.common.contexts.ContextManager; import me.lucko.luckperms.common.contexts.ContextManager;
import me.lucko.luckperms.common.core.UuidCache; import me.lucko.luckperms.common.core.UuidCache;
import me.lucko.luckperms.common.core.model.User; 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.locale.LocaleManager;
import me.lucko.luckperms.common.managers.GroupManager; import me.lucko.luckperms.common.managers.GroupManager;
import me.lucko.luckperms.common.managers.TrackManager; 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.treeview.PermissionVault;
import me.lucko.luckperms.common.utils.BufferedRequest; import me.lucko.luckperms.common.utils.BufferedRequest;
import me.lucko.luckperms.common.utils.FileWatcher; import me.lucko.luckperms.common.utils.FileWatcher;
import me.lucko.luckperms.common.verbose.VerboseHandler;
import java.io.File; import java.io.File;
import java.io.InputStream; import java.io.InputStream;
@ -168,7 +168,7 @@ public interface LuckPermsPlugin {
* *
* @return the debug handler instance * @return the debug handler instance
*/ */
DebugHandler getDebugHandler(); VerboseHandler getVerboseHandler();
/** /**
* Gets the permission caching instance for the platform. * Gets the permission caching instance for the platform.

View File

@ -20,7 +20,7 @@
* SOFTWARE. * SOFTWARE.
*/ */
package me.lucko.luckperms.common.debug; package me.lucko.luckperms.common.verbose;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;

View File

@ -20,7 +20,7 @@
* SOFTWARE. * SOFTWARE.
*/ */
package me.lucko.luckperms.common.debug; package me.lucko.luckperms.common.verbose;
import lombok.Setter; import lombok.Setter;
@ -34,17 +34,17 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;
public class DebugHandler implements Runnable { public class VerboseHandler implements Runnable {
private final String pluginVersion; private final String pluginVersion;
private final Map<UUID, DebugListener> listeners; private final Map<UUID, VerboseListener> listeners;
private final Queue<CheckData> queue; private final Queue<CheckData> queue;
private boolean listening = false; private boolean listening = false;
@Setter @Setter
private boolean shutdown = false; private boolean shutdown = false;
public DebugHandler(Executor executor, String pluginVersion) { public VerboseHandler(Executor executor, String pluginVersion) {
this.pluginVersion = "v" + pluginVersion; this.pluginVersion = "v" + pluginVersion;
listeners = new ConcurrentHashMap<>(); listeners = new ConcurrentHashMap<>();
queue = new ConcurrentLinkedQueue<>(); queue = new ConcurrentLinkedQueue<>();
@ -62,12 +62,12 @@ public class DebugHandler implements Runnable {
public void register(Sender sender, String filter, boolean notify) { public void register(Sender sender, String filter, boolean notify) {
listening = true; 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(); flush();
DebugListener ret = listeners.remove(uuid); VerboseListener ret = listeners.remove(uuid);
if (listeners.isEmpty()) { if (listeners.isEmpty()) {
listening = false; listening = false;
} }
@ -91,7 +91,7 @@ public class DebugHandler implements Runnable {
public synchronized void flush() { public synchronized void flush() {
for (CheckData e; (e = queue.poll()) != null; ) { for (CheckData e; (e = queue.poll()) != null; ) {
for (DebugListener listener : listeners.values()) { for (VerboseListener listener : listeners.values()) {
listener.acceptData(e); listener.acceptData(e);
} }
} }

View File

@ -20,7 +20,7 @@
* SOFTWARE. * SOFTWARE.
*/ */
package me.lucko.luckperms.common.debug; package me.lucko.luckperms.common.verbose;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@ -43,7 +43,7 @@ import java.util.stream.Collectors;
import javax.script.ScriptEngine; import javax.script.ScriptEngine;
@RequiredArgsConstructor @RequiredArgsConstructor
public class DebugListener { public class VerboseListener {
private static final int DATA_TRUNCATION = 700; private static final int DATA_TRUNCATION = 700;
private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z"); private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z");

View File

@ -42,7 +42,6 @@ import me.lucko.luckperms.common.contexts.ContextManager;
import me.lucko.luckperms.common.contexts.ServerCalculator; import me.lucko.luckperms.common.contexts.ServerCalculator;
import me.lucko.luckperms.common.core.UuidCache; import me.lucko.luckperms.common.core.UuidCache;
import me.lucko.luckperms.common.core.model.User; 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.dependencies.DependencyManager;
import me.lucko.luckperms.common.locale.LocaleManager; import me.lucko.luckperms.common.locale.LocaleManager;
import me.lucko.luckperms.common.locale.NoopLocaleManager; 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.BufferedRequest;
import me.lucko.luckperms.common.utils.FileWatcher; import me.lucko.luckperms.common.utils.FileWatcher;
import me.lucko.luckperms.common.utils.LoggerImpl; 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.commands.SpongeMainCommand;
import me.lucko.luckperms.sponge.contexts.WorldCalculator; import me.lucko.luckperms.sponge.contexts.WorldCalculator;
import me.lucko.luckperms.sponge.managers.SpongeGroupManager; import me.lucko.luckperms.sponge.managers.SpongeGroupManager;
@ -158,7 +158,7 @@ public class LPSpongePlugin implements LuckPermsPlugin {
private ContextManager<Subject> contextManager; private ContextManager<Subject> contextManager;
private CalculatorFactory calculatorFactory; private CalculatorFactory calculatorFactory;
private BufferedRequest<Void> updateTaskBuffer; private BufferedRequest<Void> updateTaskBuffer;
private DebugHandler debugHandler; private VerboseHandler verboseHandler;
private SpongeSenderFactory senderFactory; private SpongeSenderFactory senderFactory;
private PermissionVault permissionVault; private PermissionVault permissionVault;
@ -169,7 +169,7 @@ public class LPSpongePlugin implements LuckPermsPlugin {
senderFactory = new SpongeSenderFactory(this); senderFactory = new SpongeSenderFactory(this);
log = new LoggerImpl(getConsoleSender()); log = new LoggerImpl(getConsoleSender());
LuckPermsPlugin.sendStartupBanner(getConsoleSender(), this); LuckPermsPlugin.sendStartupBanner(getConsoleSender(), this);
debugHandler = new DebugHandler(scheduler.getAsyncExecutor(), getVersion()); verboseHandler = new VerboseHandler(scheduler.getAsyncExecutor(), getVersion());
permissionVault = new PermissionVault(scheduler.getAsyncExecutor()); permissionVault = new PermissionVault(scheduler.getAsyncExecutor());
timings = new LPTimings(this); timings = new LPTimings(this);

View File

@ -252,7 +252,7 @@ public class PersistedSubject implements LPSubject {
public Tristate getPermissionValue(@NonNull ContextSet contexts, @NonNull String node) { public Tristate getPermissionValue(@NonNull ContextSet contexts, @NonNull String node) {
try (Timing ignored = service.getPlugin().getTimings().time(LPTiming.INTERNAL_SUBJECT_GET_PERMISSION_VALUE)) { try (Timing ignored = service.getPlugin().getTimings().time(LPTiming.INTERNAL_SUBJECT_GET_PERMISSION_VALUE)) {
Tristate t = permissionLookupCache.getUnchecked(PermissionLookup.of(node, contexts.makeImmutable())); 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; return t;
} }
} }