more connection fail reasons on bungee

This commit is contained in:
ajgeiss0702
2021-09-04 14:10:15 -07:00
parent 2a874888c6
commit f06145ea5f
@@ -121,9 +121,27 @@ public class VelocityPlayer implements AdaptedPlayer, Audience {
result -> { result -> {
if(!result.isSuccessful()) { if(!result.isSuccessful()) {
QueueMain main = QueueMain.getInstance(); QueueMain main = QueueMain.getInstance();
Component reason = result.getReasonComponent().orElseGet( Component reason = result.getReasonComponent().orElse(null);
() -> Component.text("Connection failed") 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")) { if(main.getConfig().getBoolean("velocity-kick-message")) {
handle.sendMessage( handle.sendMessage(
main.getMessages().getComponent( main.getMessages().getComponent(