mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-25 16:50:17 +01:00
835bc39b03
Updated Upstream (Bukkit/CraftBukkit/Spigot) Bukkit Changes: 2dcc44dc SPIGOT-4307: Fix hacky API for banners on shields e0fc6572 SPIGOT-4309: Add "forced" display of particles efeeab2f Add index to README.md for easier navigation f502bc6f Update to Minecraft 1.13.1 CraftBukkit Changes:d0bb0a1d
Fix some tests randomly failing997d378d
Fix client stall in specific teleportation scenariosb3dc2366
SPIGOT-4307: Fix hacky API for banners on shields2a271162
SPIGOT-4301: Fix more invalid enchants5d0d83bb
SPIGOT-4309: Add "forced" display of particlesa6772578
Add additional tests for CraftBlockDatace1af0c3
Update to Minecraft 1.13.1 Spigot Changes: 2440e189 Rebuild patches 4ecffced Update to Minecraft 1.13.1
91 lines
2.5 KiB
Diff
91 lines
2.5 KiB
Diff
From 3b6b6156f219653c4c0f1edcb490998333852b72 Mon Sep 17 00:00:00 2001
|
|
From: Brokkonaut <hannos17@gmx.de>
|
|
Date: Mon, 18 Jun 2018 15:40:39 +0200
|
|
Subject: [PATCH] Add EntityKnockbackByEntityEvent
|
|
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EntityKnockbackByEntityEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EntityKnockbackByEntityEvent.java
|
|
new file mode 100644
|
|
index 000000000..f6ef11624
|
|
--- /dev/null
|
|
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityKnockbackByEntityEvent.java
|
|
@@ -0,0 +1,76 @@
|
|
+package com.destroystokyo.paper.event.entity;
|
|
+
|
|
+import org.bukkit.entity.Entity;
|
|
+import org.bukkit.entity.LivingEntity;
|
|
+import org.bukkit.event.Cancellable;
|
|
+import org.bukkit.event.HandlerList;
|
|
+import org.bukkit.event.entity.EntityEvent;
|
|
+import org.bukkit.util.Vector;
|
|
+
|
|
+/**
|
|
+ * Fired when an Entity is knocked back by the hit of another Entity. The acceleration
|
|
+ * vector can be modified. If this event is cancelled, the entity is not knocked back.
|
|
+ *
|
|
+ */
|
|
+public class EntityKnockbackByEntityEvent extends EntityEvent implements Cancellable {
|
|
+ private static final HandlerList handlers = new HandlerList();
|
|
+
|
|
+ private final Entity hitBy;
|
|
+ private final float knockbackStrength;
|
|
+ private final Vector acceleration;
|
|
+ private boolean cancelled = false;
|
|
+
|
|
+ public EntityKnockbackByEntityEvent(LivingEntity entity, Entity hitBy, float knockbackStrength, Vector acceleration) {
|
|
+ super(entity);
|
|
+ this.hitBy = hitBy;
|
|
+ this.knockbackStrength = knockbackStrength;
|
|
+ this.acceleration = acceleration;
|
|
+ }
|
|
+
|
|
+ public HandlerList getHandlers() {
|
|
+ return handlers;
|
|
+ }
|
|
+
|
|
+ public static HandlerList getHandlerList() {
|
|
+ return handlers;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean isCancelled() {
|
|
+ return cancelled;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setCancelled(boolean cancel) {
|
|
+ cancelled = cancel;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * @return the entity which was knocked back
|
|
+ */
|
|
+ @Override
|
|
+ public LivingEntity getEntity() {
|
|
+ return (LivingEntity) super.getEntity();
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * @return the original knockback strength.
|
|
+ */
|
|
+ public float getKnockbackStrength() {
|
|
+ return knockbackStrength;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * @return the Entity which hit
|
|
+ */
|
|
+ public Entity getHitBy() {
|
|
+ return hitBy;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * @return the acceleration that will be applied
|
|
+ */
|
|
+ public Vector getAcceleration() {
|
|
+ return acceleration;
|
|
+ }
|
|
+}
|
|
--
|
|
2.18.0
|
|
|