diff --git a/Core/src/main/java/com/plotsquared/core/util/PlayerManager.java b/Core/src/main/java/com/plotsquared/core/util/PlayerManager.java index 7ce2c0403..728654f0d 100644 --- a/Core/src/main/java/com/plotsquared/core/util/PlayerManager.java +++ b/Core/src/main/java/com/plotsquared/core/util/PlayerManager.java @@ -28,6 +28,7 @@ import com.plotsquared.core.database.DBFunc; import com.plotsquared.core.player.ConsolePlayer; import com.plotsquared.core.player.OfflinePlotPlayer; import com.plotsquared.core.player.PlotPlayer; +import com.plotsquared.core.plot.Plot; import com.plotsquared.core.uuid.UUIDMapping; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.ComponentLike; @@ -37,6 +38,7 @@ import net.kyori.adventure.text.minimessage.tag.Tag; import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver; import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; +import org.jetbrains.annotations.Contract; import java.util.ArrayList; import java.util.Collection; @@ -216,7 +218,29 @@ public abstract class PlayerManager
, T> { return StaticCaption.of(name); } - public CompletableFuture
, T> { if (uuid.equals(DBFunc.SERVER)) { return CompletableFuture.completedFuture(TranslatableCaption.of("info.server")); } - if (playerMap.containsKey(uuid)) { - return CompletableFuture.completedFuture(StaticCaption.of(playerMap.get(uuid).getName())); + P player = getPlayerIfExists(uuid); + if (player != null) { + return CompletableFuture.completedFuture(StaticCaption.of(player.getName())); } return PlotSquared.get().getImpromptuUUIDPipeline().getNames(Collections.singleton(uuid)).thenApply(mapping -> { if (mapping.isEmpty()) {