Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-15 02:50:09 +01:00
4e958e229f
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com> Co-authored-by: zml <zml@stellardrift.ca> Co-authored-by: Mariell Hoversholm <proximyst@proximyst.com>
99 Zeilen
2.8 KiB
Diff
99 Zeilen
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..ff10251b6ded533b08048ec533525176eff03707
|
|
--- /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 1b8ece6dfd64c4913dc997fe7ad2fc01975af8c7..faaeb44a99f26dfd1465f0021c75d4c349beaa3e 100644
|
|
--- a/src/main/java/org/bukkit/entity/Creeper.java
|
|
+++ b/src/main/java/org/bukkit/entity/Creeper.java
|
|
@@ -71,4 +71,27 @@ 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();
|
|
+
|
|
+ /**
|
|
+ * Get the number of ticks this creeper has been ignited (armed to explode)
|
|
+ *
|
|
+ * @return Ticks creeper has been ignited
|
|
+ */
|
|
+ public int getFuseTicks();
|
|
+ // Paper end
|
|
}
|