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
2023-06-08 07:03:07 +02:00
index af2c8db71b9306da9cae9fa0e56dd7716811cbac..ea2e30e405426ed0d3b6b912512f5c4332d91b1d 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
2023-06-07 21:37:42 +02:00
@@ -310,7 +310,7 @@ public class ExperienceOrb extends Entity {
2021-06-12 17:06:20 +02:00
@Override
public void playerTouch(Player player) {
2023-06-07 21:37:42 +02:00
if (!this.level().isClientSide) {
2021-06-12 17:06:20 +02:00
- if (player.takeXpDelay == 0) {
+ if (player.takeXpDelay == 0 && new com.destroystokyo.paper.event.player.PlayerPickupExperienceEvent(((net.minecraft.server.level.ServerPlayer) player).getBukkitEntity(), (org.bukkit.entity.ExperienceOrb) this.getBukkitEntity()).callEvent()) { // Paper
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);
int i = this.repairPlayerItems(player, this.value);