option to send kick message on velocity
This commit is contained in:
+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