diff --git a/gradle.properties b/gradle.properties index 07050f0..c952d4e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ group = io.github.4drian3d -version = 4.1.1 +version = 4.1.2-SHAPSHOT description = AuthMeReloaded Support for Velocity url = https://modrinth.com/plugin/authmevelocity id = authmevelocity diff --git a/velocity/src/main/java/io/github/_4drian3d/authmevelocity/velocity/listener/connection/PostConnectListener.java b/velocity/src/main/java/io/github/_4drian3d/authmevelocity/velocity/listener/connection/PostConnectListener.java index 4d5d3ff..61518b9 100644 --- a/velocity/src/main/java/io/github/_4drian3d/authmevelocity/velocity/listener/connection/PostConnectListener.java +++ b/velocity/src/main/java/io/github/_4drian3d/authmevelocity/velocity/listener/connection/PostConnectListener.java @@ -17,8 +17,6 @@ package io.github._4drian3d.authmevelocity.velocity.listener.connection; -import com.google.common.io.ByteArrayDataOutput; -import com.google.common.io.ByteStreams; import com.google.inject.Inject; import com.velocitypowered.api.event.EventManager; import com.velocitypowered.api.event.EventTask; @@ -61,13 +59,13 @@ public EventTask executeAsync(final ServerPostConnectEvent event) { } plugin.logDebug("ServerPostConnectEvent | Already logged player and connected to an Auth server"); - final ByteArrayDataOutput buf = ByteStreams.newDataOutput(); - buf.writeUTF("LOGIN"); - buf.writeUTF(player.getUsername()); - - final byte[] byteArray = buf.toByteArray(); - plugin.logDebug(() -> "ServerPostConnectEvent | " + player.getUsername() + " | Sending LOGIN data"); - if (server.sendPluginMessage(AuthMeVelocityPlugin.MODERN_CHANNEL, byteArray)) { + final boolean messageResult = server.sendPluginMessage(AuthMeVelocityPlugin.MODERN_CHANNEL, (encoder) -> { + plugin.logDebug(() -> "ServerPostConnectEvent | " + player.getUsername() + " | Encoding LOGIN data"); + encoder.writeUTF("LOGIN"); + encoder.writeUTF(player.getUsername()); + plugin.logDebug(() -> "ServerPostConnectEvent | " + player.getUsername() + " | Sending LOGIN data"); + }); + if (messageResult) { plugin.logDebug(() -> "ServerPostConnectEvent | " + player.getUsername() + " | Correctly send data"); } else { plugin.logDebug("ServerPostConnectEvent | Failed to send data");