diff --git a/CHANGELOG.md b/CHANGELOG.md
index cbbb83cd..119be284 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,9 @@
+######0.3.2
+
+* Run packet readers in a different thread (separated from the Netty I/O Thread)
+-> Improves performance
+* Fixed Plugin disable if the server is in online mode but have to be in offline mode
+
######0.3.1
* Improved BungeeCord security
diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java
index 3e87d9b8..51f4dce5 100644
--- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java
+++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java
@@ -1,14 +1,15 @@
package com.github.games647.fastlogin.bukkit;
+import com.comphenix.protocol.AsynchronousManager;
import com.github.games647.fastlogin.bukkit.listener.BukkitJoinListener;
import com.github.games647.fastlogin.bukkit.listener.StartPacketListener;
import com.github.games647.fastlogin.bukkit.listener.BungeeCordListener;
import com.github.games647.fastlogin.bukkit.listener.EncryptionPacketListener;
-import com.github.games647.fastlogin.bukkit.listener.HandshakePacketListener;
import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.ProtocolManager;
import com.comphenix.protocol.utility.SafeCacheBuilder;
import com.github.games647.fastlogin.bukkit.hooks.AuthPlugin;
+import com.github.games647.fastlogin.bukkit.listener.HandshakePacketListener;
import com.google.common.cache.CacheLoader;
import com.google.common.collect.MapMaker;
import com.google.common.collect.Sets;
@@ -59,28 +60,23 @@ public class FastLoginBukkit extends JavaPlugin {
}
});
- @Override
- public void onLoad() {
- //online mode is only changeable after a restart so check it here
- if (getServer().getOnlineMode()) {
- //we need to require offline to prevent a session request for a offline player
- getLogger().severe("Server have to be in offline mode");
-
- setEnabled(false);
- }
- }
-
@Override
public void onEnable() {
- if (!isEnabled() || !registerHooks()) {
+ if (getServer().getOnlineMode() || !registerHooks()) {
+ //we need to require offline to prevent a session request for a offline player
+ getLogger().severe("Server have to be in offline mode and have an auth plugin installed");
+ setEnabled(false);
return;
}
//register packet listeners on success
ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager();
protocolManager.addPacketListener(new HandshakePacketListener(this));
- protocolManager.addPacketListener(new StartPacketListener(this, protocolManager));
- protocolManager.addPacketListener(new EncryptionPacketListener(this, protocolManager));
+
+ //we are performing HTTP request on these so run it async (seperate from the Netty IO threads)
+ AsynchronousManager asynchronousManager = protocolManager.getAsynchronousManager();
+ asynchronousManager.registerAsyncHandler(new StartPacketListener(this, protocolManager)).start();
+ asynchronousManager.registerAsyncHandler(new EncryptionPacketListener(this, protocolManager)).start();
//register commands using a unique name
getCommand("premium").setExecutor(new PremiumCommand(this));
diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/PremiumCommand.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/PremiumCommand.java
index 36459cd1..4f682fed 100644
--- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/PremiumCommand.java
+++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/PremiumCommand.java
@@ -2,6 +2,7 @@ package com.github.games647.fastlogin.bukkit;
import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams;
+
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/EncryptionPacketListener.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/EncryptionPacketListener.java
index 4348b04a..3108e48b 100644
--- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/EncryptionPacketListener.java
+++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/EncryptionPacketListener.java
@@ -28,7 +28,6 @@ import java.util.logging.Level;
import javax.crypto.SecretKey;
import org.bukkit.entity.Player;
-import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.JSONValue;
@@ -205,7 +204,6 @@ public class EncryptionPacketListener extends PacketAdapter {
private boolean hasJoinedServer(String username, String serverId) {
try {
String url = HAS_JOINED_URL + "username=" + username + "&serverId=" + serverId;
-
HttpURLConnection conn = plugin.getConnection(url);
BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
@@ -215,13 +213,6 @@ public class EncryptionPacketListener extends PacketAdapter {
//http://wiki.vg/Protocol_Encryption#Server
JSONObject userData = (JSONObject) JSONValue.parseWithException(line);
String uuid = (String) userData.get("id");
- String name = (String) userData.get("name");
-
- JSONArray properties = (JSONArray) userData.get("properties");
- JSONObject skinData = (JSONObject) properties.get(0);
- //base64 encoded skin data
- String encodedSkin = (String) skinData.get("value");
-
return true;
}
} catch (Exception ex) {
diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/HandshakePacketListener.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/HandshakePacketListener.java
index e873b24d..425d3436 100644
--- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/HandshakePacketListener.java
+++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/HandshakePacketListener.java
@@ -11,17 +11,12 @@ import java.util.logging.Level;
/**
* Listens to incoming handshake packets.
*
- * As BungeeCord sends additional information on the Handshake,
- * we can detect it and check so if the player is coming from a
- * BungeeCord instance. IpForward has to be activated in the
- * BungeeCord config to send these extra information.
+ * As BungeeCord sends additional information on the Handshake, we can detect it and check so if the player is coming
+ * from a BungeeCord instance. IpForward has to be activated in the BungeeCord config to send these extra information.
*
- * Packet information:
- * http://wiki.vg/Protocol#Handshake
+ * Packet information: http://wiki.vg/Protocol#Handshake
*
- * Int=Protocol version
- * String=connecting server address (and additional information from BungeeCord)
- * int=server port
+ * Int=Protocol version String=connecting server address (and additional information from BungeeCord) int=server port
* int=next state
*/
public class HandshakePacketListener extends PacketAdapter {
diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/StartPacketListener.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/StartPacketListener.java
index 737fad06..114cf4f6 100644
--- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/StartPacketListener.java
+++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/StartPacketListener.java
@@ -12,7 +12,6 @@ import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.net.HttpURLConnection;
import java.security.PublicKey;
-
import java.util.Random;
import java.util.logging.Level;
import java.util.regex.Pattern;
diff --git a/pom.xml b/pom.xml
index f8960d3d..a8f241f1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -17,6 +17,8 @@
UTF-8
+
+ ${basedir}/target
@@ -55,6 +57,15 @@
false
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 2.6
+
+ ${outputDir}
+
+