Paper/Spigot-API-Patches/0140-Add-More-Creeper-API.patch
Shane Freeder 0976d52bbd Updated Upstream (Bukkit/CraftBukkit/Spigot)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Please note that this build includes changes to meet upstreams
requirements for nullability annotations. While we aim for a level of
accuracy, these might not be 100% correct, if there are any issues,
please speak to us on discord, or open an issue on the tracker to
discuss.

Bukkit Changes:
9a6a1de3 Remove nullability annotations from enum constructors
3f0591ea SPIGOT-2540: Add nullability annotations to entire Bukkit API

CraftBukkit Changes:
8d8475fc SPIGOT-4666: Force parameter in HumanEntity#sleep
8b1588e2 Fix ExplosionPrimeEvent#setFire not working with EnderCrystals
39a287b7 Don't ignore newlines in PlayerListHeader/Footer

Spigot Changes:
cf694d87 Add nullability annotations
2019-03-20 00:31:18 +00:00

107 Zeilen
2.8 KiB
Diff

From ff30ce1b5f7f61dfc6ad8e26fac0459dc0f7d8b7 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 000000000..ff10251b6
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/CreeperIgniteEvent.java
@@ -0,0 +1,54 @@
+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.NotNull;
+
+/**
+ * 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(@NotNull Creeper creeper, boolean ignited) {
+ super(creeper);
+ this.ignited = ignited;
+ }
+
+ @NotNull
+ @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;
+ }
+
+ @NotNull
+ @Override
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ @NotNull
+ 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 f957d8368..b9877fb88 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.21.0