Java Code Examples for org.bukkit.entity.Entity#getLocation()

The following examples show how to use org.bukkit.entity.Entity#getLocation() . 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: Compat18.java    From RedProtect with GNU General Public License v3.0 6 votes vote down vote up
@EventHandler(ignoreCancelled = true)
public void onAttemptInteractAS(PlayerInteractAtEntityEvent e) {

    Entity ent = e.getRightClicked();
    Location l = ent.getLocation();
    Region r = RedProtect.get().rm.getTopRegion(l);
    Player p = e.getPlayer();
    if (r == null) {
        //global flags
        if (ent instanceof ArmorStand) {
            if (!RedProtect.get().config.globalFlagsRoot().worlds.get(l.getWorld().getName()).build) {
                e.setCancelled(true);
                return;
            }
        }
        return;
    }

    if (ent instanceof ArmorStand) {
        if (!r.canBuild(p)) {
            RedProtect.get().lang.sendMessage(p, "playerlistener.region.cantedit");
            e.setCancelled(true);
        }
    }
}
 
Example 2
Source File: PlayerInteractListener.java    From IridiumSkyblock with GNU General Public License v2.0 6 votes vote down vote up
@EventHandler
public void onPlayerInteractEntity(PlayerInteractEntityEvent event) {
    try {
        final Player player = event.getPlayer();
        final User user = User.getUser(player);
        final Entity rightClicked = event.getRightClicked();
        final Location location = rightClicked.getLocation();
        final IslandManager islandManager = IridiumSkyblock.getIslandManager();
        final Island island = islandManager.getIslandViaLocation(location);
        if (island == null) return;

        if (island.getPermissions(user).interact) return;

        event.setCancelled(true);
    } catch (Exception e) {
        IridiumSkyblock.getInstance().sendErrorMessage(e);
    }
}
 
Example 3
Source File: BlockEventTracker.java    From GriefDefender with MIT License 6 votes vote down vote up
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onBlockFalling(EntitySpawnEvent event) {
    final Entity entity = event.getEntity();
    final World world = entity.getWorld();
    if (entity instanceof FallingBlock) {
        // add owner
        final Location location = entity.getLocation();
        final Block block = world.getBlockAt(location.getBlockX(), location.getBlockY(), location.getBlockZ());
        final GDClaimManager claimWorldManager = GriefDefenderPlugin.getInstance().dataStore.getClaimWorldManager(location.getWorld().getUID());
        final GDChunk gdChunk = claimWorldManager.getChunk(location.getChunk());
        final UUID ownerUniqueId = gdChunk.getBlockOwnerUUID(block.getLocation());
        if (ownerUniqueId != null) {
            final GDEntity gdEntity = new GDEntity(event.getEntity().getEntityId());
            gdEntity.setOwnerUUID(ownerUniqueId);
            gdEntity.setNotifierUUID(ownerUniqueId);
            EntityTracker.addTempEntity(gdEntity);
        }
    }
}
 
Example 4
Source File: Scout.java    From AnnihilationPro with MIT License 6 votes vote down vote up
private void pullEntityToLocation(Entity e, Location loc)
{
	Location entityLoc = e.getLocation();

	entityLoc.setY(entityLoc.getY() + 0.5D);
	e.teleport(entityLoc);

	double g = -0.08D;
	double d = loc.distance(entityLoc);
	double t = d;
	double v_x = (1.0D + 0.07000000000000001D * t)
			* (loc.getX() - entityLoc.getX()) / t;
	double v_y = (1.0D + 0.03D * t) * (loc.getY() - entityLoc.getY()) / t
			- 0.5D * g * t;
	double v_z = (1.0D + 0.07000000000000001D * t)
			* (loc.getZ() - entityLoc.getZ()) / t;

	Vector v = e.getVelocity();
	v.setX(v_x);
	v.setY(v_y);
	v.setZ(v_z);
	e.setVelocity(v);

	//addNoFall(e, 100);
}
 
