mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-22 18:45:54 +01:00
5c7081fecc
* Updated Upstream (Bukkit/CraftBukkit) 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 Bukkit Changes: 45690fe9 SPIGOT-5047: Correct slot types for 1.14 inventories CraftBukkit Changes:4090d01f
SPIGOT-5047: Correct slot types for 1.14 inventoriese8c08362
SPIGOT-5046: World#getLoadedChunks returning inaccessible cached chunks.d445af3b
SPIGOT-5067: Add item meta for 1.14 spawn eggs * Bring Chunk load checks in-line with spigot As of the last upstream merge spigot now checks ticket level status when returning loaded chunks for a world from api. Now our checks will respect that decision. * Fix spawn ticket levels Vanilla would keep the inner chunks of spawn available for ticking, however my changes made all chunks non-ticking. Resolve by changing ticket levels for spawn chunks inside the border to respect this behavior. * Make World#getChunkIfLoadedImmediately return only entity ticking chunks Mojang appears to be using chunks with level > 33 (non-ticking chunks) as cached chunks and not actually loaded chunks. * Bring all loaded checks in line with spigot Loaded chunks must be at least border chunks, or level <= 33
127 lines
4.2 KiB
Diff
127 lines
4.2 KiB
Diff
From f85769e8ba9c1aa2b67b14ed2c91ad26f639801f Mon Sep 17 00:00:00 2001
|
|
From: AlphaBlend <whizkid3000@hotmail.com>
|
|
Date: Sun, 16 Oct 2016 23:19:34 -0700
|
|
Subject: [PATCH] Add EntityZapEvent
|
|
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/EntityZapEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/EntityZapEvent.java
|
|
new file mode 100644
|
|
index 000000000..3b725a489
|
|
--- /dev/null
|
|
+++ b/src/main/java/com/destroystokyo/paper/event/entity/EntityZapEvent.java
|
|
@@ -0,0 +1,65 @@
|
|
+package com.destroystokyo.paper.event.entity;
|
|
+
|
|
+import org.apache.commons.lang.Validate;
|
|
+import org.bukkit.entity.Entity;
|
|
+import org.bukkit.entity.LightningStrike;
|
|
+import org.bukkit.event.Cancellable;
|
|
+import org.bukkit.event.HandlerList;
|
|
+import org.bukkit.event.entity.EntityEvent;
|
|
+import org.bukkit.event.entity.EntityTransformEvent;
|
|
+
|
|
+import java.util.Collections;
|
|
+import org.jetbrains.annotations.NotNull;
|
|
+
|
|
+/**
|
|
+ * Fired when lightning strikes an entity
|
|
+ */
|
|
+public class EntityZapEvent extends EntityTransformEvent implements Cancellable {
|
|
+ private static final HandlerList handlers = new HandlerList();
|
|
+ private boolean cancelled;
|
|
+ @NotNull private final LightningStrike bolt;
|
|
+
|
|
+ public EntityZapEvent(@NotNull final Entity entity, @NotNull final LightningStrike bolt, @NotNull final Entity replacementEntity) {
|
|
+ super(entity, Collections.singletonList(replacementEntity), TransformReason.LIGHTNING);
|
|
+ Validate.notNull(bolt);
|
|
+ Validate.notNull(replacementEntity);
|
|
+ this.bolt = bolt;
|
|
+ }
|
|
+
|
|
+ public boolean isCancelled() {
|
|
+ return cancelled;
|
|
+ }
|
|
+
|
|
+ public void setCancelled(boolean cancel) {
|
|
+ this.cancelled = cancel;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Gets the lightning bolt that is striking the entity.
|
|
+ * @return The lightning bolt responsible for this event
|
|
+ */
|
|
+ @NotNull
|
|
+ public LightningStrike getBolt() {
|
|
+ return bolt;
|
|
+ }
|
|
+
|
|
+ /**
|
|
+ * Gets the entity that will replace the struck entity.
|
|
+ * @return The entity that will replace the struck entity
|
|
+ */
|
|
+ @NotNull
|
|
+ public Entity getReplacementEntity() {
|
|
+ return getTransformedEntity();
|
|
+ }
|
|
+
|
|
+ @NotNull
|
|
+ @Override
|
|
+ public HandlerList getHandlers() {
|
|
+ return handlers;
|
|
+ }
|
|
+
|
|
+ @NotNull
|
|
+ public static HandlerList getHandlerList() {
|
|
+ return handlers;
|
|
+ }
|
|
+}
|
|
diff --git a/src/main/java/org/bukkit/event/entity/PigZapEvent.java b/src/main/java/org/bukkit/event/entity/PigZapEvent.java
|
|
index 0e0ed93b5..d3949edfc 100644
|
|
--- a/src/main/java/org/bukkit/event/entity/PigZapEvent.java
|
|
+++ b/src/main/java/org/bukkit/event/entity/PigZapEvent.java
|
|
@@ -2,6 +2,7 @@ package org.bukkit.event.entity;
|
|
|
|
import java.util.Collections;
|
|
import org.bukkit.entity.Entity;
|
|
+import com.destroystokyo.paper.event.entity.EntityZapEvent;
|
|
import org.bukkit.entity.LightningStrike;
|
|
import org.bukkit.entity.Pig;
|
|
import org.bukkit.entity.PigZombie;
|
|
@@ -12,14 +13,14 @@ import org.jetbrains.annotations.NotNull;
|
|
/**
|
|
* Stores data for pigs being zapped
|
|
*/
|
|
-public class PigZapEvent extends EntityTransformEvent implements Cancellable {
|
|
- private static final HandlerList handlers = new HandlerList();
|
|
+public class PigZapEvent extends EntityZapEvent implements Cancellable {
|
|
+ //private static final HandlerList handlers = new HandlerList();
|
|
private boolean canceled;
|
|
private final PigZombie pigzombie;
|
|
private final LightningStrike bolt;
|
|
|
|
public PigZapEvent(@NotNull final Pig pig, @NotNull final LightningStrike bolt, @NotNull final PigZombie pigzombie) {
|
|
- super(pig, Collections.singletonList((Entity) pigzombie), TransformReason.LIGHTNING);
|
|
+ super(pig, bolt, pigzombie);
|
|
this.bolt = bolt;
|
|
this.pigzombie = pigzombie;
|
|
}
|
|
@@ -63,6 +64,8 @@ public class PigZapEvent extends EntityTransformEvent implements Cancellable {
|
|
return pigzombie;
|
|
}
|
|
|
|
+ // Paper start
|
|
+ /*
|
|
@NotNull
|
|
@Override
|
|
public HandlerList getHandlers() {
|
|
@@ -73,4 +76,6 @@ public class PigZapEvent extends EntityTransformEvent implements Cancellable {
|
|
public static HandlerList getHandlerList() {
|
|
return handlers;
|
|
}
|
|
+ */
|
|
+ // Paper end
|
|
}
|
|
--
|
|
2.21.0
|
|
|