Skip to content
Prev Previous commit
Next Next commit
Fix annotation
  • Loading branch information
SageSphinx63920 committed Dec 26, 2022
commit 18866473c92550c8aeb376f125f7ba4cb27db375
72 changes: 4 additions & 68 deletions patches/api/0057-Add-PreExplodeEvents.patch
Original file line number Diff line number Diff line change
Expand Up @@ -61,77 +61,12 @@ index 0000000000000000000000000000000000000000..e4bfca1ca2f1cba73244819af6340951
+ return handlers;
+ }
+}
diff --git a/src/main/java/org/purpurmc/purpur/event/entity/GoatRamEntityEvent.java b/src/main/java/org/purpurmc/purpur/event/entity/GoatRamEntityEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..f62c14f3d4999e9112c1c73642aa337d97b94b5a
--- /dev/null
+++ b/src/main/java/org/purpurmc/purpur/event/entity/GoatRamEntityEvent.java
@@ -0,0 +1,59 @@
+package org.purpurmc.purpur.event.entity;
+
+import org.bukkit.entity.Goat;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.entity.EntityEvent;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Called when a goat rams an entity
+ */
+public class GoatRamEntityEvent extends EntityEvent implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ private final LivingEntity rammedEntity;
+ private boolean cancelled;
+
+ public GoatRamEntityEvent(@NotNull Goat goat, @NotNull LivingEntity rammedEntity) {
+ super(goat);
+ this.rammedEntity = rammedEntity;
+ }
+
+ /**
+ * Returns the entity that was rammed by the goat
+ *
+ * @return The rammed entity
+ */
+ @NotNull
+ public LivingEntity getRammedEntity() {
+ return this.rammedEntity;
+ }
+
+ @Override
+ @NotNull
+ public Goat getEntity() {
+ return (Goat) super.getEntity();
+ }
+
+ @Override
+ @NotNull
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return this.cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ this.cancelled = cancel;
+ }
+}
diff --git a/src/main/java/org/purpurmc/purpur/event/entity/PreEntityExplodeEvent.java b/src/main/java/org/purpurmc/purpur/event/entity/PreEntityExplodeEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..8e04a2a391b525d00e36334a6c5b112fb797a821
index 0000000000000000000000000000000000000000..f4740487f80b53be80c4ef2f222616cc61e67c52
--- /dev/null
+++ b/src/main/java/org/purpurmc/purpur/event/entity/PreEntityExplodeEvent.java
@@ -0,0 +1,62 @@
@@ -0,0 +1,63 @@
+package org.purpurmc.purpur.event.entity;
+
+import org.bukkit.Location;
Expand All @@ -149,7 +84,7 @@ index 0000000000000000000000000000000000000000..8e04a2a391b525d00e36334a6c5b112f
+ private final float yield;
+ private final Location location;
+
+ public PreEntityExplodeEvent(org.bukkit.entity.Entity what, @NotNull final Location location, final float yield) {
+ public PreEntityExplodeEvent(@NotNull org.bukkit.entity.Entity what, @NotNull final Location location, final float yield) {
+ super(what);
+ this.cancelled = false;
+ this.yield = yield;
Expand All @@ -170,6 +105,7 @@ index 0000000000000000000000000000000000000000..8e04a2a391b525d00e36334a6c5b112f
+ *
+ * @return The location of the explosion
+ */
+ @NotNull
+ public Location getLocation() {
+ return location;
+ }
Expand Down