fix: Fixed AutoLogin inconsistency
This commit is contained in:
parent
ee3d7b74dc
commit
9536b98b7d
@ -49,7 +49,7 @@ public final class AuthMeListener implements Listener {
|
|||||||
|
|
||||||
if (!preSendLoginEvent.isCancelled()) {
|
if (!preSendLoginEvent.isCancelled()) {
|
||||||
plugin.sendMessageToProxy(player, MessageType.LOGIN, player.getName());
|
plugin.sendMessageToProxy(player, MessageType.LOGIN, player.getName());
|
||||||
plugin.getLogger().info("LoginEvent | PreSendLoginEvent allowed");
|
plugin.logDebug("LoginEvent | PreSendLoginEvent allowed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ public final class MessageListener implements PluginMessageListener {
|
|||||||
@Override
|
@Override
|
||||||
public void onPluginMessageReceived(
|
public void onPluginMessageReceived(
|
||||||
final @NotNull String identifier,
|
final @NotNull String identifier,
|
||||||
final @NotNull Player player,
|
final @NotNull Player $,
|
||||||
final byte @NotNull [] bytes
|
final byte @NotNull [] bytes
|
||||||
) {
|
) {
|
||||||
if (identifier.equals("authmevelocity:main")) {
|
if (identifier.equals("authmevelocity:main")) {
|
||||||
@ -46,13 +46,18 @@ public final class MessageListener implements PluginMessageListener {
|
|||||||
final ByteArrayDataInput input = ByteStreams.newDataInput(bytes);
|
final ByteArrayDataInput input = ByteStreams.newDataInput(bytes);
|
||||||
|
|
||||||
final String data = input.readUTF();
|
final String data = input.readUTF();
|
||||||
processData(player, data);
|
final String username = input.readUTF();
|
||||||
|
processData(username, data);
|
||||||
plugin.logDebug("PluginMessage | AuthMeVelocity identifier processed");
|
plugin.logDebug("PluginMessage | AuthMeVelocity identifier processed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processData(Player player, String data) {
|
private void processData(String name, String data) {
|
||||||
if (MessageType.LOGIN.toString().equals(data)) {
|
if (MessageType.LOGIN.toString().equals(data)) {
|
||||||
|
final Player player = this.plugin.getServer().getPlayer(name);
|
||||||
|
if (player == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
plugin.logDebug("PluginMessage | Login Message");
|
plugin.logDebug("PluginMessage | Login Message");
|
||||||
Bukkit.getPluginManager().callEvent(new LoginByProxyEvent(player));
|
Bukkit.getPluginManager().callEvent(new LoginByProxyEvent(player));
|
||||||
AuthMeApi.getInstance().forceLogin(player);
|
AuthMeApi.getInstance().forceLogin(player);
|
||||||
|
@ -62,6 +62,7 @@ public final class PostConnectListener implements Listener<ServerPostConnectEven
|
|||||||
plugin.logDebug("ServerPostConnectEvent | Already logged player and connected to an Auth server");
|
plugin.logDebug("ServerPostConnectEvent | Already logged player and connected to an Auth server");
|
||||||
final ByteArrayDataOutput buf = ByteStreams.newDataOutput();
|
final ByteArrayDataOutput buf = ByteStreams.newDataOutput();
|
||||||
buf.writeUTF("LOGIN");
|
buf.writeUTF("LOGIN");
|
||||||
|
buf.writeUTF(player.getUsername());
|
||||||
|
|
||||||
final byte[] byteArray = buf.toByteArray();
|
final byte[] byteArray = buf.toByteArray();
|
||||||
plugin.logDebug("ServerPostConnectEvent | Sending LOGIN data");
|
plugin.logDebug("ServerPostConnectEvent | Sending LOGIN data");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user