Paper/patches/api/0141-Add-More-Creeper-API.patch
Nassim Jahnke 928bcc8d3a
Updated Upstream (Bukkit/CraftBukkit) (#8430)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
09943450 Update SnakeYAML version
5515734f SPIGOT-7162: Incorrect description for Entity#getVehicle javadoc
6f82b381 PR-788: Add getHand() to all relevant events

CraftBukkit Changes:
aaf484f6f SPIGOT-7163: CraftMerchantRecipe doesn't copy demand and specialPrice from BukkitMerchantRecipe
5329dd6fd PR-1107: Add getHand() to all relevant events
93061706e SPIGOT-7045: Ocelots never spawn with babies with spawn reason OCELOT_BABY
2022-10-02 09:56:36 +02:00

94 lines
2.7 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..e9768c919a1860881802ab68eff559874590ac1c
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/event/entity/CreeperIgniteEvent.java
@@ -0,0 +1,56 @@
+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 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 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 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
}