1
0
Fork 0
mirror of https://github.com/PaperMC/Paper.git synced 2024-12-22 06:25:15 +01:00
PaperMC/patches/api/0124-SkeletonHorse-Additions.patch

100 lines
3 KiB
Diff
Raw Normal View History

2021-06-11 14:02:28 +02:00
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
2021-06-11 14:02:28 +02:00
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/SkeletonHorseTrapEvent.java
@@ -0,0 +1,64 @@
2021-06-11 14:02:28 +02:00
+package com.destroystokyo.paper.event.entity;
+
+import com.google.common.collect.ImmutableList;
+import java.util.List;
2021-06-11 14:02:28 +02:00
+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;
2024-02-01 10:15:57 +01:00
+import org.jetbrains.annotations.ApiStatus;
+import org.jspecify.annotations.NullMarked;
2021-06-11 14:02:28 +02:00
+
+/**
+ * Event called when a player gets close to a skeleton horse and triggers the lightning trap
+ */
+@NullMarked
2021-06-11 14:02:28 +02:00
+public class SkeletonHorseTrapEvent extends EntityEvent implements Cancellable {
2024-02-01 10:15:57 +01:00
+
+ private static final HandlerList HANDLER_LIST = new HandlerList();
+
2021-06-11 14:02:28 +02:00
+ private final List<HumanEntity> eligibleHumans;
2024-02-01 10:15:57 +01:00
+ private boolean cancelled;
2021-06-11 14:02:28 +02:00
+
2024-02-01 10:15:57 +01:00
+ @Deprecated
+ @ApiStatus.Internal
+ public SkeletonHorseTrapEvent(final SkeletonHorse horse) {
2021-06-11 14:02:28 +02:00
+ this(horse, ImmutableList.of());
+ }
+
2024-02-01 10:15:57 +01:00
+ @ApiStatus.Internal
+ public SkeletonHorseTrapEvent(final SkeletonHorse horse, final List<HumanEntity> eligibleHumans) {
2021-06-11 14:02:28 +02:00
+ super(horse);
+ this.eligibleHumans = eligibleHumans;
+ }
+
+ @Override
+ public SkeletonHorse getEntity() {
+ return (SkeletonHorse) super.getEntity();
+ }
+
2024-02-01 10:15:57 +01:00
+ public List<HumanEntity> getEligibleHumans() {
+ return this.eligibleHumans;
+ }
+
2021-06-11 14:02:28 +02:00
+ @Override
+ public boolean isCancelled() {
2024-02-01 10:15:57 +01:00
+ return this.cancelled;
2021-06-11 14:02:28 +02:00
+ }
+
+ @Override
+ public void setCancelled(final boolean cancel) {
2021-06-11 14:02:28 +02:00
+ this.cancelled = cancel;
+ }
+
+ @Override
+ public HandlerList getHandlers() {
2024-02-01 10:15:57 +01:00
+ return HANDLER_LIST;
2021-06-11 14:02:28 +02:00
+ }
+
+ public static HandlerList getHandlerList() {
2024-02-01 10:15:57 +01:00
+ return HANDLER_LIST;
2021-06-11 14:02:28 +02:00
+ }
+}
+
diff --git a/src/main/java/org/bukkit/entity/SkeletonHorse.java b/src/main/java/org/bukkit/entity/SkeletonHorse.java
index a34ad28fc43bde224c39253e8479bf7bb7e8df1c..38539d5b77e06865aa65b8db0c1a3b6eaa914d03 100644
2021-06-11 14:02:28 +02:00
--- 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);
2021-06-11 14:02:28 +02:00
+
+ // Paper start
+ /**
+ * @deprecated use {@link #isTrapped()}
+ */
+ @Deprecated
2021-06-11 14:02:28 +02:00
+ boolean isTrap();
+
+ /**
+ * @deprecated use {@link #setTrapped(boolean)}
+ */
+ @Deprecated
2021-06-11 14:02:28 +02:00
+ void setTrap(boolean trap);
+ // Paper end
}