Fix /tp command with players, remove unhelpful TAB completion

This commit is contained in:
William committed 2022-08-28 23:57:12 +01:00
1 parent 9bdf67c250
commit 5faab57d8e
7 files changed
+143 -133

No files matched your search

@@ -195,15 +195,8 @@ public class TeleportManager {
* @param timed whether the teleport is timed ({@code true}), otherwise instant
* @return a {@link CompletableFuture} that completes when the teleport is complete with the {@link TeleportResult},
*/
public CompletableFuture<Optional<TeleportResult>> teleportPlayerToPlayerByName(@NotNull String playerName,
@NotNull String targetPlayer,
@NotNull OnlineUser requester,
final boolean timed) {
final Optional<OnlineUser> localPlayer = plugin.findPlayer(playerName);
final Optional<Position> localPositionTarget = localPlayer.map(OnlineUser::getPosition);
if (localPositionTarget.isPresent()) {
return teleportPlayerByName(playerName, localPositionTarget.get(), requester, timed);
}
public CompletableFuture<Optional<TeleportResult>> teleportNamedPlayers(@NotNull String playerName, @NotNull String targetPlayer,
@NotNull OnlineUser requester, final boolean timed) {
return getPlayerPositionByName(requester, targetPlayer).thenApply(position -> {
if (position.isEmpty()) {
return Optional.empty();