option to send kick message on velocity
This commit is contained in:
@@ -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", "<red>You were kicked while trying to join {SERVER}: <white>{REASON}");
|
||||
|
||||
messages = new Messages(dataFolder, new LogConverter(logger), d);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Dont touch this number please
|
||||
config-version: 26
|
||||
config-version: 27
|
||||
|
||||
|
||||
# This is the main config for ajQueue.
|
||||
@@ -253,3 +253,8 @@ protocol-names:
|
||||
- "107:1.9"
|
||||
- "47:1.8.9"
|
||||
- "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
|
||||
+16
-3
@@ -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
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user