3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 12:30:06 +01:00
Paper/Spigot-Server-Patches/0658-Added-firing-of-PlayerChangeBeaconEffectEvent.patch
Josh Roy be13705177
Updated Upstream (CraftBukkit) (#5484)
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

CraftBukkit Changes:
6b8cd9a7 SPIGOT-6207: forcibly drop the items of a converted zombie villager
2021-04-12 02:03:08 +01:00

40 Zeilen
1.9 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Wed, 24 Jun 2020 15:14:51 -0600
Subject: [PATCH] Added firing of PlayerChangeBeaconEffectEvent
diff --git a/src/main/java/net/minecraft/world/inventory/ContainerBeacon.java b/src/main/java/net/minecraft/world/inventory/ContainerBeacon.java
index 7e5a0bad616d9477e01426ab1604184ef3fab1c1..085298a9c3837dfa48dfbbf02d6261db12c79036 100644
--- a/src/main/java/net/minecraft/world/inventory/ContainerBeacon.java
+++ b/src/main/java/net/minecraft/world/inventory/ContainerBeacon.java
@@ -13,6 +13,10 @@ import net.minecraft.world.entity.player.PlayerInventory;
import org.bukkit.craftbukkit.inventory.CraftInventoryView;
// CraftBukkit end
+// Paper start
+import io.papermc.paper.event.player.PlayerChangeBeaconEffectEvent;
+// Paper end
+
public class ContainerBeacon extends Container {
private final IInventory beacon;
@@ -139,9 +143,15 @@ public class ContainerBeacon extends Container {
public void c(int i, int j) {
if (this.d.hasItem()) {
- this.containerProperties.setProperty(1, i);
- this.containerProperties.setProperty(2, j);
+ // Paper start
+ PlayerChangeBeaconEffectEvent event = new PlayerChangeBeaconEffectEvent((org.bukkit.entity.Player) this.player.player.getBukkitEntity(), org.bukkit.potion.PotionEffectType.getById(i), org.bukkit.potion.PotionEffectType.getById(j), this.containerAccess.getLocation().getBlock());
+ if (event.callEvent()) {
+ this.containerProperties.setProperty(1, event.getPrimary() == null ? 0 : event.getPrimary().getId());
+ this.containerProperties.setProperty(2, event.getSecondary() == null ? 0 : event.getSecondary().getId());
+ if (!event.willConsumeItem()) return;
this.d.a(1);
+ }
+ // Paper end
}
}