aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/api/0139-Add-More-Creeper-API.patch
blob: 2ea104b55205337b8ec39a8b0cfdec0fca7951d6 (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
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
index 0000000000000000000000000000000000000000..e86500337f26fcb6bb04545c68c67df32021ce25
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/CreeperIgniteEvent.java
@@ -0,0 +1,60 @@
+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;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Called when a Creeper is ignited either by a
+ * flint and steel, {@link Creeper#ignite()} or
+ * {@link Creeper#setIgnited(boolean)}.
+ */
+public class CreeperIgniteEvent extends EntityEvent implements Cancellable {
+
+    private static final HandlerList HANDLER_LIST = new HandlerList();
+
+    private boolean ignited;
+    private boolean cancelled;
+
+    @ApiStatus.Internal
+    public CreeperIgniteEvent(@NotNull Creeper creeper, boolean ignited) {
+        super(creeper);
+        this.ignited = ignited;
+    }
+
+    @NotNull
+    @Override
+    public Creeper getEntity() {
+        return (Creeper) super.getEntity();
+    }
+
+    public boolean isIgnited() {
+        return this.ignited;
+    }
+
+    public void setIgnited(boolean ignited) {
+        this.ignited = ignited;
+    }
+
+    public boolean isCancelled() {
+        return this.cancelled;
+    }
+
+    public void setCancelled(boolean cancel) {
+        this.cancelled = cancel;
+    }
+
+    @NotNull
+    @Override
+    public HandlerList getHandlers() {
+        return HANDLER_LIST;
+    }
+
+    @NotNull
+    public static HandlerList getHandlerList() {
+        return HANDLER_LIST;
+    }
+}
diff --git a/src/main/java/org/bukkit/entity/Creeper.java b/src/main/java/org/bukkit/entity/Creeper.java
index 5793193d93d76a062fd0431475c269c4978ec993..e144f618702122bf28ebedc5cb8ce0f6ef27c107 100644
--- a/src/main/java/org/bukkit/entity/Creeper.java
+++ b/src/main/java/org/bukkit/entity/Creeper.java
@@ -87,4 +87,20 @@ public interface Creeper extends Monster {
      * griefing gamerule.
      */
     public void ignite();
+    // 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
 }