Example 5
Source File: Vectors.java    From TabooLib with MIT License 6 votes vote down vote up
public static void entityPush(Entity entity, Location to, double velocity) {
    Location from = entity.getLocation();
    Vector test = to.clone().subtract(from).toVector();
    double elevation = test.getY();
    Double launchAngle = calculateLaunchAngle(from, to, velocity, elevation, 20.0D);
    double distance = Math.sqrt(Math.pow(test.getX(), 2.0D) + Math.pow(test.getZ(), 2.0D));
    if (distance != 0.0D) {
        if (launchAngle == null) {
            launchAngle = Math.atan((40.0D * elevation + Math.pow(velocity, 2.0D)) / (40.0D * elevation + 2.0D * Math.pow(velocity, 2.0D)));
        }
        double hangTime = calculateHangTime(launchAngle, velocity, elevation, 20.0D);
        test.setY(Math.tan(launchAngle) * distance);
        test = normalizeVector(test);
        Vector noise = Vector.getRandom();
        noise = noise.multiply(0.1D);
        test.add(noise);
        velocity = velocity + 1.188D * Math.pow(hangTime, 2.0D) + (Numbers.getRandom().nextDouble() - 0.8D) / 2.0D;
        test = test.multiply(velocity / 20.0D);
        entity.setVelocity(test);
    }
}
 
Example 6
Source File: EntityInteractReach.java    From Hawk with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void check(InteractEntityEvent e) {
    Entity victimEntity = e.getEntity();
    if (!(victimEntity instanceof Player) && !CHECK_OTHER_ENTITIES)
        return;
    int ping = ServerUtils.getPing(e.getPlayer());
    if (PING_LIMIT > -1 && ping > PING_LIMIT)
        return;
    Player p = e.getPlayer();
    HawkPlayer att = e.getHawkPlayer();

    Location victimLocation;
    if (LAG_COMPENSATION)
        victimLocation = hawk.getLagCompensator().getHistoryLocation(ping, victimEntity);
    else
        victimLocation = victimEntity.getLocation();

    AABB victimAABB = WrappedEntity.getWrappedEntity(victimEntity).getHitbox(victimLocation.toVector());

    Vector attackerPos;
    if(att.isInVehicle()) {
        attackerPos = hawk.getLagCompensator().getHistoryLocation(ServerUtils.getPing(p), p).toVector();
        attackerPos.setY(attackerPos.getY() + p.getEyeHeight());
    }
    else {
        attackerPos = att.getHeadPosition();
    }

    double maxReach = att.getPlayer().getGameMode() == GameMode.CREATIVE ? MAX_REACH_CREATIVE : MAX_REACH;
    double dist = victimAABB.distanceToPosition(attackerPos);

    if (dist > maxReach) {
        punish(att, 1, true, e, new Placeholder("distance", MathPlus.round(dist, 2)));
    } else {
        reward(att);
    }
}
 
Example 7
Source File: TurnEffect.java    From EffectLib with MIT License 5 votes vote down vote up
@Override
public void onRun() {
    Entity entity = getEntity();
    if (entity == null) {
        cancel();
        return;
    }
    Location loc = entity.getLocation();
    loc.setYaw(loc.getYaw() + step);
    entity.teleport(loc);
}
 
Example 8
Source File: ArrowFiredCache.java    From civcraft with GNU General Public License v2.0 5 votes vote down vote up
public ArrowFiredCache(ProjectileArrowComponent tower, Entity targetEntity, Arrow arrow) {
	this.setFromTower(tower);
	this.target = targetEntity.getLocation();
	this.targetEntity = targetEntity;
	this.setArrow(arrow);
	this.uuid = arrow.getUniqueId();
	expired = Calendar.getInstance();
	expired.add(Calendar.SECOND, 5);
}
 
Example 9
Source File: Shuffle.java    From ce with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void effect(Event e, ItemStack item, final int level) {
	if(e instanceof EntityDamageByEntityEvent) {
	EntityDamageByEntityEvent event = (EntityDamageByEntityEvent) e;
	Entity target = event.getEntity();
	Player p = (Player) ((Projectile) event.getDamager()).getShooter();
	
	if(target.getEntityId() == p.getEntityId())
		return;
	
	Location pLoc = p.getLocation();
	Location tLoc = target.getLocation();
	
	target.teleport(pLoc);
	p.teleport(tLoc);
	
	EffectManager.playSound(tLoc, "ENTITY_ENDERMAN_TELEPORT", 0.4f, 2f);
	EffectManager.playSound(pLoc, "ENTITY_ENDERMAN_TELEPORT", 0.4f, 2f);

	
	for(int i = 10; i>0; i--) {
		p.getWorld().playEffect(tLoc, Effect.ENDER_SIGNAL, 10);
		p.getWorld().playEffect(pLoc, Effect.ENDER_SIGNAL, 10);
	}
	
	if(target instanceof Player) {
		p.sendMessage(ChatColor.DARK_PURPLE + "You have switched positions with " + target.getName() + "!");
		target.sendMessage(ChatColor.DARK_PURPLE + "You have switched positions with " + p.getName() + "!");
	}
	
	
	}
}
 
