PlayerAdvancementDoneEvent

Discussion in 'Plugin Development' started by raptormp4, Feb 5, 2021.

Thread Status:
Not open for further replies.
  1. Offline

    raptormp4

    I'm trying to make a plugin that increases the health when you get an achievement, right now it seems to fire when I make irrelevant tasks such as picking up a log or flower. Is there a way to make it so it only fires when the player completes an advancement such as the ones listed https://minecraft.gamepedia.com/Advancement



    Code:
         @EventHandler
           public void aEvent(PlayerAdvancementDoneEvent e) {
             Player p = e.getPlayer();
    
             AttributeInstance attribute = p.getAttribute(Attribute.GENERIC_MAX_HEALTH);
             double newValue = attribute.getBaseValue() + 1;
             attribute.setBaseValue(newValue);
             Bukkit.broadcastMessage(ChatColor.GREEN + "Your Health increased to " +ChatColor.RED + newValue + " \u2764");
        
        
         }
    }
     
Thread Status:
Not open for further replies.

Share This Page