core icon indicating copy to clipboard operation
core copied to clipboard

Error on EntityDamageByEntityEvent

Open connerdouglass opened this issue 3 years ago • 2 comments

I was trying to build an event handler for the EntityDamageByEntityEvent and ran into this error in the PaperMC console:

[09:56:54 ERROR]: [my-plugin] [STDERR] My CustomRealms Plugin:3: object is not an instance of declaring class

Here's my code:

ServerEvents.register(EntityDamageByEntityEvent, event => {

    const damager = event.getDamager();
    if (!damager) return;
    if (damager.getType() !== EntityType.PLAYER) return;

    event.getEntity().setVelocity(new Vector(0, 100, 0));

});

connerdouglass avatar Nov 13 '21 17:11 connerdouglass