Example 10
Source File: FallTracker.java    From ProjectAres with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public @Nullable FallInfo resolveDamage(EntityDamageEvent.DamageCause damageType, Entity victim, @Nullable PhysicalInfo damager) {
    FallState fall = getFall(victim);

    if(fall != null) {
        switch(damageType) {
            case VOID: fall.to = FallInfo.To.VOID; break;
            case FALL: fall.to = FallInfo.To.GROUND; break;
            case LAVA: fall.to = FallInfo.To.LAVA; break;

            case FIRE_TICK:
                if(fall.isInLava) {
                    fall.to = FallInfo.To.LAVA;
                } else {
                    return null;
                }
                break;

            default: return null;
        }

        return fall;
    } else {
        switch(damageType) {
            case FALL:
                return new GenericFallInfo(FallInfo.To.GROUND, victim.getLocation(), victim.getFallDistance());
            case VOID:
                return new GenericFallInfo(FallInfo.To.VOID, victim.getLocation(), victim.getFallDistance());
        }

        return null;
    }
}
 
Example 11
Source File: WrappedEntity8.java    From Hawk with GNU General Public License v3.0 5 votes vote down vote up
public WrappedEntity8(Entity entity) {
    super();
    nmsEntity = ((CraftEntity) entity).getHandle();
    AxisAlignedBB bb = nmsEntity.getBoundingBox();
    collisionBox = new AABB(new Vector(bb.a, bb.b, bb.c), new Vector(bb.d, bb.e, bb.f));
    collisionBorderSize = nmsEntity.ao();
    location = entity.getLocation();
}
 
Example 12
Source File: BeastmastersBow.java    From ce with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
	public boolean effect(Event event, Player player) {
//		  List<String> lore = e.getBow().getItemMeta().getLore();
//		  if(!lore.contains(placeHolder)) {
//			  for(int i = descriptionSize; i != 0; i--)
//				  lore.remove(i);
//			  e.getProjectile().setMetadata("ce." + this.getOriginalName(), new FixedMetadataValue(main, writeType(lore)));
//			  player.setMetadata("ce.CanUnleashBeasts", null);
//		  } else
//			  e.getProjectile().setMetadata("ce." + this.getOriginalName(), null);
		  if(event instanceof EntityDamageByEntityEvent) {
		  EntityDamageByEntityEvent e = (EntityDamageByEntityEvent) event;
		  if(e.getDamager() != player)
			  return false;
		  Entity ent = e.getEntity();
		  Location loc = ent.getLocation();
		  World w = ent.getWorld();
			if(ent instanceof Silverfish || ent instanceof EnderDragon || ent instanceof Spider || ent instanceof Slime || ent instanceof Ghast || ent instanceof MagmaCube || ent instanceof CaveSpider || (ent instanceof Wolf && ((Wolf) ent).isAngry()) || ent instanceof PigZombie) {
					e.setDamage(e.getDamage()*DamageMultiplication);
					w.playEffect(loc, Effect.SMOKE, 50);
					w.playEffect(loc, Effect.MOBSPAWNER_FLAMES, 50);
					EffectManager.playSound(loc, "BLOCK_PISTON_RETRACT", 1.3f, 3f);
				return true;
			} else if (ent instanceof Player) {
				for(int i = 0; i < MaximumMobs; i++) {
					if(rand.nextInt(100) < MobAppearanceChance) {
						w.spawnEntity(loc, rand.nextInt(2) == 1 ? EntityType.SPIDER : EntityType.SLIME);
						w.playEffect(loc, Effect.MOBSPAWNER_FLAMES, 30);
						w.playEffect(loc, Effect.SMOKE, 30);
						EffectManager.playSound(loc, "BLOCK_ANVIL_BREAK", 0.3f, 0.1f);
					}
				}
			}
		}
		  return false;
	}
 
