diff --git a/common/src/main/java/us/ajg0702/queue/common/QueueMain.java b/common/src/main/java/us/ajg0702/queue/common/QueueMain.java index 092ba4e..4816c74 100644 --- a/common/src/main/java/us/ajg0702/queue/common/QueueMain.java +++ b/common/src/main/java/us/ajg0702/queue/common/QueueMain.java @@ -225,6 +225,8 @@ public class QueueMain extends AjQueueAPI { d.put("max-tries-reached", "&cUnable to connect to {SERVER}. Max retries reached."); d.put("auto-queued", "&aYou've been auto-queued for {SERVER} because you were kicked."); + d.put("velocity-kick-message", "You were kicked while trying to join {SERVER}: {REASON}"); + messages = new Messages(dataFolder, new LogConverter(logger), d); } } diff --git a/common/src/main/resources/config.yml b/common/src/main/resources/config.yml index ec92773..3dca2cb 100644 --- a/common/src/main/resources/config.yml +++ b/common/src/main/resources/config.yml @@ -1,5 +1,5 @@ # Dont touch this number please -config-version: 26 +config-version: 27 # This is the main config for ajQueue. @@ -252,4 +252,9 @@ protocol-names: - "108:1.9.1" - "107:1.9" - "47:1.8.9" - - "5:1.7.10" \ No newline at end of file + - "5:1.7.10" + +# On velocity, should we end a player a message when they are kicked while trying to connect to a server with the queue? +# This has no effect on bungee, because the message is sent from bungee and theres no way to change that in ajQueue +# Default: false +velocity-kick-message: false \ No newline at end of file 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 b430cb9..e9ae34c 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 @@ -94,7 +94,7 @@ public class VelocityPlayer implements AdaptedPlayer, Audience { @Override public void sendMessage(String message) { - handle.sendMessage(Component.text().content(message)); + sendMessage(Component.text().content(message)); } @Override @@ -120,10 +120,23 @@ public class VelocityPlayer implements AdaptedPlayer, Audience { handle.createConnectionRequest((RegisteredServer) server.getHandle()).connect().thenAcceptAsync( result -> { if(!result.isSuccessful()) { - QueueMain.getInstance().getEventHandler().onServerKick( + QueueMain main = QueueMain.getInstance(); + Component reason = result.getReasonComponent().orElseGet( + () -> Component.text("Connection failed") + ); + if(main.getConfig().getBoolean("velocity-kick-message")) { + handle.sendMessage( + main.getMessages().getComponent( + "velocity-kick-message", + "SERVER:"+server.getName(), + "REASON:"+reason + ) + ); + } + main.getEventHandler().onServerKick( this, server, - result.getReasonComponent().orElseGet(() -> Component.text("Connection failed")), + reason, false ); }