From 10ded26d60f65df6570cd3cd169326614b5ba3ef Mon Sep 17 00:00:00 2001 From: Dan Mulloy Date: Sat, 2 Apr 2016 14:47:54 -0400 Subject: [PATCH] Documentation improvements --- .../comphenix/protocol/ProtocolLibrary.java | 92 +++++++++++++----- .../comphenix/protocol/ProtocolLogger.java | 63 +++++++++++++ .../comphenix/protocol/async/AsyncMarker.java | 8 +- .../protocol/error/DetailedErrorReporter.java | 10 +- .../com/comphenix/protocol/package-info.java | 0 .../protocol/reflect/StructureModifier.java | 9 +- .../protocol/reflect/VolatileField.java | 5 +- .../reflect/instances/DefaultInstances.java | 4 +- .../protocol/utility/MinecraftReflection.java | 3 +- .../com/comphenix/protocol/utility/Util.java | 28 +----- .../protocol/wrappers/MinecraftKey.java | 43 +++++++++ .../protocol/wrappers/WrappedDataWatcher.java | 94 +++++++++++-------- .../comphenix/protocol/CommandProtocol.java | 5 +- .../com/comphenix/protocol/ProtocolLib.java | 67 +------------ 14 files changed, 262 insertions(+), 169 deletions(-) create mode 100644 modules/API/src/main/java/com/comphenix/protocol/ProtocolLogger.java rename modules/{ProtocolLib => API}/src/main/java/com/comphenix/protocol/package-info.java (100%) diff --git a/modules/API/src/main/java/com/comphenix/protocol/ProtocolLibrary.java b/modules/API/src/main/java/com/comphenix/protocol/ProtocolLibrary.java index 4d193dd9..f1b12024 100644 --- a/modules/API/src/main/java/com/comphenix/protocol/ProtocolLibrary.java +++ b/modules/API/src/main/java/com/comphenix/protocol/ProtocolLibrary.java @@ -1,27 +1,43 @@ +/** + * ProtocolLib - Bukkit server library that allows access to the Minecraft protocol. + * Copyright (C) 2016 dmulloy2 + * + * This program is free software; you can redistribute it and/or modify it under the terms of the + * GNU General Public License as published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program; + * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + * 02111-1307 USA + */ package com.comphenix.protocol; -import java.text.MessageFormat; import java.util.Arrays; import java.util.List; -import java.util.logging.Level; +import org.apache.commons.lang.Validate; import org.bukkit.plugin.Plugin; import com.comphenix.protocol.error.BasicErrorReporter; import com.comphenix.protocol.error.ErrorReporter; import com.google.common.util.concurrent.ListeningScheduledExecutorService; +/** + * The main entry point for ProtocolLib. + * @author dmulloy2 + */ public class ProtocolLibrary { - public static final long MILLI_PER_SECOND = 1000; - public static final List INCOMPATIBLE = Arrays.asList("TagAPI"); - /** * The minimum version ProtocolLib has been tested with. */ public static final String MINIMUM_MINECRAFT_VERSION = "1.9"; /** - * The maximum version ProtocolLib has been tested with, + * The maximum version ProtocolLib has been tested with. */ public static final String MAXIMUM_MINECRAFT_VERSION = "1.9"; @@ -30,6 +46,11 @@ public class ProtocolLibrary { */ public static final String MINECRAFT_LAST_RELEASE_DATE = "2016-02-29"; + /** + * Plugins that are currently incompatible with ProtocolLib. + */ + public static final List INCOMPATIBLE = Arrays.asList("TagAPI"); + private static Plugin plugin; private static ProtocolConfig config; private static ProtocolManager manager; @@ -39,58 +60,85 @@ public class ProtocolLibrary { private static ListeningScheduledExecutorService executorSync; private static boolean updatesDisabled; + private static boolean initialized; protected static void init(Plugin plugin, ProtocolConfig config, ProtocolManager manager, ErrorReporter reporter, ListeningScheduledExecutorService executorAsync, ListeningScheduledExecutorService executorSync) { + Validate.isTrue(!initialized, "ProtocolLib has already been initialized."); ProtocolLibrary.plugin = plugin; ProtocolLibrary.config = config; ProtocolLibrary.manager = manager; ProtocolLibrary.reporter = reporter; ProtocolLibrary.executorAsync = executorAsync; ProtocolLibrary.executorSync = executorSync; + ProtocolLogger.init(plugin); + initialized = true; } + /** + * Gets the ProtocolLib plugin instance. + * @return The plugin instance + */ public static Plugin getPlugin() { return plugin; } + /** + * Gets ProtocolLib's configuration + * @return The config + */ public static ProtocolConfig getConfig() { return config; } + /** + * Retrieves the packet protocol manager. + * @return Packet protocol manager + */ public static ProtocolManager getProtocolManager() { return manager; } + /** + * Retrieve the current error reporter. + * @return Current error reporter. + */ public static ErrorReporter getErrorReporter() { return reporter; } - public static void disableUpdates() { - updatesDisabled = true; - } - - public static boolean updatesDisabled() { - return updatesDisabled; - } - + /** + * Retrieve an executor service for performing asynchronous tasks on the behalf of ProtocolLib. + *

+ * Note that this service is NULL if ProtocolLib has not been initialized yet. + * @return The executor service, or NULL. + */ public static ListeningScheduledExecutorService getExecutorAsync() { return executorAsync; } + /** + * Retrieve an executor service for performing synchronous tasks (main thread) on the behalf of ProtocolLib. + *

+ * Note that this service is NULL if ProtocolLib has not been initialized yet. + * @return The executor service, or NULL. + */ public static ListeningScheduledExecutorService getExecutorSync() { return executorSync; } - public static void log(Level level, String message, Object... args) { - plugin.getLogger().log(level, MessageFormat.format(message, args)); + /** + * Disables the ProtocolLib update checker. + */ + public static void disableUpdates() { + updatesDisabled = true; } - public static void log(String message, Object... args) { - log(Level.INFO, message, args); - } - - public static void log(Level level, String message, Throwable ex) { - plugin.getLogger().log(level, message, ex); + /** + * Whether or not updates are currently disabled. + * @return True if it is, false if not + */ + public static boolean updatesDisabled() { + return updatesDisabled; } } \ No newline at end of file diff --git a/modules/API/src/main/java/com/comphenix/protocol/ProtocolLogger.java b/modules/API/src/main/java/com/comphenix/protocol/ProtocolLogger.java new file mode 100644 index 00000000..793db821 --- /dev/null +++ b/modules/API/src/main/java/com/comphenix/protocol/ProtocolLogger.java @@ -0,0 +1,63 @@ +/** + * ProtocolLib - Bukkit server library that allows access to the Minecraft protocol. + * Copyright (C) 2016 dmulloy2 + * + * This program is free software; you can redistribute it and/or modify it under the terms of the + * GNU General Public License as published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with this program; + * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + * 02111-1307 USA + */ +package com.comphenix.protocol; + +import java.text.MessageFormat; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.bukkit.plugin.Plugin; + +/** + * @author dmulloy2 + */ +public class ProtocolLogger { + private static Logger logger; + + protected static void init(Plugin plugin) { + ProtocolLogger.logger = plugin.getLogger(); + } + + /** + * Logs a message to console with a given level. + * @param level Logging level + * @param message Message to log + * @param args Arguments to format in + */ + public static void log(Level level, String message, Object... args) { + logger.log(level, MessageFormat.format(message, args)); + } + + /** + * Logs a method to console with the INFO level. + * @param message Message to log + * @param args Arguments to format in + */ + public static void log(String message, Object... args) { + log(Level.INFO, message, args); + } + + /** + * Logs a message to console with a given level and exception. + * @param level Logging level + * @param message Message to log + * @param ex Exception to log + */ + public static void log(Level level, String message, Throwable ex) { + logger.log(level, message, ex); + } +} \ No newline at end of file diff --git a/modules/API/src/main/java/com/comphenix/protocol/async/AsyncMarker.java b/modules/API/src/main/java/com/comphenix/protocol/async/AsyncMarker.java index 15e9ae88..df253d2a 100644 --- a/modules/API/src/main/java/com/comphenix/protocol/async/AsyncMarker.java +++ b/modules/API/src/main/java/com/comphenix/protocol/async/AsyncMarker.java @@ -28,7 +28,7 @@ import java.util.logging.Level; import com.comphenix.protocol.PacketStream; import com.comphenix.protocol.PacketType; -import com.comphenix.protocol.ProtocolLibrary; +import com.comphenix.protocol.ProtocolLogger; import com.comphenix.protocol.events.NetworkMarker; import com.comphenix.protocol.events.PacketEvent; import com.comphenix.protocol.injector.PrioritizedListener; @@ -429,15 +429,17 @@ public class AsyncMarker implements Serializable, Comparable { // Incoming chat packets are async only if they aren't commands return ! content.startsWith("/"); } else { - ProtocolLibrary.log(Level.WARNING, "Failed to determine contents of incoming chat packet!"); + ProtocolLogger.log(Level.WARNING, "Failed to determine contents of incoming chat packet!"); alwaysSync = true; } + } else if (event.getPacketType() == PacketType.Status.Server.SERVER_INFO) { + return true; } else { // TODO: Find more cases of async packets return false; } } else { - ProtocolLibrary.log(Level.INFO, "Could not determine asynchronous state of packets (this can probably be ignored)"); + ProtocolLogger.log(Level.INFO, "Could not determine asynchronous state of packets (this can probably be ignored)"); alwaysSync = true; } } diff --git a/modules/API/src/main/java/com/comphenix/protocol/error/DetailedErrorReporter.java b/modules/API/src/main/java/com/comphenix/protocol/error/DetailedErrorReporter.java index 7a42d3d6..8b8c8e37 100644 --- a/modules/API/src/main/java/com/comphenix/protocol/error/DetailedErrorReporter.java +++ b/modules/API/src/main/java/com/comphenix/protocol/error/DetailedErrorReporter.java @@ -35,7 +35,7 @@ import org.apache.commons.lang.builder.ToStringStyle; import org.bukkit.Bukkit; import org.bukkit.plugin.Plugin; -import com.comphenix.protocol.ProtocolLibrary; +import com.comphenix.protocol.ProtocolLogger; import com.comphenix.protocol.collections.ExpireHashMap; import com.comphenix.protocol.error.Report.ReportBuilder; import com.comphenix.protocol.events.PacketAdapter; @@ -464,13 +464,15 @@ public class DetailedErrorReporter implements ErrorReporter { } else { try { if (!apacheCommonsMissing) - return (ToStringBuilder.reflectionToString(value, ToStringStyle.MULTI_LINE_STYLE, false, null)); + return ToStringBuilder.reflectionToString(value, ToStringStyle.MULTI_LINE_STYLE, false, null); } catch (LinkageError ex) { // Apache is probably missing apacheCommonsMissing = true; - } catch (Exception e) { + } catch (ThreadDeath | OutOfMemoryError e) { + throw e; + } catch (Throwable ex) { // Don't use the error logger to log errors in error logging (that could lead to infinite loops) - ProtocolLibrary.log(Level.WARNING, "Cannot convert to a String with Apache: " + e.getMessage()); + ProtocolLogger.log(Level.WARNING, "Cannot convert to a String with Apache: " + ex.getMessage()); } // Use our custom object printer instead diff --git a/modules/ProtocolLib/src/main/java/com/comphenix/protocol/package-info.java b/modules/API/src/main/java/com/comphenix/protocol/package-info.java similarity index 100% rename from modules/ProtocolLib/src/main/java/com/comphenix/protocol/package-info.java rename to modules/API/src/main/java/com/comphenix/protocol/package-info.java diff --git a/modules/API/src/main/java/com/comphenix/protocol/reflect/StructureModifier.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/StructureModifier.java index d50ebd68..51fe1c3f 100644 --- a/modules/API/src/main/java/com/comphenix/protocol/reflect/StructureModifier.java +++ b/modules/API/src/main/java/com/comphenix/protocol/reflect/StructureModifier.java @@ -27,6 +27,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; import com.comphenix.protocol.ProtocolLibrary; +import com.comphenix.protocol.ProtocolLogger; import com.comphenix.protocol.error.PluginContext; import com.comphenix.protocol.reflect.compiler.BackgroundCompiler; import com.comphenix.protocol.reflect.instances.BannedGenerator; @@ -198,8 +199,8 @@ public class StructureModifier { } catch (FieldAccessException ex) { String plugin = PluginContext.getPluginCaller(ex); if (ProtocolLibrary.INCOMPATIBLE.contains(plugin)) { - ProtocolLibrary.log(Level.WARNING, "Encountered an exception caused by incompatible plugin {0}.", plugin); - ProtocolLibrary.log(Level.WARNING, "It is advised that you remove it."); + ProtocolLogger.log(Level.WARNING, "Encountered an exception caused by incompatible plugin {0}.", plugin); + ProtocolLogger.log(Level.WARNING, "It is advised that you remove it."); } throw ex; @@ -328,8 +329,8 @@ public class StructureModifier { } catch (FieldAccessException ex) { String plugin = PluginContext.getPluginCaller(ex); if (ProtocolLibrary.INCOMPATIBLE.contains(plugin)) { - ProtocolLibrary.log(Level.WARNING, "Encountered an exception caused by incompatible plugin {0}.", plugin); - ProtocolLibrary.log(Level.WARNING, "It is advised that you remove it."); + ProtocolLogger.log(Level.WARNING, "Encountered an exception caused by incompatible plugin {0}.", plugin); + ProtocolLogger.log(Level.WARNING, "It is advised that you remove it."); } throw ex; diff --git a/modules/API/src/main/java/com/comphenix/protocol/reflect/VolatileField.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/VolatileField.java index 7efa2897..12185722 100644 --- a/modules/API/src/main/java/com/comphenix/protocol/reflect/VolatileField.java +++ b/modules/API/src/main/java/com/comphenix/protocol/reflect/VolatileField.java @@ -19,7 +19,7 @@ package com.comphenix.protocol.reflect; import java.lang.reflect.Field; -import com.comphenix.protocol.ProtocolLibrary; +import com.comphenix.protocol.ProtocolLogger; import com.comphenix.protocol.reflect.accessors.Accessors; import com.comphenix.protocol.reflect.accessors.FieldAccessor; import com.google.common.base.Objects; @@ -184,8 +184,7 @@ public class VolatileField { currentSet = false; } else { // This can be a bad sign - ProtocolLibrary.log("Unable to switch {0} to {1}. Expected {2}, but got {3}.", - getField().toGenericString(), previous, current, getValue()); + ProtocolLogger.log("Unable to switch {0} to {1}. Expected {2}, but got {3}.", getField().toGenericString(), previous, current, getValue()); } } } diff --git a/modules/API/src/main/java/com/comphenix/protocol/reflect/instances/DefaultInstances.java b/modules/API/src/main/java/com/comphenix/protocol/reflect/instances/DefaultInstances.java index 299b6ddd..37fc5a9b 100644 --- a/modules/API/src/main/java/com/comphenix/protocol/reflect/instances/DefaultInstances.java +++ b/modules/API/src/main/java/com/comphenix/protocol/reflect/instances/DefaultInstances.java @@ -26,7 +26,7 @@ import javax.annotation.Nullable; import net.sf.cglib.proxy.Enhancer; -import com.comphenix.protocol.ProtocolLibrary; +import com.comphenix.protocol.ProtocolLogger; import com.google.common.base.Objects; import com.google.common.collect.ImmutableList; @@ -284,7 +284,7 @@ public class DefaultInstances implements InstanceProvider { // Did we break the non-null contract? if (params[i] == null && nonNull) { - ProtocolLibrary.log(Level.WARNING, "Nonnull contract broken."); + ProtocolLogger.log(Level.WARNING, "Nonnull contract broken."); return null; } } diff --git a/modules/API/src/main/java/com/comphenix/protocol/utility/MinecraftReflection.java b/modules/API/src/main/java/com/comphenix/protocol/utility/MinecraftReflection.java index 9bdd9338..70dded99 100644 --- a/modules/API/src/main/java/com/comphenix/protocol/utility/MinecraftReflection.java +++ b/modules/API/src/main/java/com/comphenix/protocol/utility/MinecraftReflection.java @@ -46,6 +46,7 @@ import org.bukkit.inventory.ItemStack; import com.comphenix.protocol.PacketType; import com.comphenix.protocol.ProtocolLibrary; +import com.comphenix.protocol.ProtocolLogger; import com.comphenix.protocol.error.ErrorReporter; import com.comphenix.protocol.error.Report; import com.comphenix.protocol.error.ReportType; @@ -208,7 +209,7 @@ public class MinecraftReflection { if (MinecraftVersion.SCARY_UPDATE.compareTo(version) <= 0) { // Just assume R1 - it's probably fine packageVersion = "v" + version.getMajor() + "_" + version.getMinor() + "_R1"; - ProtocolLibrary.log(Level.WARNING, "Assuming package version: " + packageVersion); + ProtocolLogger.log(Level.WARNING, "Assuming package version: " + packageVersion); } } diff --git a/modules/API/src/main/java/com/comphenix/protocol/utility/Util.java b/modules/API/src/main/java/com/comphenix/protocol/utility/Util.java index 7244597d..ff921a87 100644 --- a/modules/API/src/main/java/com/comphenix/protocol/utility/Util.java +++ b/modules/API/src/main/java/com/comphenix/protocol/utility/Util.java @@ -16,48 +16,24 @@ */ package com.comphenix.protocol.utility; -import java.lang.reflect.Method; import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; import java.util.List; import org.bukkit.Bukkit; import org.bukkit.entity.Player; -import com.comphenix.protocol.reflect.accessors.Accessors; -import com.comphenix.protocol.reflect.accessors.MethodAccessor; - /** * General utility class * @author dmulloy2 */ - public class Util { - private static MethodAccessor getOnlinePlayers; - private static boolean reflectionRequired; - - static { - try { - Method method = Bukkit.class.getMethod("getOnlinePlayers"); - getOnlinePlayers = Accessors.getMethodAccessor(method); - reflectionRequired = !method.getReturnType().isAssignableFrom(Collection.class); - } catch (Throwable ex) { - throw new RuntimeException("Failed to obtain getOnlinePlayers method.", ex); - } - } /** - * Gets a list of online {@link Player}s. This also provides backwards - * compatibility, since Bukkit changed getOnlinePlayers in 1.7.9. - * @return A list of currently online Players + * Gets a list of currently online Players. + * @return The list */ @SuppressWarnings("unchecked") public static List getOnlinePlayers() { - if (reflectionRequired) { - return Arrays.asList((Player[]) getOnlinePlayers.invoke(null)); - } - return (List) Bukkit.getOnlinePlayers(); } diff --git a/modules/API/src/main/java/com/comphenix/protocol/wrappers/MinecraftKey.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/MinecraftKey.java index e8679743..c758d806 100644 --- a/modules/API/src/main/java/com/comphenix/protocol/wrappers/MinecraftKey.java +++ b/modules/API/src/main/java/com/comphenix/protocol/wrappers/MinecraftKey.java @@ -23,6 +23,10 @@ import com.comphenix.protocol.reflect.StructureModifier; import com.comphenix.protocol.utility.MinecraftReflection; /** + * Represents a MinecraftKey in 1.9. + *

+ * Keys are in the format {@code prefix:key} + * * @author dmulloy2 */ @@ -30,36 +34,75 @@ public class MinecraftKey { private final String prefix; private final String key; + /** + * Constructs a new key with a given prefix and key. + * + * @param prefix The prefix, usually minecraft. + * @param key The key, the part we care about + */ public MinecraftKey(String prefix, String key) { this.prefix = prefix; this.key = key; } + /** + * Constructs a new key with minecraft prefix and a key. + * @param key The key + */ public MinecraftKey(String key) { this("minecraft", key); } + /** + * Creates a MinecraftKey wrapper from a Minecraft handle. + * @param handle The handle + * @return The resulting key + */ public static MinecraftKey fromHandle(Object handle) { StructureModifier modifier = new StructureModifier(handle.getClass()).withTarget(handle).withType(String.class); return new MinecraftKey(modifier.read(0), modifier.read(1)); } + /** + * Creates a MinecraftKey wrapper from an Enum constant. The resulting key + * is lower case, with underscores replaced by periods. + * @param value The value + * @return The resulting key + */ public static MinecraftKey fromEnum(Enum value) { return new MinecraftKey(value.name().toLowerCase().replace("_", ".")); } + /** + * Gets the prefix of this MinecraftKey. It is minecraft by default. + * @return The prefix + */ public String getPrefix() { return prefix; } + /** + * Gets the key of this MinecraftKey. It is generally the important part. + * @return The key + */ public String getKey() { return key; } + /** + * Gets the full key of this MinecraftKey. It is in the format of + * {@code prefix:key} + * @return The full key + */ public String getFullKey() { return prefix + ":" + key; } + /** + * Returns this key back into Enum format, upper case with periods replaced + * by underscores. + * @return The enum format + */ public String getEnumFormat() { return key.toUpperCase().replace(".", "_"); } diff --git a/modules/API/src/main/java/com/comphenix/protocol/wrappers/WrappedDataWatcher.java b/modules/API/src/main/java/com/comphenix/protocol/wrappers/WrappedDataWatcher.java index 94e3cd16..b37fc386 100644 --- a/modules/API/src/main/java/com/comphenix/protocol/wrappers/WrappedDataWatcher.java +++ b/modules/API/src/main/java/com/comphenix/protocol/wrappers/WrappedDataWatcher.java @@ -68,8 +68,11 @@ public class WrappedDataWatcher extends AbstractWrapper implements Iterable modifier; /** - * Creates a new watcher object from a NMS handle + * Creates a new watcher object from a NMS handle. * - * @param handle NMS handle + * @param handle The handle */ public WrappedDataWatcherObject(Object handle) { super(HANDLE_TYPE); @@ -536,7 +557,7 @@ public class WrappedDataWatcher extends AbstractWrapper implements Iterable *

  • Byte
  • @@ -668,14 +693,6 @@ public class WrappedDataWatcher extends AbstractWrapper implements Iterable REGISTRY = new ArrayList<>(); - /** - * Gets the serializer associated with a given class.
    - * Note: If {@link Serializer#isOptional()}, the values must be wrapped in {@link Optional} - * - * @param clazz Class to find serializer for - * @return The serializer, or null if none exists - */ - /** * Gets the first serializer associated with a given class. * @@ -704,7 +721,8 @@ public class WrappedDataWatcher extends AbstractWrapper implements IterableNote: If the serializer is optional, values must be wrapped in an {@link Optional} + *

    Note: If the serializer is optional, values must be + * wrapped in an {@link Optional} * * @param clazz Class to find serializer for * @param optional Optional state @@ -726,7 +744,7 @@ public class WrappedDataWatcher extends AbstractWrapper implements Iterable updateTime && !updater.isChecking()) { + if (currentTime > updateTime && !updater.isChecking()) { // Initiate the update as if it came from the console if (config.isAutoDownload()) commandProtocol.updateVersion(getServer().getConsoleSender(), false); else if (config.isAutoNotify()) commandProtocol.checkVersion(getServer().getConsoleSender(), false); - else + else commandProtocol.updateFinished(); } } catch (Exception e) { @@ -669,32 +668,6 @@ public class ProtocolLib extends JavaPlugin { return log; } - /** - * Retrieve the current error reporter. - *

    - * This is guaranteed to not be NULL in 2.5.0 and later. - * @return Current error reporter. - */ - public static ErrorReporter getErrorReporter() { - return reporter; - } - - /** - * Retrieve the current strongly typed configuration. - * @return The configuration, or NULL if ProtocolLib hasn't loaded yet. - */ - public static ProtocolConfig getConfiguration() { - return config; - } - - /** - * Retrieves the packet protocol manager. - * @return Packet protocol manager, or NULL if it has been disabled. - */ - public static ProtocolManager getProtocolManager() { - return protocolManager; - } - /** * Retrieve the metrics instance used to measure users of this library. *

    @@ -705,38 +678,4 @@ public class ProtocolLib extends JavaPlugin { public Statistics getStatistics() { return statistics; } - - /** - * Retrieve an executor service for performing asynchronous tasks on the behalf of ProtocolLib. - *

    - * Note that this service is NULL if ProtocolLib has not been initialized yet. - * @return The executor service, or NULL. - */ - public static ListeningScheduledExecutorService getExecutorAsync() { - return executorAsync; - } - - /** - * Retrieve an executor service for performing synchronous tasks (main thread) on the behalf of ProtocolLib. - *

    - * Note that this service is NULL if ProtocolLib has not been initialized yet. - * @return The executor service, or NULL. - */ - public static ListeningScheduledExecutorService getExecutorSync() { - return executorSync; - } - - // ---- Logging Methods - - public static void log(Level level, String message, Object... args) { - logger.log(level, MessageFormat.format(message, args)); - } - - public static void log(String message, Object... args) { - log(Level.INFO, message, args); - } - - public static void log(Level level, String message, Throwable ex) { - logger.log(level, message, ex); - } -} +} \ No newline at end of file