Java Code Examples for org.bukkit.entity.EntityType#ARROW

The following examples show how to use org.bukkit.entity.EntityType#ARROW . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DamageMatchModule.java    From PGM with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Are players allowed to inflict the given damage on themselves? Custom rules can override this.
 */
public static boolean isAllowedSelfDamage(DamageInfo damageInfo) {
  // Disable self-damage with arrows
  if (damageInfo instanceof ProjectileInfo) {
    ProjectileInfo projectileInfo = (ProjectileInfo) damageInfo;
    if (projectileInfo.getProjectile() instanceof EntityInfo
        && ((EntityInfo) projectileInfo.getProjectile()).getEntityType() == EntityType.ARROW) {
      return false;
    }
  }
  return true;
}
 
Example 2
Source File: DamageMatchModule.java    From ProjectAres with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Are players allowed to inflict the given damage on themselves?
 * Custom rules can override this.
 */
public static boolean isAllowedSelfDamage(DamageInfo damageInfo) {
    // Disable self-damage with arrows
    if(damageInfo instanceof ProjectileInfo) {
        ProjectileInfo projectileInfo = (ProjectileInfo) damageInfo;
        if(projectileInfo.getProjectile() instanceof EntityInfo &&
           ((EntityInfo) projectileInfo.getProjectile()).getEntityType() == EntityType.ARROW) {
            return false;
        }
    }
    return true;
}
 
Example 3
Source File: EntityShootBow.java    From AdditionsAPI with MIT License 5 votes vote down vote up
@EventHandler(priority = EventPriority.HIGHEST)
public void onArrowHit(ProjectileHitEvent event) {
	if (event.getEntityType() != EntityType.ARROW && event.getEntityType() != EntityType.SPECTRAL_ARROW)
		return;
	if (ArrowFromCustomBowHit.containsArrow(event.getEntity())) {
		BowStackContainer container = ArrowFromCustomBowHit.getBowStackContainer(event.getEntity());
		Bukkit.getServer().getPluginManager()
				.callEvent(new ArrowFromCustomBowHitEvent(event, container.getOwner(), container.getBowStack()));
	}
}
 
Example 4
Source File: Pyro.java    From AnnihilationPro with MIT License 5 votes vote down vote up
@EventHandler(priority = EventPriority.HIGHEST,ignoreCancelled = true)
public void arrowLaunch(final ProjectileLaunchEvent event)
{
	if(event.getEntityType() == EntityType.ARROW)
	{
		ProjectileSource shooter = event.getEntity().getShooter();
		if(shooter instanceof Player)
		{
			AnniPlayer p = AnniPlayer.getPlayer(((Player) shooter).getUniqueId());
			if(p != null && p.getKit().equals(this))
				event.getEntity().setFireTicks(999999);
		}
	}
}
 
Example 5
Source File: Archer.java    From AnnihilationPro with MIT License 5 votes vote down vote up
@EventHandler(priority = EventPriority.HIGHEST,ignoreCancelled = true)
public void damageListener(final EntityDamageByEntityEvent event)
{
	if(event.getDamager().getType() == EntityType.ARROW)
	{
		ProjectileSource s = ((Projectile)event.getDamager()).getShooter();
		if(s instanceof Player)
		{
			AnniPlayer shooter = AnniPlayer.getPlayer(((Player) s).getUniqueId());
			if(shooter != null && shooter.getKit() != null && shooter.getKit().equals(this))
				event.setDamage(event.getDamage()+1);
		}
	}
}
 
Example 6
Source File: CraftArrow.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
public EntityType getType() {
    return EntityType.ARROW;
}
 
Example 7
Source File: CraftArrow.java    From Thermos with GNU General Public License v3.0 4 votes vote down vote up
public EntityType getType() {
    return EntityType.ARROW;
}