How do i check if a snowman threw a snowball?

Discussion in 'Spigot Help' started by Ibraheemkhazbak, Mar 25, 2020.

Thread Status:
Not open for further replies.
  1. Code (Java):

    public void onSnowballHit(ProjectileHitEvent e) {
        if (e.getEntityType().equals(EntityType.SNOWBALL)) {
            if (e.getHitEntity() == null) {
                Location loc = e.getHitBlock().getLocation();

               e.getEntity().getWorld().createExplosion(loc,5,false,false);

            } else if (e.getHitBlock() == null) {

                Location loc = e.getHitEntity().getLocation();
                e.getEntity().getWorld().createExplosion(loc, 5, false, false);
            }
        }
    }
     
    i tried casting the shooter as an entity and getting the entity type and it didn't work please help!
     
Thread Status:
Not open for further replies.