Prevent sending teleport requests to self, send message on /tpall

This commit is contained in:
William committed 2022-08-24 22:24:35 +01:00
1 parent 312bff2efc
commit 98931c1900
7 files changed
+41 -18

No files matched your search

@@ -83,6 +83,9 @@ public class RequestManager {
Instant.now().getEpochSecond() + plugin.getSettings().teleportRequestExpiryTime);
final Optional<OnlineUser> localTarget = plugin.findPlayer(targetUser);
if (localTarget.isPresent()) {
if (localTarget.get().uuid.equals(requester.uuid)) {
return CompletableFuture.completedFuture(false);
}
request.recipientName = localTarget.get().username;
return CompletableFuture.supplyAsync(() -> sendLocalTeleportRequest(request, localTarget.get()));
}