Example 13
Source File: EntitySpawnListener.java    From IridiumSkyblock with GNU General Public License v2.0 5 votes vote down vote up
@EventHandler
public void onEntitySpawn(EntitySpawnEvent event) {
    final Entity entity = event.getEntity();
    final Location location = entity.getLocation();
    final IslandManager islandManager = IridiumSkyblock.getIslandManager();
    final Island island = islandManager.getIslandViaLocation(location);
    if (island == null) return;

    if (!IridiumSkyblock.getConfiguration().blockedEntities.contains(event.getEntityType())) return;

    IridiumSkyblock.getInstance().entities.put(entity.getUniqueId(), island);
    monitorEntity(entity);
}
 
Example 14
Source File: EntityExplodeListener.java    From IridiumSkyblock with GNU General Public License v2.0 5 votes vote down vote up
@EventHandler
public void onEntityExplode(EntityExplodeEvent event) {
    try {
        final Entity entity = event.getEntity();
        final Location location = entity.getLocation();
        final IslandManager islandManager = IridiumSkyblock.getIslandManager();
        if (!islandManager.isIslandWorld(location)) return;

        if (!IridiumSkyblock.getConfiguration().allowExplosions)
            event.setCancelled(true);
    } catch (Exception ex) {
        IridiumSkyblock.getInstance().sendErrorMessage(ex);
    }
}
 
Example 15
Source File: FallTracker.java    From PGM with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public @Nullable FallInfo resolveDamage(
    EntityDamageEvent.DamageCause damageType, Entity victim, @Nullable PhysicalInfo damager) {
  FallState fall = getFall(victim);

  if (fall != null) {
    switch (damageType) {
      case VOID:
        fall.to = FallInfo.To.VOID;
        break;
      case FALL:
        fall.to = FallInfo.To.GROUND;
        break;
      case LAVA:
        fall.to = FallInfo.To.LAVA;
        break;

      case FIRE_TICK:
        if (fall.isInLava) {
          fall.to = FallInfo.To.LAVA;
        } else {
          return null;
        }
        break;

      default:
        return null;
    }

    return fall;
  } else {
    switch (damageType) {
      case FALL:
        return new GenericFallInfo(
            FallInfo.To.GROUND, victim.getLocation(), victim.getFallDistance());
      case VOID:
        return new GenericFallInfo(
            FallInfo.To.VOID, victim.getLocation(), victim.getFallDistance());
    }

    return null;
  }
}
 
Example 16
Source File: Utils.java    From Shopkeepers with GNU General Public License v3.0 4 votes vote down vote up
public static List<Entity> getNearbyEntities(Location location, double radius, EntityType... types) {
	List<Entity> entities = new ArrayList<Entity>();
	if (location == null) return entities;
	if (radius <= 0.0D) return entities;

	double radius2 = radius * radius;
	int chunkRadius = ((int) (radius / 16)) + 1;
	Chunk center = location.getChunk();
	int startX = center.getX() - chunkRadius;
	int endX = center.getX() + chunkRadius;
	int startZ = center.getZ() - chunkRadius;
	int endZ = center.getZ() + chunkRadius;
	World world = location.getWorld();
	for (int chunkX = startX; chunkX <= endX; chunkX++) {
		for (int chunkZ = startZ; chunkZ <= endZ; chunkZ++) {
			if (!world.isChunkLoaded(chunkX, chunkZ)) continue;
			Chunk chunk = world.getChunkAt(chunkX, chunkZ);
			for (Entity entity : chunk.getEntities()) {
				Location entityLoc = entity.getLocation();
				// TODO: this is a workaround: for some yet unknown reason entities sometimes report to be in a
				// different world..
				if (!entityLoc.getWorld().equals(world)) {
					Log.debug("Found an entity which reports to be in a different world than the chunk we got it from:");
					Log.debug("Location=" + location + ", Chunk=" + chunk + ", ChunkWorld=" + chunk.getWorld()
							+ ", entityType=" + entity.getType() + ", entityLocation=" + entityLoc);
					continue; // skip this entity
				}

				if (entityLoc.distanceSquared(location) <= radius2) {
					if (types == null) {
						entities.add(entity);
					} else {
						EntityType type = entity.getType();
						for (EntityType t : types) {
							if (type.equals(t)) {
								entities.add(entity);
								break;
							}
						}
					}
				}
			}
		}
	}
	return entities;
}
 
