diff options
author | Owen <[email protected]> | 2023-02-19 09:57:10 -0500 |
---|---|---|
committer | GitHub <[email protected]> | 2023-02-19 08:57:10 -0600 |
commit | 841da90501564e5b430a8469cac6e6a77627725d (patch) | |
tree | 934f58b2dfbf689e502651e4a3ad51383779f4c0 /patches/server/0109-Add-EntityZapEvent.patch | |
parent | f9dc371fd8c56f1ad1359fc3bf1f7a40921ec66f (diff) | |
download | Paper-841da90501564e5b430a8469cac6e6a77627725d.tar.gz Paper-841da90501564e5b430a8469cac6e6a77627725d.zip |
Paper Plugins (#8108)
Diffstat (limited to 'patches/server/0109-Add-EntityZapEvent.patch')
-rw-r--r-- | patches/server/0109-Add-EntityZapEvent.patch | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/patches/server/0109-Add-EntityZapEvent.patch b/patches/server/0109-Add-EntityZapEvent.patch deleted file mode 100644 index ed04da07aa..0000000000 --- a/patches/server/0109-Add-EntityZapEvent.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: AlphaBlend <[email protected]> -Date: Sun, 16 Oct 2016 23:19:30 -0700 -Subject: [PATCH] Add EntityZapEvent - - -diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java -index 18ba4b9d9b68088afd48d1f12cec6b155ea84159..dfc67cd0ef52939be5e5a9952cfcdb4d87bf0d82 100644 ---- a/src/main/java/net/minecraft/world/entity/npc/Villager.java -+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java -@@ -837,10 +837,17 @@ public class Villager extends AbstractVillager implements ReputationEventHandler - @Override - public void thunderHit(ServerLevel world, LightningBolt lightning) { - if (world.getDifficulty() != Difficulty.PEACEFUL) { -- Villager.LOGGER.info("Villager {} was struck by lightning {}.", this, lightning); -+ // Paper - move log down, event can cancel - Witch entitywitch = (Witch) EntityType.WITCH.create(world); - - if (entitywitch != null) { -+ // Paper start -+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityZapEvent(this, lightning, entitywitch).isCancelled()) { -+ return; -+ } -+ if (org.spigotmc.SpigotConfig.logVillagerDeaths) Villager.LOGGER.info("Villager {} was struck by lightning {}.", this, lightning); // Move down -+ // Paper end -+ - entitywitch.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot()); - entitywitch.finalizeSpawn(world, world.getCurrentDifficultyAt(entitywitch.blockPosition()), MobSpawnType.CONVERSION, (SpawnGroupData) null, (CompoundTag) null); - entitywitch.setNoAi(this.isNoAi()); -diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 3b520b1301eb0225cdcbb271c8032726c59d3990..d8ebe20844136f2a5b395669dcfdd7f6bbc6fff3 100644 ---- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -1158,6 +1158,14 @@ public class CraftEventFactory { - return event; - } - -+ // Paper start -+ public static com.destroystokyo.paper.event.entity.EntityZapEvent callEntityZapEvent (Entity entity, Entity lightning, Entity changedEntity) { -+ com.destroystokyo.paper.event.entity.EntityZapEvent event = new com.destroystokyo.paper.event.entity.EntityZapEvent(entity.getBukkitEntity(), (LightningStrike) lightning.getBukkitEntity(), changedEntity.getBukkitEntity()); -+ entity.getBukkitEntity().getServer().getPluginManager().callEvent(event); -+ return event; -+ } -+ // Paper end -+ - public static HorseJumpEvent callHorseJumpEvent(Entity horse, float power) { - HorseJumpEvent event = new HorseJumpEvent((AbstractHorse) horse.getBukkitEntity(), power); - horse.getBukkitEntity().getServer().getPluginManager().callEvent(event); |