geforkt von Mirrors/Velocity
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())) {
|
if ("all".regionMatches(true, 0, argument, 0, argument.length())) {
|
||||||
builder.suggest("all");
|
builder.suggest("all");
|
||||||
}
|
}
|
||||||
|
if ("current".regionMatches(true, 0, argument, 0, argument.length())
|
||||||
|
&& context.getSource() instanceof Player) {
|
||||||
|
builder.suggest("current");
|
||||||
|
}
|
||||||
return builder.buildFuture();
|
return builder.buildFuture();
|
||||||
})
|
})
|
||||||
.executes(this::usage)
|
.executes(this::usage)
|
||||||
@ -113,7 +117,8 @@ public class SendCommand {
|
|||||||
return 0;
|
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(
|
context.getSource().sendMessage(
|
||||||
CommandMessages.PLAYER_NOT_FOUND.args(Component.text(player))
|
CommandMessages.PLAYER_NOT_FOUND.args(Component.text(player))
|
||||||
);
|
);
|
||||||
@ -127,6 +132,22 @@ public class SendCommand {
|
|||||||
return 1;
|
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.getPlayer(player).get().createConnectionRequest(
|
||||||
server.getServer(serverName).get()
|
server.getServer(serverName).get()
|
||||||
).fireAndForget();
|
).fireAndForget();
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren