testserver/patches/api/0129-SkeletonHorse-Addition...

98 lines
2.9 KiB
Diff
Raw Normal View History

2021-06-11 12:02:28 +00: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..9ce2948dfaa56d0adf53fe9b6117a90d7773b771
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/SkeletonHorseTrapEvent.java
@@ -0,0 +1,62 @@
+package com.destroystokyo.paper.event.entity;
+
+import com.google.common.collect.ImmutableList;
+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.NotNull;
+
+import java.util.List;
+
+/**
+ * Event called when a player gets close to a skeleton horse and triggers the lightning trap
+ */
+public class SkeletonHorseTrapEvent extends EntityEvent implements Cancellable {
+ private static final HandlerList handlers = new HandlerList();
+ private boolean cancelled;
+ private final List<HumanEntity> eligibleHumans;
+
+ public SkeletonHorseTrapEvent(@NotNull SkeletonHorse horse) {
+ this(horse, ImmutableList.of());
+ }
+
+ public SkeletonHorseTrapEvent(@NotNull SkeletonHorse horse, @NotNull List<HumanEntity> eligibleHumans) {
+ super(horse);
+ this.eligibleHumans = eligibleHumans;
+ }
+
+ @NotNull
+ @Override
+ public SkeletonHorse getEntity() {
+ return (SkeletonHorse) super.getEntity();
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ this.cancelled = cancel;
+ }
+
+ @NotNull
+ public List<HumanEntity> getEligibleHumans() {
+ return eligibleHumans;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
+}
+
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 12:02:28 +00: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 12:02:28 +00:00
+
+ // Paper start
+ /**
+ * @deprecated use {@link #isTrapped()}
+ */
+ @Deprecated
2021-06-11 12:02:28 +00:00
+ boolean isTrap();
+
+ /**
+ * @deprecated use {@link #setTrapped(boolean)}
+ */
+ @Deprecated
2021-06-11 12:02:28 +00:00
+ void setTrap(boolean trap);
+ // Paper end
}