mirror of
https://github.com/PurpurMC/Purpur.git
synced 2025-02-17 13:00:04 +08:00
72 lines
2.0 KiB
Diff
72 lines
2.0 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: SageSphinx63920 <sage@sagesphinx63920.dev>
|
|
Date: Sat, 29 Oct 2022 00:06:05 +0200
|
|
Subject: [PATCH] Added goat ram event
|
|
|
|
|
|
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;
|
|
+ }
|
|
+}
|