Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-12-25 15:50:19 +01:00
Allow sending all players from current server (#1133)
Dieser Commit ist enthalten in:
Ursprung
67d5e77b1f
Commit
f87b05a487
@ -70,6 +70,10 @@ public class SendCommand {
|
||||
if ("all".regionMatches(true, 0, argument, 0, argument.length())) {
|
||||
builder.suggest("all");
|
||||
}
|
||||
if ("current".regionMatches(true, 0, argument, 0, argument.length())
|
||||
&& context.getSource() instanceof Player) {
|
||||
builder.suggest("current");
|
||||
}
|
||||
return builder.buildFuture();
|
||||
})
|
||||
.executes(this::usage)
|
||||
@ -113,7 +117,8 @@ public class SendCommand {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (server.getPlayer(player).isEmpty() && !Objects.equals(player, "all")) {
|
||||
if (server.getPlayer(player).isEmpty()
|
||||
&& !Objects.equals(player, "all") && !Objects.equals(player, "current")) {
|
||||
context.getSource().sendMessage(
|
||||
CommandMessages.PLAYER_NOT_FOUND.args(Component.text(player))
|
||||
);
|
||||
@ -127,6 +132,22 @@ public class SendCommand {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (Objects.equals(player, "current")) {
|
||||
if (!(context.getSource() instanceof Player)) {
|
||||
context.getSource().sendMessage(CommandMessages.PLAYERS_ONLY);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Player source = (Player) context.getSource();
|
||||
if (source.getCurrentServer().isPresent()) {
|
||||
for (Player p : source.getCurrentServer().get().getServer().getPlayersConnected()) {
|
||||
p.createConnectionRequest(server.getServer(serverName).get()).fireAndForget();
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
server.getPlayer(player).get().createConnectionRequest(
|
||||
server.getServer(serverName).get()
|
||||
).fireAndForget();
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren