Commits

coll1234567 authored and md_5 committed cde4c52a8c1
SPIGOT-5553, #964: Add EntityKnockbackEvent
No tags

src/main/java/org/bukkit/event/entity/EntityKnockbackByEntityEvent.java

Added
1 +package org.bukkit.event.entity;
2 +
3 +import org.bukkit.entity.Entity;
4 +import org.bukkit.entity.LivingEntity;
5 +import org.bukkit.util.Vector;
6 +import org.jetbrains.annotations.NotNull;
7 +
8 +/**
9 + * Called when an entity receives knockback from another entity.
10 + */
11 +public class EntityKnockbackByEntityEvent extends EntityKnockbackEvent {
12 +
13 + private final Entity source;
14 +
15 + public EntityKnockbackByEntityEvent(@NotNull final LivingEntity entity, @NotNull final Entity source, @NotNull final KnockbackCause cause, final double force, @NotNull final Vector rawKnockback, @NotNull final Vector knockback) {
16 + super(entity, cause, force, rawKnockback, knockback);
17 +
18 + this.source = source;
19 + }
20 +
21 + /**
22 + * Get the entity that has caused knockback to the defender.
23 + *
24 + * @return entity that caused knockback
25 + */
26 + @NotNull
27 + public Entity getSourceEntity() {
28 + return source;
29 + }
30 +}

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut