-
-
Save aikar/ddee3075c040e47a2394 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static final UsableCustomItem CUPIDS_BOW = new UsableBowCustomItem("CupidsBow") { | |
{ | |
ItemUtil.buildLore(this) | |
.setName("&r&dCupid's Bow") | |
.add("&9Love is in the air!") | |
.makeFinal() | |
.makeSoulbound() | |
.save(); | |
addUnsafeEnchantment(Enchantment.DURABILITY, 3); | |
} | |
@Override | |
public boolean onShoot(Player player, EntityShootBowEvent bow) { | |
SpecialProjectile.CUPID_ARROW.apply((Projectile) bow.getProjectile()); | |
return true; | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static final SpecialProjectile CUPID_ARROW = new SpecialProjectile("CupidArrow") { | |
@Override | |
public void onEntityHit(EntityDamageByEntityEvent event) { | |
final Entity hit = event.getEntity(); | |
event.setCancelled(true); | |
event.getDamager().remove(); | |
((Projectile) event.getDamager()).setBounce(false); | |
if (hit instanceof Animals) { | |
EntityAIApi.setLove((Animals) hit, TimeUtil.SECOND.inTicks(30)); | |
} | |
if (hit instanceof LivingEntity) { | |
EntityTasksApi.scheduleTask(hit, 10, new EntityTasksApi.EntityTask(TimeUtil.MINUTE.inSeconds(5 * 2)) { | |
@Override | |
public void run(Entity entity) { | |
if (count < 10 && hit instanceof Monster) { | |
((Monster) hit).setTarget(null); | |
} | |
hit.getWorld().spigot().playEffect(hit.getLocation().add(0, 2, 0), Effect.HEART); | |
} | |
}); | |
} | |
} | |
@Override | |
public void onInitialize(final Projectile projectile) { | |
EntityTasksApi.scheduleTask(projectile, 1, new EntityTasksApi.EntityTask(20 * 10) { | |
@Override | |
public void run(Entity entity) { | |
if (!projectile.isOnGround()) { | |
projectile.getWorld().spigot().playEffect( | |
projectile.getLocation(), | |
Effect.HEART); | |
} | |
} | |
}); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment