aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/api/0124-SkeletonHorse-Additions.patch
blob: c3c88038f576c87dc3c4147adca56b01cd7d88d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Fri, 27 Jul 2018 22:36:17 -0500
Subject: [PATCH] SkeletonHorse Additions


diff --git a/src/main/java/com/destroystokyo/paper/event/entity/SkeletonHorseTrapEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/SkeletonHorseTrapEvent.java
new file mode 100644
index 0000000000000000000000000000000000000000..a70f4972a012f955b45a91fe20ca5df7e2123528
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/SkeletonHorseTrapEvent.java
@@ -0,0 +1,64 @@
+package com.destroystokyo.paper.event.entity;
+
+import com.google.common.collect.ImmutableList;
+import java.util.List;
+import org.bukkit.entity.HumanEntity;
+import org.bukkit.entity.SkeletonHorse;
+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;
+
+/**
+ * Event called when a player gets close to a skeleton horse and triggers the lightning trap
+ */
+@NullMarked
+public class SkeletonHorseTrapEvent extends EntityEvent implements Cancellable {
+
+    private static final HandlerList HANDLER_LIST = new HandlerList();
+
+    private final List<HumanEntity> eligibleHumans;
+    private boolean cancelled;
+
+    @Deprecated
+    @ApiStatus.Internal
+    public SkeletonHorseTrapEvent(final SkeletonHorse horse) {
+        this(horse, ImmutableList.of());
+    }
+
+    @ApiStatus.Internal
+    public SkeletonHorseTrapEvent(final SkeletonHorse horse, final List<HumanEntity> eligibleHumans) {
+        super(horse);
+        this.eligibleHumans = eligibleHumans;
+    }
+
+    @Override
+    public SkeletonHorse getEntity() {
+        return (SkeletonHorse) super.getEntity();
+    }
+
+    public List<HumanEntity> getEligibleHumans() {
+        return this.eligibleHumans;
+    }
+
+    @Override
+    public boolean isCancelled() {
+        return this.cancelled;
+    }
+
+    @Override
+    public void setCancelled(final boolean cancel) {
+        this.cancelled = cancel;
+    }
+
+    @Override
+    public HandlerList getHandlers() {
+        return HANDLER_LIST;
+    }
+
+    public static HandlerList getHandlerList() {
+        return HANDLER_LIST;
+    }
+}
+
diff --git a/src/main/java/org/bukkit/entity/SkeletonHorse.java b/src/main/java/org/bukkit/entity/SkeletonHorse.java
index a34ad28fc43bde224c39253e8479bf7bb7e8df1c..38539d5b77e06865aa65b8db0c1a3b6eaa914d03 100644
--- a/src/main/java/org/bukkit/entity/SkeletonHorse.java
+++ b/src/main/java/org/bukkit/entity/SkeletonHorse.java
@@ -43,4 +43,18 @@ public interface SkeletonHorse extends AbstractHorse {
      * @param trapTime new trap time
      */
     void setTrapTime(int trapTime);
+
+    // Paper start
+    /**
+     * @deprecated use {@link #isTrapped()}
+     */
+    @Deprecated
+    boolean isTrap();
+
+    /**
+     * @deprecated use {@link #setTrapped(boolean)}
+     */
+    @Deprecated
+    void setTrap(boolean trap);
+    // Paper end
 }