mirror of
https://github.com/darksaid98/HuskHomes.git
synced 2026-12-02 06:28:49 +00:00
Make the /tpahere and /tpa request sent confirmation message accurately report who the request was sent to
This commit is contained in:
1 parent
c0b6b45617
commit
f32082a8bf
5 files changed
+33
-25
No files matched your search
@@ -39,7 +39,7 @@ public class TpaAllCommand extends CommandBase {
|
||||
final List<CompletableFuture<Void>> sentRequestsFuture = new ArrayList<>();
|
||||
players.forEach(playerName -> sentRequestsFuture.add(plugin.getRequestManager()
|
||||
.sendTeleportRequest(onlineUser, playerName, TeleportRequest.RequestType.TPA_HERE)
|
||||
.thenAccept(sent -> counter.addAndGet(sent ? 1 : 0))));
|
||||
.thenAccept(sent -> counter.addAndGet(sent.isPresent() ? 1 : 0))));
|
||||
|
||||
// Send a message when all requests have been sent
|
||||
CompletableFuture.allOf(sentRequestsFuture.toArray(new CompletableFuture[0])).thenRun(() -> {
|
||||
|
||||
@@ -21,7 +21,10 @@ public class TpaCommand extends CommandBase implements TabCompletable {
|
||||
public void onExecute(@NotNull OnlineUser onlineUser, @NotNull String[] args) {
|
||||
if (args.length == 1) {
|
||||
plugin.getRequestManager().sendTeleportRequest(onlineUser, args[0], TeleportRequest.RequestType.TPA).thenAccept(sent -> {
|
||||
if (!sent) {
|
||||
if (sent.isPresent()) {
|
||||
plugin.getLocales().getLocale("tpa_request_sent", sent.get().getRecipientName())
|
||||
.ifPresent(onlineUser::sendMessage);
|
||||
} else {
|
||||
if (plugin.findPlayer(args[0]).isPresent()) {
|
||||
plugin.getLocales().getLocale("error_teleport_request_self")
|
||||
.ifPresent(onlineUser::sendMessage);
|
||||
@@ -29,10 +32,7 @@ public class TpaCommand extends CommandBase implements TabCompletable {
|
||||
}
|
||||
plugin.getLocales().getLocale("error_player_not_found", args[0])
|
||||
.ifPresent(onlineUser::sendMessage);
|
||||
return;
|
||||
}
|
||||
plugin.getLocales().getLocale("tpa_request_sent", args[0])
|
||||
.ifPresent(onlineUser::sendMessage);
|
||||
});
|
||||
} else {
|
||||
plugin.getLocales().getLocale("error_invalid_syntax", "/tpa <player>")
|
||||
|
||||
@@ -21,7 +21,7 @@ public class TpaHereCommand extends CommandBase implements TabCompletable {
|
||||
public void onExecute(@NotNull OnlineUser onlineUser, @NotNull String[] args) {
|
||||
if (args.length == 1) {
|
||||
plugin.getRequestManager().sendTeleportRequest(onlineUser, args[0], TeleportRequest.RequestType.TPA_HERE).thenAccept(sent -> {
|
||||
if (!sent) {
|
||||
if (sent.isEmpty()) {
|
||||
if (plugin.findPlayer(args[0]).isPresent()) {
|
||||
plugin.getLocales().getLocale("error_teleport_request_self")
|
||||
.ifPresent(onlineUser::sendMessage);
|
||||
@@ -31,7 +31,7 @@ public class TpaHereCommand extends CommandBase implements TabCompletable {
|
||||
.ifPresent(onlineUser::sendMessage);
|
||||
return;
|
||||
}
|
||||
plugin.getLocales().getLocale("tpahere_request_sent", args[0])
|
||||
plugin.getLocales().getLocale("tpahere_request_sent", sent.get().getRecipientName())
|
||||
.ifPresent(onlineUser::sendMessage);
|
||||
});
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user