diff --git a/ProtocolLib/src/com/comphenix/protocol/ProtocolLibrary.java b/ProtocolLib/src/com/comphenix/protocol/ProtocolLibrary.java index bb01a1b2..b2af48cc 100644 --- a/ProtocolLib/src/com/comphenix/protocol/ProtocolLibrary.java +++ b/ProtocolLib/src/com/comphenix/protocol/ProtocolLibrary.java @@ -81,6 +81,8 @@ public class ProtocolLibrary extends JavaPlugin { /** * Retrieve the metrics instance used to measure users of this library. + *
+ * Note that this method may return NULL when the server is reloading or shutting down.
* @return Metrics instance container.
*/
public Statistics getStatistics() {
diff --git a/ProtocolLib/src/com/comphenix/protocol/ProtocolManager.java b/ProtocolLib/src/com/comphenix/protocol/ProtocolManager.java
index f2735874..c492e235 100644
--- a/ProtocolLib/src/com/comphenix/protocol/ProtocolManager.java
+++ b/ProtocolLib/src/com/comphenix/protocol/ProtocolManager.java
@@ -40,13 +40,19 @@ public interface ProtocolManager {
public ImmutableSet
+ * Adding an already registered listener has no effect. If you need to change the packets
+ * the current listener is observing, you must first remove the packet listener before you
+ * can register it again.
* @param listener - new packet listener.
*/
public void addPacketListener(PacketListener listener);
/**
- * Removes a given packet listener.
+ * Removes a given packet listener.
+ *
+ * Attempting to remove a listener that doesn't exist has no effect.
* @param listener - the packet listener to remove.
*/
public void removePacketListener(PacketListener listener);
@@ -107,16 +113,16 @@ public interface ProtocolManager {
/**
* Constructs a new encapsulated Minecraft packet with the given ID.
*
- * If set to true, the skip default option will prevent the system from assigning
- * non-primitive fields in the packet to a new default instance. For instance, certain
+ * If set to true, the forceDefaults option will force the system to automatically
+ * give non-primitive fields in the packet sensible default values. For instance, certain
* packets - like Packet60Explosion - require a List or Set to be non-null. If the
- * skipDefaults option is false, the List or Set will be automatically created.
+ * forceDefaults option is true, the List or Set will be automatically created.
*
* @param id - packet ID.
- * @param skipDefaults - TRUE to skip setting default values, FALSE otherwise.
+ * @param forceDefaults - TRUE to use sensible defaults in most fields, FALSE otherwise.
* @return New encapsulated Minecraft packet.
*/
- public PacketContainer createPacket(int id, boolean skipDefaults);
+ public PacketContainer createPacket(int id, boolean forceDefaults);
/**
* Retrieves a immutable set containing the ID of the sent server packets that will be observed by listeners.
diff --git a/ProtocolLib/src/com/comphenix/protocol/events/PacketAdapter.java b/ProtocolLib/src/com/comphenix/protocol/events/PacketAdapter.java
index 9a1dc40d..58845e87 100644
--- a/ProtocolLib/src/com/comphenix/protocol/events/PacketAdapter.java
+++ b/ProtocolLib/src/com/comphenix/protocol/events/PacketAdapter.java
@@ -19,7 +19,6 @@ package com.comphenix.protocol.events;
import org.bukkit.plugin.Plugin;
-
/**
* Represents a packet listener with useful constructors.
*
@@ -33,7 +32,7 @@ public abstract class PacketAdapter implements PacketListener {
protected ListeningWhitelist sendingWhitelist = ListeningWhitelist.EMPTY_WHITELIST;
/**
- * Initialize a packet listener.
+ * Initialize a packet listener with default priority.
* @param plugin - the plugin that spawned this listener.
* @param connectionSide - the packet type the listener is looking for.
* @param packets - the packet IDs the listener is looking for.
@@ -43,7 +42,7 @@ public abstract class PacketAdapter implements PacketListener {
}
/**
- * Initialize a packet listener.
+ * Initialize a packet listener for a single connection side.
* @param plugin - the plugin that spawned this listener.
* @param connectionSide - the packet type the listener is looking for.
* @param listenerPriority - the event priority.
diff --git a/ProtocolLib/src/com/comphenix/protocol/events/PacketListener.java b/ProtocolLib/src/com/comphenix/protocol/events/PacketListener.java
index aab19240..7594686b 100644
--- a/ProtocolLib/src/com/comphenix/protocol/events/PacketListener.java
+++ b/ProtocolLib/src/com/comphenix/protocol/events/PacketListener.java
@@ -21,6 +21,8 @@ import org.bukkit.plugin.Plugin;
/**
* Represents a listener that recieves notifications when packets are sent or recieved.
+ *
+ * Use {@link PacketAdapter} for a simple wrapper around this interface.
* @author Kristian
*/
public interface PacketListener {
diff --git a/ProtocolLib/src/com/comphenix/protocol/injector/ConcurrentListenerMultimap.java b/ProtocolLib/src/com/comphenix/protocol/injector/ConcurrentListenerMultimap.java
index 845b3866..ec4542e6 100644
--- a/ProtocolLib/src/com/comphenix/protocol/injector/ConcurrentListenerMultimap.java
+++ b/ProtocolLib/src/com/comphenix/protocol/injector/ConcurrentListenerMultimap.java
@@ -29,6 +29,7 @@ public class ConcurrentListenerMultimap {
/**
* Adds a listener to its requested list of packet recievers.
* @param listener - listener with a list of packets to recieve notifcations for.
+ * @param whitelist - the packet whitelist to use.
*/
public void addListener(PacketListener listener, ListeningWhitelist whitelist) {
@@ -66,6 +67,7 @@ public class ConcurrentListenerMultimap {
/**
* Removes the given listener from the packet event list.
* @param listener - listener to remove.
+ * @param whitelist - the packet whitelist that was used.
* @return Every packet ID that was removed due to no listeners.
*/
public List