core
core copied to clipboard
Error on EntityDamageByEntityEvent
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));
});