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, 24 Aug 2018 11:50:16 -0500
|
|
|
|
Subject: [PATCH] Add More Creeper API
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/CreeperIgniteEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/CreeperIgniteEvent.java
|
|
|
|
new file mode 100644
|
2024-02-01 10:15:57 +01:00
|
|
|
index 0000000000000000000000000000000000000000..e86500337f26fcb6bb04545c68c67df32021ce25
|
2021-06-11 14:02:28 +02:00
|
|
|
--- /dev/null
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/event/entity/CreeperIgniteEvent.java
|
2024-02-01 10:15:57 +01:00
|
|
|
@@ -0,0 +1,60 @@
|
2021-06-11 14:02:28 +02:00
|
|
|
+package com.destroystokyo.paper.event.entity;
|
|
|
|
+
|
|
|
|
+import org.bukkit.entity.Creeper;
|
|
|
|
+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;
|
2021-06-11 14:02:28 +02:00
|
|
|
+import org.jetbrains.annotations.NotNull;
|
|
|
|
+
|
|
|
|
+/**
|
2022-07-31 19:14:54 +02:00
|
|
|
+ * Called when a Creeper is ignited either by a
|
|
|
|
+ * flint and steel, {@link Creeper#ignite()} or
|
|
|
|
+ * {@link Creeper#setIgnited(boolean)}.
|
2021-06-11 14:02:28 +02:00
|
|
|
+ */
|
|
|
|
+public class CreeperIgniteEvent 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 boolean ignited;
|
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
|
|
|
+ @ApiStatus.Internal
|
2021-06-11 14:02:28 +02:00
|
|
|
+ public CreeperIgniteEvent(@NotNull Creeper creeper, boolean ignited) {
|
|
|
|
+ super(creeper);
|
|
|
|
+ this.ignited = ignited;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @NotNull
|
|
|
|
+ @Override
|
|
|
|
+ public Creeper getEntity() {
|
2024-02-01 10:15:57 +01:00
|
|
|
+ return (Creeper) super.getEntity();
|
2021-06-11 14:02:28 +02:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public boolean isIgnited() {
|
2024-02-01 10:15:57 +01:00
|
|
|
+ return this.ignited;
|
2021-06-11 14:02:28 +02:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void setIgnited(boolean ignited) {
|
|
|
|
+ this.ignited = ignited;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public boolean isCancelled() {
|
2024-02-01 10:15:57 +01:00
|
|
|
+ return this.cancelled;
|
2021-06-11 14:02:28 +02:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void setCancelled(boolean cancel) {
|
2024-02-01 10:15:57 +01:00
|
|
|
+ this.cancelled = cancel;
|
2021-06-11 14:02:28 +02:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @NotNull
|
|
|
|
+ @Override
|
|
|
|
+ public HandlerList getHandlers() {
|
2024-02-01 10:15:57 +01:00
|
|
|
+ return HANDLER_LIST;
|
2021-06-11 14:02:28 +02:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @NotNull
|
|
|
|
+ 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/Creeper.java b/src/main/java/org/bukkit/entity/Creeper.java
|
2024-07-06 21:19:14 +02:00
|
|
|
index e440b06f358e7edc87254e46d1a2002216ebbab1..5e750f4043fdf5ac9836056a015148df92aed067 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/org/bukkit/entity/Creeper.java
|
|
|
|
+++ b/src/main/java/org/bukkit/entity/Creeper.java
|
2024-07-06 21:19:14 +02:00
|
|
|
@@ -112,4 +112,20 @@ public interface Creeper extends Monster {
|
2021-06-11 14:02:28 +02:00
|
|
|
*/
|
2024-07-06 21:19:14 +02:00
|
|
|
@Nullable
|
|
|
|
public Entity getIgniter();
|
2021-06-11 14:02:28 +02:00
|
|
|
+ // Paper start
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Set whether creeper is ignited or not (armed to explode)
|
|
|
|
+ *
|
|
|
|
+ * @param ignited New ignited state
|
|
|
|
+ */
|
|
|
|
+ public void setIgnited(boolean ignited);
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Check if creeper is ignited or not (armed to explode)
|
|
|
|
+ *
|
|
|
|
+ * @return Ignited state
|
|
|
|
+ */
|
|
|
|
+ public boolean isIgnited();
|
|
|
|
+ // Paper end
|
|
|
|
}
|