Example 17
Source File: CitizensShop.java    From Shopkeepers with GNU General Public License v3.0 4 votes vote down vote up
@Override
public Location getActualLocation() {
	Entity entity = this.getEntity();
	return entity != null ? entity.getLocation() : null;
}
 
Example 18
Source File: DamageDisplay.java    From EliteMobs with GNU General Public License v3.0 4 votes vote down vote up
public static void displayDamage(Entity entity, double damage) {

        if (!ConfigValues.mobCombatSettingsConfig.getBoolean(MobCombatSettingsConfig.DISPLAY_DAMAGE_ON_HIT)) return;

        Location entityLocation = entity.getLocation();

        Random random = new Random();
        double randomCoordX = (random.nextDouble() * 2) - 1 + entityLocation.getX();
        double randomCoordZ = (random.nextDouble() * 2) - 1 + entityLocation.getZ();

        Location newLocation = new Location(entityLocation.getWorld(), randomCoordX, entityLocation.getY() + 1.7, randomCoordZ);

         /*
        Dirty fix: armorstands don't render invisibly on their first tick, so it gets moved elsewhere temporarily
         */
        ArmorStand armorStand = (ArmorStand) newLocation.getWorld().spawnEntity(newLocation.add(new Vector(0, -50, 0)), EntityType.ARMOR_STAND);

        armorStand.setVisible(false);
        armorStand.setMarker(true);
        int newDisplayDamage = (int) damage;
        armorStand.setCustomName(ChatColor.RED + "" + ChatColor.BOLD + "" + newDisplayDamage + "");
        armorStand.setGravity(false);
        EntityTracker.registerArmorStands(armorStand);
        armorStand.setCustomNameVisible(false);

        new BukkitRunnable() {

            int taskTimer = 0;

            @Override
            public void run() {

                if (taskTimer == 0) {
                    armorStand.teleport(new Location(armorStand.getWorld(), armorStand.getLocation().getX(),
                            armorStand.getLocation().getY() + 50, armorStand.getLocation().getZ()));
                } else
                    armorStand.teleport(new Location(armorStand.getWorld(), armorStand.getLocation().getX(),
                            armorStand.getLocation().getY() + 0.1, armorStand.getLocation().getZ()));

                if (taskTimer == 1)
                    armorStand.setCustomNameVisible(true);

                taskTimer++;

                if (taskTimer > 15) {

                    EntityTracker.unregisterArmorStand(armorStand);
                    cancel();

                }

            }

        }.runTaskTimer(Bukkit.getPluginManager().getPlugin(MetadataHandler.ELITE_MOBS), 0, 1);

    }
 
Example 19
Source File: EntityExplodeListener.java    From IridiumSkyblock with GNU General Public License v2.0 4 votes vote down vote up
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onMonitorEntityExplode(EntityExplodeEvent event) {
    try {
        final Entity entity = event.getEntity();
        final Location location = entity.getLocation();
        final IslandManager islandManager = IridiumSkyblock.getIslandManager();
        if (!islandManager.isIslandWorld(location)) return;

        final UUID uuid = entity.getUniqueId();
        final IridiumSkyblock plugin = IridiumSkyblock.getInstance();
        final Map<UUID, Island> entities = plugin.entities;
        Island island = entities.get(uuid);
        if (island != null && island.isInIsland(location)) {
            event.setCancelled(true);
            entity.remove();
            entities.remove(uuid);
            return;
        }

        island = islandManager.getIslandViaLocation(location);
        if (island == null) return;

        for (Block block : event.blockList()) {
            if (!island.isInIsland(block.getLocation())) {
                final BlockState state = block.getState();
                IridiumSkyblock.nms.setBlockFast(block, 0, (byte) 0);
                Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> state.update(true, true));
            }

            if (!Utils.isBlockValuable(block)) continue;

            if (!(block.getState() instanceof CreatureSpawner)) {
                final Material material = block.getType();
                final XMaterial xmaterial = XMaterial.matchXMaterial(material);
                island.valuableBlocks.computeIfPresent(xmaterial.name(), (name, original) -> original - 1);
            }

            if (island.updating)
                island.tempValues.remove(block.getLocation());
        }
        island.calculateIslandValue();
    } catch (Exception ex) {
        IridiumSkyblock.getInstance().sendErrorMessage(ex);
    }
}
 
