mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Added goat ram event
This commit is contained in:
@@ -1,70 +0,0 @@
|
||||
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..f0a7fe694db145294ff93d320382d1baecc68702
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/purpurmc/purpur/event/entity/GoatRamEntityEvent.java
|
||||
@@ -0,0 +1,58 @@
|
||||
+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.ApiStatus;
|
||||
+import org.jspecify.annotations.NullMarked;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a goat rams an entity
|
||||
+ */
|
||||
+@NullMarked
|
||||
+public class GoatRamEntityEvent extends EntityEvent implements Cancellable {
|
||||
+ private static final HandlerList handlers = new HandlerList();
|
||||
+ private final LivingEntity rammedEntity;
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
+ @ApiStatus.Internal
|
||||
+ public GoatRamEntityEvent(Goat goat, LivingEntity rammedEntity) {
|
||||
+ super(goat);
|
||||
+ this.rammedEntity = rammedEntity;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Returns the entity that was rammed by the goat
|
||||
+ *
|
||||
+ * @return The rammed entity
|
||||
+ */
|
||||
+ public LivingEntity getRammedEntity() {
|
||||
+ return this.rammedEntity;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public Goat getEntity() {
|
||||
+ return (Goat) super.getEntity();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public HandlerList getHandlers() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ public static HandlerList getHandlerList() {
|
||||
+ return handlers;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean isCancelled() {
|
||||
+ return this.cancelled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setCancelled(boolean cancel) {
|
||||
+ this.cancelled = cancel;
|
||||
+ }
|
||||
+}
|
||||
Reference in New Issue
Block a user