From c77103246e4ebe48f2fba6f7224d019fef9cefb4 Mon Sep 17 00:00:00 2001 From: "Kristian S. Stangeland" Date: Sun, 30 Sep 2012 00:25:04 +0200 Subject: [PATCH] Small bug fixes. --- ProtocolLib/src/com/comphenix/protocol/ProtocolLibrary.java | 2 +- .../src/com/comphenix/protocol/async/AsyncFilterManager.java | 4 +++- .../com/comphenix/protocol/async/AsyncListenerHandler.java | 1 - 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ProtocolLib/src/com/comphenix/protocol/ProtocolLibrary.java b/ProtocolLib/src/com/comphenix/protocol/ProtocolLibrary.java index a3a7e31d..2305cc7f 100644 --- a/ProtocolLib/src/com/comphenix/protocol/ProtocolLibrary.java +++ b/ProtocolLib/src/com/comphenix/protocol/ProtocolLibrary.java @@ -92,7 +92,7 @@ public class ProtocolLibrary extends JavaPlugin { private void createAsyncTask(Server server) { try { - if (asyncPacketTask < 0) + if (asyncPacketTask >= 0) throw new IllegalStateException("Async task has already been created"); // Attempt to create task diff --git a/ProtocolLib/src/com/comphenix/protocol/async/AsyncFilterManager.java b/ProtocolLib/src/com/comphenix/protocol/async/AsyncFilterManager.java index c10770b5..974125b6 100644 --- a/ProtocolLib/src/com/comphenix/protocol/async/AsyncFilterManager.java +++ b/ProtocolLib/src/com/comphenix/protocol/async/AsyncFilterManager.java @@ -1,5 +1,6 @@ package com.comphenix.protocol.async; +import java.util.Collection; import java.util.List; import java.util.Set; import java.util.concurrent.atomic.AtomicInteger; @@ -177,7 +178,8 @@ public class AsyncFilterManager implements AsynchronousManager { @Override public boolean hasAsynchronousListeners(PacketEvent packet) { - return getProcessingQueue(packet).getListener(packet.getPacketID()).size() > 0; + Collection list = getProcessingQueue(packet).getListener(packet.getPacketID()); + return list != null && list.size() > 0; } /** diff --git a/ProtocolLib/src/com/comphenix/protocol/async/AsyncListenerHandler.java b/ProtocolLib/src/com/comphenix/protocol/async/AsyncListenerHandler.java index 5687e8ca..6a0e6c0b 100644 --- a/ProtocolLib/src/com/comphenix/protocol/async/AsyncListenerHandler.java +++ b/ProtocolLib/src/com/comphenix/protocol/async/AsyncListenerHandler.java @@ -8,7 +8,6 @@ import org.bukkit.plugin.Plugin; import com.comphenix.protocol.events.PacketAdapter; import com.comphenix.protocol.events.PacketEvent; import com.comphenix.protocol.events.PacketListener; -import com.sun.org.apache.bcel.internal.generic.GETSTATIC; /** * Represents a handler for an asynchronous event.