/** * This method launches near by entities * * @return true if a entity was thrown. */ protected boolean shoot() { boolean resultBoolean = false; Location location = BukkitUtil.toSign(getSign()).getLocation(); EntityType type = EntityType.MOB_HOSTILE; if (!getSign().getLine(3).isEmpty()) { type = EntityType.fromString(getSign().getLine(3)); } try { for (Entity e : LocationUtil.getNearbyEntities(location, new Vector(3, 3, 3))) { if (e.isDead() || !e.isValid()) { continue; } if (!type.is(e)) { continue; } String[] split = RegexUtil.COLON_PATTERN.split(getSign().getLine(2)); double x = Double.parseDouble(split[0]); double y = Double.parseDouble(split[1]); double z = Double.parseDouble(split[2]); e.setVelocity(new org.bukkit.util.Vector(x, y, z).add(e.getVelocity())); resultBoolean = true; } } catch (Exception ignored) { } return resultBoolean; }