mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-24 19:56:25 +00:00
98 lines
2.8 KiB
Diff
98 lines
2.8 KiB
Diff
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..8b97cc830aa8bdb09dec3c4b8ebe4fb22d279f46
|
|
--- /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.jspecify.annotations.NullMarked;
|
|
+
|
|
+/**
|
|
+ * Called when a Creeper is ignited either by a
|
|
+ * flint and steel, {@link Creeper#ignite()} or
|
|
+ * {@link Creeper#setIgnited(boolean)}.
|
|
+ */
|
|
+@NullMarked
|
|
+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(final Creeper creeper, final boolean ignited) {
|
|
+ super(creeper);
|
|
+ this.ignited = ignited;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public Creeper getEntity() {
|
|
+ return (Creeper) super.getEntity();
|
|
+ }
|
|
+
|
|
+ public boolean isIgnited() {
|
|
+ return this.ignited;
|
|
+ }
|
|
+
|
|
+ public void setIgnited(final boolean ignited) {
|
|
+ this.ignited = ignited;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public boolean isCancelled() {
|
|
+ return this.cancelled;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setCancelled(final boolean cancel) {
|
|
+ this.cancelled = cancel;
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public HandlerList getHandlers() {
|
|
+ return HANDLER_LIST;
|
|
+ }
|
|
+
|
|
+ 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 e440b06f358e7edc87254e46d1a2002216ebbab1..5e750f4043fdf5ac9836056a015148df92aed067 100644
|
|
--- a/src/main/java/org/bukkit/entity/Creeper.java
|
|
+++ b/src/main/java/org/bukkit/entity/Creeper.java
|
|
@@ -112,4 +112,20 @@ public interface Creeper extends Monster {
|
|
*/
|
|
@Nullable
|
|
public Entity getIgniter();
|
|
+ // 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
|
|
}
|