how do i get my wither skull to have custom damage

Discussion in 'Plugin Development' started by Cohoidon, Jul 6, 2022.

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

    Cohoidon

    Code:
        @EventHandler
        public void onPlayerInteractEvent(PlayerInteractEvent event){
            Player player = event.getPlayer();
    
            if(event.getAction().equals(Action.RIGHT_CLICK_AIR)){
                ItemStack item = player.getInventory().getItemInMainHand();
                ItemMeta meta = item.getItemMeta();
                String name = meta.getDisplayName();
                Player location = player.getPlayer();
                World world = player.getWorld();
                if(name.equals(ChatColor.GOLD + "Ocean Wither Sickle")){
                    Location loc = player.getEyeLocation().toVector().add(player.getLocation().getDirection().multiply(2)).toLocation(player.getWorld(), player.getLocation().getYaw(), player.getLocation().getPitch());
                    WitherSkull witherskull = player.getWorld().spawn(loc, WitherSkull.class);
     
  2. Offline

    Warelkill

    Create a new listener and verify if he beat entity with this witherskull and get entity healt and set his healt at : healt - damage of witherskull
     
Thread Status:
Not open for further replies.

Share This Page