Tell command sender if the name specified was online and dead

This commit is contained in:
tanyaofei 2024-08-11 20:06:59 +08:00
parent b9cf70ba1b
commit 3e5a21bd78

View File

@ -146,18 +146,14 @@ public class NameManager {
{
var player = Bukkit.getPlayerExact(name);
if (player != null) {
if (player.isDead()) {
throw new IllegalCustomNameException(translatable("fakeplayer.spawn.error.name.online-dead", text(name, GOLD), text("/fp respawn", DARK_GREEN)).color(RED));
} else {
throw new IllegalCustomNameException(translatable("fakeplayer.spawn.error.name.online", text(name, GOLD)).color(RED));
}
throw new IllegalCustomNameException(
player.isDead()
? translatable("fakeplayer.spawn.error.name.online-dead", text(name, GOLD), text("/fp respawn", DARK_GREEN)).color(RED)
: translatable("fakeplayer.spawn.error.name.online", text(name, GOLD)).color(RED)
);
}
}
if (Bukkit.getPlayerExact(name) != null) {
}
var player = Bukkit.getOfflinePlayer(name);
var uuid = player.getUniqueId();
if (player.hasPlayedBefore() && !legacyUsedIdRepository.contains(uuid) && !profileRepository.existsByUUID(uuid)) {