PoisonousPotato.java 文件源码

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

项目:SurvivalPlus 作者:
@EventHandler(priority = EventPriority.HIGHEST)
public void onConsume(PlayerItemConsumeEvent event)
{
    if(event.isCancelled()) return;
    Player player = event.getPlayer();
    if(event.getItem().getType() == Material.POISONOUS_POTATO)
    {
        for (PotionEffect effect : player.getActivePotionEffects())
            player.removePotionEffect(effect.getType());

        Random rand = new Random();
        if(rand.nextInt(10) + 1 <= 6)
        {
            player.addPotionEffect(new PotionEffect(PotionEffectType.POISON, 100, 0), true);
            player.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 200, 0), true);
        }
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号