2020-05-02 00:03:47 +02:00
|
|
|
From ef8376f5dd7ea665773c7dea55b6878db985d791 Mon Sep 17 00:00:00 2001
|
2018-08-27 09:01:09 +02:00
|
|
|
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
|
2020-04-02 23:07:06 +02:00
|
|
|
index 000000000..ff10251b6
|
2018-08-27 09:01:09 +02:00
|
|
|
--- /dev/null
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/event/entity/CreeperIgniteEvent.java
|
2019-03-20 01:28:15 +01:00
|
|
|
@@ -0,0 +1,54 @@
|
2018-08-27 09:01:09 +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;
|
2019-03-20 01:28:15 +01:00
|
|
|
+import org.jetbrains.annotations.NotNull;
|
2018-08-27 09:01:09 +02:00
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * Called when a Creeper is ignite flag is changed (armed/disarmed to explode).
|
|
|
|
+ */
|
|
|
|
+public class CreeperIgniteEvent extends EntityEvent implements Cancellable {
|
|
|
|
+ private static final HandlerList handlers = new HandlerList();
|
|
|
|
+ private boolean canceled;
|
|
|
|
+ private boolean ignited;
|
|
|
|
+
|
2019-03-20 01:28:15 +01:00
|
|
|
+ public CreeperIgniteEvent(@NotNull Creeper creeper, boolean ignited) {
|
2018-08-27 09:01:09 +02:00
|
|
|
+ super(creeper);
|
|
|
|
+ this.ignited = ignited;
|
|
|
|
+ }
|
|
|
|
+
|
2019-03-20 01:28:15 +01:00
|
|
|
+ @NotNull
|
2018-08-27 09:01:09 +02:00
|
|
|
+ @Override
|
|
|
|
+ public Creeper getEntity() {
|
|
|
|
+ return (Creeper) entity;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public boolean isIgnited() {
|
|
|
|
+ return ignited;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void setIgnited(boolean ignited) {
|
|
|
|
+ this.ignited = ignited;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public boolean isCancelled() {
|
|
|
|
+ return canceled;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void setCancelled(boolean cancel) {
|
|
|
|
+ canceled = cancel;
|
|
|
|
+ }
|
|
|
|
+
|
2019-03-20 01:28:15 +01:00
|
|
|
+ @NotNull
|
2018-08-27 09:01:09 +02:00
|
|
|
+ @Override
|
|
|
|
+ public HandlerList getHandlers() {
|
|
|
|
+ return handlers;
|
|
|
|
+ }
|
|
|
|
+
|
2019-03-20 01:28:15 +01:00
|
|
|
+ @NotNull
|
2018-08-27 09:01:09 +02:00
|
|
|
+ public static HandlerList getHandlerList() {
|
|
|
|
+ return handlers;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
diff --git a/src/main/java/org/bukkit/entity/Creeper.java b/src/main/java/org/bukkit/entity/Creeper.java
|
2020-04-02 23:07:06 +02:00
|
|
|
index 1b8ece6df..faaeb44a9 100644
|
2018-08-27 09:01:09 +02:00
|
|
|
--- a/src/main/java/org/bukkit/entity/Creeper.java
|
|
|
|
+++ b/src/main/java/org/bukkit/entity/Creeper.java
|
2019-06-19 13:55:03 +02:00
|
|
|
@@ -71,4 +71,27 @@ public interface Creeper extends Monster {
|
|
|
|
* griefing gamerule.
|
2018-08-27 09:01:09 +02:00
|
|
|
*/
|
2019-06-19 13:55:03 +02:00
|
|
|
public void ignite();
|
2018-08-27 09:01:09 +02:00
|
|
|
+ // Paper start
|
2019-06-19 13:55:03 +02:00
|
|
|
+
|
2018-08-27 09:01:09 +02:00
|
|
|
+ /**
|
|
|
|
+ * 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();
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Get the number of ticks this creeper has been ignited (armed to explode)
|
|
|
|
+ *
|
|
|
|
+ * @return Ticks creeper has been ignited
|
|
|
|
+ */
|
|
|
|
+ public int getFuseTicks();
|
|
|
|
+ // Paper end
|
|
|
|
}
|
|
|
|
--
|
2020-05-02 00:03:47 +02:00
|
|
|
2.26.2
|
2018-08-27 09:01:09 +02:00
|
|
|
|