2021-06-12 17:06:20 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 19 Dec 2017 22:02:53 -0500
Subject: [PATCH] PlayerPickupExperienceEvent
Allows plugins to cancel a player picking up an experience orb
diff --git a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
2024-12-03 19:05:31 +01:00
index 5999a77c803ee6f2a0dd05dea5f5817366bc70ea..5a017ec91d2e0df8467fde4f38ef00571f15bd01 100644
2021-06-12 17:06:20 +02:00
--- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
+++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
2024-12-03 19:05:31 +01:00
@@ -328,7 +328,7 @@ public class ExperienceOrb extends Entity {
2021-06-12 17:06:20 +02:00
@Override
public void playerTouch(Player player) {
2024-06-13 20:09:28 +02:00
if (player instanceof ServerPlayer entityplayer) {
2021-06-12 17:06:20 +02:00
- if (player.takeXpDelay == 0) {
2024-06-13 20:09:28 +02:00
+ if (player.takeXpDelay == 0 && new com.destroystokyo.paper.event.player.PlayerPickupExperienceEvent(entityplayer.getBukkitEntity(), (org.bukkit.entity.ExperienceOrb) this.getBukkitEntity()).callEvent()) { // Paper - PlayerPickupExperienceEvent
2023-05-12 13:10:08 +02:00
player.takeXpDelay = CraftEventFactory.callPlayerXpCooldownEvent(player, 2, PlayerExpCooldownChangeEvent.ChangeReason.PICKUP_ORB).getNewCooldown(); // CraftBukkit - entityhuman.takeXpDelay = 2;
2021-06-12 17:06:20 +02:00
player.take(this, 1);
2024-06-13 20:09:28 +02:00
int i = this.repairPlayerItems(entityplayer, this.value);