Skip to content

Commit 6e0272d

Browse files
author
games647
committed
Fix receiving login packet twice with ProtocolLib
Fixes #578 Commit that introduces the bug: 1f47576
1 parent 758ccb9 commit 6e0272d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/VerifyResponseTask.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,13 +202,14 @@ private boolean checkVerifyToken(BukkitLoginSession session) throws GeneralSecur
202202
private Object getNetworkManager() throws IllegalAccessException, ClassNotFoundException {
203203
Object injectorContainer = TemporaryPlayerFactory.getInjectorFromPlayer(player);
204204

205-
//ChannelInjector
205+
// ChannelInjector
206206
Class<?> injectorClass = Class.forName("com.comphenix.protocol.injector.netty.Injector");
207207
Object rawInjector = FuzzyReflection.getFieldValue(injectorContainer, injectorClass, true);
208208
return FieldUtils.readField(rawInjector, "networkManager", true);
209209
}
210210

211211
private boolean enableEncryption(SecretKey loginKey) throws IllegalArgumentException {
212+
plugin.getLog().info("Enabling onlinemode encryption for {}", player.getName());
212213
// Initialize method reflections
213214
if (encryptMethod == null) {
214215
Class<?> networkManagerClass = MinecraftReflection.getNetworkManagerClass();
@@ -285,8 +286,8 @@ private void receiveFakeStartPacket(String username) {
285286
startPacket.getGameProfiles().write(0, fakeProfile);
286287
try {
287288
//we don't want to handle our own packets so ignore filters
288-
ProtocolLibrary.getProtocolManager().recieveClientPacket(player, startPacket, true);
289289
startPacket.setMeta(ProtocolLibListener.SOURCE_META_KEY, plugin.getName());
290+
ProtocolLibrary.getProtocolManager().recieveClientPacket(player, startPacket, true);
290291
} catch (InvocationTargetException | IllegalAccessException ex) {
291292
plugin.getLog().warn("Failed to fake a new start packet for: {}", username, ex);
292293
//cancel the event in order to prevent the server receiving an invalid packet

0 commit comments

Comments
 (0)