mirror of
https://github.com/TuxCoding/FastLogin.git
synced 2025-08-02 04:04:42 +02:00
Use static builder to make it independent from ProtocolLib without throwing NoClassDefFoundError
This commit is contained in:
@@ -65,7 +65,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot-api</artifactId>
|
<artifactId>spigot-api</artifactId>
|
||||||
<version>1.10.2-R0.1-SNAPSHOT</version>
|
<version>1.11-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@
|
|||||||
<groupId>com.github.ProtocolSupport</groupId>
|
<groupId>com.github.ProtocolSupport</groupId>
|
||||||
<artifactId>ProtocolSupport</artifactId>
|
<artifactId>ProtocolSupport</artifactId>
|
||||||
<!--4.25.dev-->
|
<!--4.25.dev-->
|
||||||
<version>5554413b51</version>
|
<version>a4f060dc46</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!--Login Plugins-->
|
<!--Login Plugins-->
|
||||||
|
@@ -1,8 +1,6 @@
|
|||||||
package com.github.games647.fastlogin.bukkit;
|
package com.github.games647.fastlogin.bukkit;
|
||||||
|
|
||||||
import com.avaje.ebeaninternal.api.ClassUtil;
|
import com.avaje.ebeaninternal.api.ClassUtil;
|
||||||
import com.comphenix.protocol.AsynchronousManager;
|
|
||||||
import com.comphenix.protocol.ProtocolLibrary;
|
|
||||||
import com.github.games647.fastlogin.bukkit.commands.CrackedCommand;
|
import com.github.games647.fastlogin.bukkit.commands.CrackedCommand;
|
||||||
import com.github.games647.fastlogin.bukkit.commands.ImportCommand;
|
import com.github.games647.fastlogin.bukkit.commands.ImportCommand;
|
||||||
import com.github.games647.fastlogin.bukkit.commands.PremiumCommand;
|
import com.github.games647.fastlogin.bukkit.commands.PremiumCommand;
|
||||||
@@ -89,13 +87,13 @@ public class FastLoginBukkit extends JavaPlugin implements PlatformPlugin<Comman
|
|||||||
getServer().getPluginManager().registerEvents(new ProtocolSupportListener(this), this);
|
getServer().getPluginManager().registerEvents(new ProtocolSupportListener(this), this);
|
||||||
} else if (getServer().getPluginManager().isPluginEnabled("ProtocolLib")) {
|
} else if (getServer().getPluginManager().isPluginEnabled("ProtocolLib")) {
|
||||||
//we are performing HTTP request on these so run it async (seperate from the Netty IO threads)
|
//we are performing HTTP request on these so run it async (seperate from the Netty IO threads)
|
||||||
AsynchronousManager asynchronousManager = ProtocolLibrary.getProtocolManager().getAsynchronousManager();
|
|
||||||
|
|
||||||
StartPacketListener startPacketListener = new StartPacketListener(this);
|
//they will be created with a static builder, because otherwise it will throw a
|
||||||
EncryptionPacketListener encryptionPacketListener = new EncryptionPacketListener(this);
|
//java.lang.NoClassDefFoundError: com/comphenix/protocol/events/PacketListener if ProtocolSupport was
|
||||||
|
//only found
|
||||||
|
StartPacketListener.register(this, WORKER_THREADS);
|
||||||
|
EncryptionPacketListener.register(this, WORKER_THREADS);
|
||||||
|
|
||||||
asynchronousManager.registerAsyncHandler(startPacketListener).start(WORKER_THREADS);
|
|
||||||
asynchronousManager.registerAsyncHandler(encryptionPacketListener).start(WORKER_THREADS);
|
|
||||||
getServer().getPluginManager().registerEvents(new LoginSkinApplyListener(this), this);
|
getServer().getPluginManager().registerEvents(new LoginSkinApplyListener(this), this);
|
||||||
} else {
|
} else {
|
||||||
getLogger().warning("Either ProtocolLib or ProtocolSupport have to be installed "
|
getLogger().warning("Either ProtocolLib or ProtocolSupport have to be installed "
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
package com.github.games647.fastlogin.bukkit.listener.protocollib;
|
package com.github.games647.fastlogin.bukkit.listener.protocollib;
|
||||||
|
|
||||||
import com.comphenix.protocol.PacketType;
|
import com.comphenix.protocol.PacketType;
|
||||||
|
import com.comphenix.protocol.ProtocolLibrary;
|
||||||
import com.comphenix.protocol.events.PacketAdapter;
|
import com.comphenix.protocol.events.PacketAdapter;
|
||||||
import com.comphenix.protocol.events.PacketEvent;
|
import com.comphenix.protocol.events.PacketEvent;
|
||||||
import com.github.games647.fastlogin.bukkit.FastLoginBukkit;
|
import com.github.games647.fastlogin.bukkit.FastLoginBukkit;
|
||||||
@@ -35,6 +36,11 @@ public class EncryptionPacketListener extends PacketAdapter {
|
|||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void register(FastLoginBukkit plugin, int workerThreads) {
|
||||||
|
ProtocolLibrary.getProtocolManager().getAsynchronousManager()
|
||||||
|
.registerAsyncHandler(new EncryptionPacketListener(plugin)).start(workerThreads);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* C->S : Handshake State=2
|
* C->S : Handshake State=2
|
||||||
* C->S : Login Start
|
* C->S : Login Start
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
package com.github.games647.fastlogin.bukkit.listener.protocollib;
|
package com.github.games647.fastlogin.bukkit.listener.protocollib;
|
||||||
|
|
||||||
import com.comphenix.protocol.PacketType;
|
import com.comphenix.protocol.PacketType;
|
||||||
|
import com.comphenix.protocol.ProtocolLibrary;
|
||||||
import com.comphenix.protocol.events.PacketAdapter;
|
import com.comphenix.protocol.events.PacketAdapter;
|
||||||
import com.comphenix.protocol.events.PacketContainer;
|
import com.comphenix.protocol.events.PacketContainer;
|
||||||
import com.comphenix.protocol.events.PacketEvent;
|
import com.comphenix.protocol.events.PacketEvent;
|
||||||
@@ -38,6 +39,11 @@ public class StartPacketListener extends PacketAdapter {
|
|||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void register(FastLoginBukkit plugin, int workerThreads) {
|
||||||
|
ProtocolLibrary.getProtocolManager().getAsynchronousManager()
|
||||||
|
.registerAsyncHandler(new StartPacketListener(plugin)).start(workerThreads);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* C->S : Handshake State=2
|
* C->S : Handshake State=2
|
||||||
* C->S : Login Start
|
* C->S : Login Start
|
||||||
|
Reference in New Issue
Block a user