Skip to content

Commit

Permalink
Fixed #116
Browse files Browse the repository at this point in the history
  • Loading branch information
Mgazul committed Aug 13, 2023
1 parent 6d1c8df commit fec175c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,7 @@ public boolean hitCancelled() {

@Override
public void preOnHit(HitResult movingobjectposition) {
org.bukkit.event.entity.ProjectileHitEvent event =
org.bukkit.craftbukkit.v1_20_R1.event.CraftEventFactory.callProjectileHitEvent(((Projectile) (Object) this),
movingobjectposition);
org.bukkit.event.entity.ProjectileHitEvent event = org.bukkit.craftbukkit.v1_20_R1.event.CraftEventFactory.callProjectileHitEvent(((Projectile) (Object) this), movingobjectposition);
this.hitCancelled = event != null && event.isCancelled();
if (movingobjectposition.getType() == HitResult.Type.BLOCK || !this.hitCancelled) {
this.onHit(movingobjectposition);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1367,6 +1367,11 @@ public static ProjectileHitEvent callProjectileHitEvent(Entity entity, HitResult
hitEntity = ((EntityHitResult) position).getEntity().getBukkitEntity();
}

// Mohist start - Fix ClassCastException MohistModsEntity -> org.bukkit.entity.Projectile
if (!(entity.getBukkitEntity() instanceof Projectile))
return null;
// Mohist end

// Paper start - legacy event
boolean cancelled = false;
if (hitEntity != null && position instanceof EntityHitResult entityHitResult) {
Expand Down

0 comments on commit fec175c

Please sign in to comment.