From f06145ea5fd3e50c0e4610b84e2d3ceabfaea974 Mon Sep 17 00:00:00 2001 From: ajgeiss0702 Date: Sat, 4 Sep 2021 14:10:15 -0700 Subject: [PATCH] more connection fail reasons on bungee --- .../velocity/players/VelocityPlayer.java | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/platforms/velocity/src/main/java/us/ajg0702/queue/platforms/velocity/players/VelocityPlayer.java b/platforms/velocity/src/main/java/us/ajg0702/queue/platforms/velocity/players/VelocityPlayer.java index e9ae34c..d4c64ba 100644 --- a/platforms/velocity/src/main/java/us/ajg0702/queue/platforms/velocity/players/VelocityPlayer.java +++ b/platforms/velocity/src/main/java/us/ajg0702/queue/platforms/velocity/players/VelocityPlayer.java @@ -121,9 +121,27 @@ public class VelocityPlayer implements AdaptedPlayer, Audience { result -> { if(!result.isSuccessful()) { QueueMain main = QueueMain.getInstance(); - Component reason = result.getReasonComponent().orElseGet( - () -> Component.text("Connection failed") - ); + Component reason = result.getReasonComponent().orElse(null); + if(reason == null) { + switch (result.getStatus()) { + case SUCCESS: + reason = Component.text("Success"); + break; + case ALREADY_CONNECTED: + reason = Component.text("Already connected"); + break; + case CONNECTION_IN_PROGRESS: + reason = Component.text("Already connecting"); + break; + case CONNECTION_CANCELLED: + reason = Component.text("Connection canceled"); + break; + case SERVER_DISCONNECTED: + reason = Component.text("Connection failed with unknown reason"); + break; + } + } + if(main.getConfig().getBoolean("velocity-kick-message")) { handle.sendMessage( main.getMessages().getComponent(