Fix tphere not returning an error for unresolved players

This commit is contained in:
William committed 2022-11-23 01:33:52 +00:00
1 parent 8854d3569f
commit 10b398b783
9 files changed
+56 -24

No files matched your search

@@ -87,7 +87,7 @@ public class TeleportBuilder {
*/
public TeleportBuilder setTeleporter(@NotNull String teleporterUsername) {
this.teleporter = CompletableFuture.supplyAsync(() -> plugin
.findPlayer(teleporterUsername)
.findOnlinePlayer(teleporterUsername)
.map(onlineUser -> (User) onlineUser)
.or(() -> {
if (plugin.getSettings().crossServer) {
@@ -229,7 +229,7 @@ public class TeleportBuilder {
* @return future optionally supplying the player's position, if the player could be found
*/
private CompletableFuture<Optional<Position>> getPlayerPosition(@NotNull String playerName) {
final Optional<OnlineUser> localPlayer = plugin.findPlayer(playerName);
final Optional<OnlineUser> localPlayer = plugin.findOnlinePlayer(playerName);
if (localPlayer.isPresent()) {
return CompletableFuture.supplyAsync(() -> Optional.of(localPlayer.get().getPosition()));
}