RespawnTask.java 文件源码

java
阅读 27 收藏 0 点赞 0 评论 0

项目:Chambers 作者:
@Override
public void run() {
    if (profile == null || player == null || !player.isOnline()) {
        cancel();
        return;
    }
    if (profile.getTeam().isRaidable()) {
        player.sendMessage(ChatColor.RED + "Your team has gone raidable and you will not respawn.");
        cancel();
        return;
    }
    if (startingLocation.distance(player.getLocation()) > 40) {
        player.teleport(startingLocation);
        player.sendMessage(ChatColor.RED + "You cannot move more than 40 blocks from where you died.");
    }
    if (profile.getRespawnTime() > 0) {
        profile.setRespawnTime(profile.getRespawnTime() - 1);
    } else {
        profile.setProfileStatus(ProfileStatus.PLAYING);
        player.spigot().respawn();
        player.teleport(profile.getTeam().getHome());
        Bukkit.getOnlinePlayers().forEach(other -> other.showPlayer(player));
        Bukkit.getServer().getPluginManager().callEvent(new PlayerRespawnEvent(player, profile.getTeam().getHome(), false));
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号