Example 20
Source File: EntityDamageByEntityListener.java    From IridiumSkyblock with GNU General Public License v2.0 4 votes vote down vote up
@EventHandler
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
    try {
        final Entity damagee = event.getEntity();
        final Location damageeLocation = damagee.getLocation();
        final IslandManager islandManager = IridiumSkyblock.getIslandManager();
        final Island island = islandManager.getIslandViaLocation(damageeLocation);
        if (island == null) return;

        final Entity damager = event.getDamager();

        // Using suppliers to defer work if unnecessary
        // This includes seemingly innocuous downcast operations
        final Supplier<Player> damageePlayerSupplier = () -> (Player) damagee;
        final Supplier<User> damageeUserSupplier = () -> User.getUser(damageePlayerSupplier.get());
        final Supplier<Island> damageeIslandSupplier = () -> damageeUserSupplier.get().getIsland();
        final Supplier<Arrow> arrowSupplier = () -> (Arrow) damager;
        final Supplier<ProjectileSource> projectileSourceSupplier = () -> arrowSupplier.get().getShooter();
        final Supplier<Player> shooterSupplier = () -> (Player) projectileSourceSupplier.get();
        final Supplier<User> shootingUserSupplier = () -> User.getUser(Objects.requireNonNull(shooterSupplier.get()));
        final Supplier<Player> damagingPlayerSupplier = () -> (Player) damager;
        final Supplier<User> damagingUserSupplier = () -> User.getUser(damagingPlayerSupplier.get());

        // Deals with two players pvping in IridiumSkyblock world
        if (IridiumSkyblock.getConfiguration().disablePvPOnIslands
                && damagee instanceof Player
                && damager instanceof Player) {
            event.setCancelled(true);
            return;
        }

        // Deals with A player getting damaged by a bow fired from a player in IridiumSkyblock world
        if (IridiumSkyblock.getConfiguration().disablePvPOnIslands
                && damagee instanceof Player
                && damager instanceof Arrow
                && projectileSourceSupplier.get() instanceof Player) {
            event.setCancelled(true);
            return;
        }

        // Deals with a player attacking animals with bows that are not from their island
        if (damager instanceof Arrow
                && !(damagee instanceof Player)
                && projectileSourceSupplier.get() instanceof Player
                && !island.getPermissions(shootingUserSupplier.get()).killMobs) {
            event.setCancelled(true);
            return;
        }

        // Deals with a player attacking animals that are not from their island
        if (damager instanceof Player
                && !(damagee instanceof Player)
                && !island.getPermissions(damagingUserSupplier.get()).killMobs) {
            event.setCancelled(true);
            return;
        }

        //Deals with a mob attacking a player that doesn't belong to the island (/is home traps?)
        if (IridiumSkyblock.getConfiguration().disablePvPOnIslands
                && damagee instanceof Player
                && !(damager instanceof Player)) {
            if (damageeIslandSupplier.get() != null) {
                if (!damageeIslandSupplier.get().isInIsland(damager.getLocation())) {
                    event.setCancelled(true);
                    return;
                }
            } else {
                event.setCancelled(true);
                return;
            }
        }

        // Deals with two allies pvping
        if (IridiumSkyblock.getConfiguration().disablePvPBetweenIslandMembers
                && damagee instanceof Player
                && damager instanceof Player
                && damageeIslandSupplier.get() != null
                && damageeIslandSupplier.get().equals(damagingUserSupplier.get().getIsland())) {
            event.setCancelled(true);
            return;
        }

        // Deals with two allies pvping with bows
        if (IridiumSkyblock.getConfiguration().disablePvPBetweenIslandMembers
                && damagee instanceof Player
                && damager instanceof Arrow
                && projectileSourceSupplier.get() instanceof Player
                && damageeIslandSupplier.get() != null
                && damageeIslandSupplier.get().equals(damagingUserSupplier.get().getIsland())) {
            event.setCancelled(true);
            return;
        }
    } catch (Exception ex) {
        IridiumSkyblock.getInstance().sendErrorMessage(ex);
    }
}