mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-03 01:10:37 +01:00
103 lines
2.7 KiB
Diff
103 lines
2.7 KiB
Diff
From 9170ad8b1b11975233995f46a677b145286c471b 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 00000000..3d10bb03
|
|
--- /dev/null
|
|
+++ b/src/main/java/com/destroystokyo/paper/event/entity/CreeperIgniteEvent.java
|
|
@@ -0,0 +1,50 @@
|
|
+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;
|
|
+
|
|
+/**
|
|
+ * 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;
|
|
+
|
|
+ public CreeperIgniteEvent(Creeper creeper, boolean ignited) {
|
|
+ super(creeper);
|
|
+ this.ignited = ignited;
|
|
+ }
|
|
+
|
|
+ @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;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public HandlerList getHandlers() {
|
|
+ return handlers;
|
|
+ }
|
|
+
|
|
+ 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
|
|
index f957d836..b9877fb8 100644
|
|
--- a/src/main/java/org/bukkit/entity/Creeper.java
|
|
+++ b/src/main/java/org/bukkit/entity/Creeper.java
|
|
@@ -50,4 +50,32 @@ public interface Creeper extends Monster {
|
|
* @return the explosion radius
|
|
*/
|
|
public int getExplosionRadius();
|
|
+
|
|
+ // 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();
|
|
+
|
|
+ /**
|
|
+ * Get the number of ticks this creeper has been ignited (armed to explode)
|
|
+ *
|
|
+ * @return Ticks creeper has been ignited
|
|
+ */
|
|
+ public int getFuseTicks();
|
|
+
|
|
+ /**
|
|
+ * Make the creeper explode (no waiting for fuse)
|
|
+ */
|
|
+ public void explode();
|
|
+ // Paper end
|
|
}
|
|
--
|
|
2.19.0
|
|
|