Suggestion Open

Add Bukkit API SkillCastEvent, SkillTargetEvent

#4958 opened by Unknown 2 years ago

Unknownreported this suggestion

Summary

Please add support Bukkit Events that it will makes developers:

  • SkillCastEvent: to catch a caster(mob or player) and skill name
  • SkillTargetEvent: to catch a targeted entity/location by MythicMobs onHits mechacnis like projectile, skill, totem

Usage

@EventHandler
public void onTarget(SkillTargetEvent e) {
  // catch up
}

@EventHandler
public void onCast(SkillCastEvent e) {
  // catch up
}

My use case is adding cast/target event for Skript and then programmatically give a buff to the target in a specific skill, and also want to cancel the event.

Example skill:

slash:
  Skills:
  - totem{md=2;c=1;oH=damage;hnp=true;hp=true;hR=1;vR=1;i=1} @forward{f=1}
damage:
  Skills:
  - damage{a=4;pkb=false;hnp=true;hp=true}

If I casted slash skill and the onHit damage has met, then SkillTargetEvent will be called before damage.

Value

In context of current MythicMobs, my idea to catch a skill target is create a custom mechanics with id option which calls Bukkit event, and then use it in every MythicMobs skills.yml, then compare the id in Bukkit event handler.

If the Bukkit events will be supported, the process of creating custom mechanic will not be require, many plugins especially Skript can catch up the event and we can do actions programmatically.

Also MythicLib support something like SkillCastEvent, but not SkillTargetEvent.

Priority

Flexible API is more important for closed source software because we can't see and modify the sourcecode

Implementation

Describe how you think your suggestion should be implemented.

@EventHandler
public void onTarget(SkillTargetEvent e) {
  val caster = e.getCaster();
  val skillName = e.getSkillName();
  val target = e.getTarget();
  if (skillName.equals("MySkillInConfigNode") {
    // some BukkitAPI method calls for extra actions
  }
}

Thank you in advance for your support.

Unknowncommented

Second adding a MythicSkillCastEvent! Not sure about TargetEvent, seeing as MythicProjectileHitEvent already exists—maybe better to just add a nullable getCaster() or getShooter() method to the event (or a field to the projectile's tracker)?

Sign in to join the discussion.