Bungeecord support added x9

This commit is contained in:
Michael Wain 2025-03-21 21:27:27 +03:00
parent 123d8c0f2b
commit 24905d7694
2 changed files with 4 additions and 10 deletions

View File

@ -29,15 +29,9 @@ import static com.alterdekim.xcraft.auth.bungee.XCraft.INTERNAL_PORT;
public class EncryptionResponsePacket extends EncryptionResponse { public class EncryptionResponsePacket extends EncryptionResponse {
private final Logger logger;
public EncryptionResponsePacket(Logger logger) {
this.logger = logger;
}
@Override @Override
public void handle(AbstractPacketHandler handler) throws Exception { public void handle(AbstractPacketHandler handler) throws Exception {
this.logger.info("Intercepted handle request, returning custom response..."); //this.logger.info("Intercepted handle request, returning custom response...");
InitialHandler initialHandler = (InitialHandler) handler; InitialHandler initialHandler = (InitialHandler) handler;
Class<?> initialHandlerClass = InitialHandler.class; Class<?> initialHandlerClass = InitialHandler.class;
Method finish = initialHandlerClass.getDeclaredMethod("finish"); Method finish = initialHandlerClass.getDeclaredMethod("finish");
@ -88,13 +82,13 @@ public class EncryptionResponsePacket extends EncryptionResponse {
finish.invoke(initialHandler); finish.invoke(initialHandler);
return; return;
} catch (Exception e) { } catch (Exception e) {
EncryptionResponsePacket.this.logger.log(Level.SEVERE, "Error authenticating " + initialHandler.getName() + " with XCraftAuth", e); //EncryptionResponsePacket.this.logger.log(Level.SEVERE, "Error authenticating " + initialHandler.getName() + " with XCraftAuth", e);
} }
} }
initialHandler.disconnect("You're in offline mode"); initialHandler.disconnect("You're in offline mode");
} else { } else {
initialHandler.disconnect("XCraftAuth has failed to authenticate you"); initialHandler.disconnect("XCraftAuth has failed to authenticate you");
EncryptionResponsePacket.this.logger.log(Level.SEVERE, "Error authenticating " + initialHandler.getName() + " with XCraftAuth", error); //EncryptionResponsePacket.this.logger.log(Level.SEVERE, "Error authenticating " + initialHandler.getName() + " with XCraftAuth", error);
} }
} }
}; };

View File

@ -93,7 +93,7 @@ public class XCraft extends Plugin {
packetMap.remove(EncryptionResponse.class); packetMap.remove(EncryptionResponse.class);
packetConstructors.remove(0x01); packetConstructors.remove(0x01);
packetMap.put( EncryptionResponsePacket.class, 0x01); packetMap.put( EncryptionResponsePacket.class, 0x01);
packetConstructors.put( 0x01, EncryptionResponsePacket.class.getDeclaredConstructor(Logger.class).newInstance(getLogger()) ); packetConstructors.put( 0x01, EncryptionResponsePacket.class.getDeclaredConstructor() );
packetMapField.set(protocolData, packetMap); packetMapField.set(protocolData, packetMap);
packetConstructorsField.set(protocolData, packetConstructors); packetConstructorsField.set(protocolData, packetConstructors);