首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >PlayerRespawnEvent没有运行所有的代码SpigotMC

PlayerRespawnEvent没有运行所有的代码SpigotMC
EN

Stack Overflow用户
提问于 2021-05-12 01:40:10
回答 1查看 62关注 0票数 0

因此,我试图制造一个由Fundy激发的impossibleX难度,并且我试图使它变得这样,当一个球员呼吸时,他会感到虚弱,如下所示,但问题是,它不会将他们的健康降到一半,并在他呼吸后增加慢/弱/挖掘疲劳,但它确实传递了一个信息:“你在呼吸后感到虚弱.”

我能帮忙吗?

代码语言:javascript
运行
复制
    public static void nahwouldyounotrespawn(PlayerRespawnEvent e){
        Player player = e.getPlayer();
        player.sendMessage("You feel weak after respawning...");
        player.setHealth(10);

        player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 30000, 5));
        player.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS, 30000, 5));
        player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_DIGGING, 30000, 255));
    }
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-05-12 10:27:36

这是the fourth time,您得到了一个包含关于如何安排任务的信息的答案。我强烈敦促你切实阅读你所收到的文章,因为它们将帮助你。

代码语言:javascript
运行
复制
public void playerRespawnEffects(PlayerRespawnEvent e){
    Player player = e.getPlayer();
    player.sendMessage("You feel weak after respawning...");
    Bukkit.getScheduler().runTaskLater(/*Your plugin instance*/, () -> {
        player.setHealth(10);
        player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 30000, 5));
        player.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS, 30000, 5));
        player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_DIGGING, 30000, 255));
    }, /*Tick delay here e.g. 1L*/);
}
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67496310

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档