Paper/patches/server/0170-PlayerPickupExperienceEvent.patch

21 lines
1.2 KiB
Diff
Raw Normal View History

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-03-14 19:59:51 +01:00
index f9488311524bb8ff8a5686763973c9ae0053668d..28949deb54e89742541c1a14e8b69bb5b13848a9 100644
--- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
+++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
2022-12-07 19:52:24 +01:00
@@ -304,7 +304,7 @@ public class ExperienceOrb extends Entity {
@Override
public void playerTouch(Player player) {
if (!this.level.isClientSide) {
- 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
player.takeXpDelay = 2;
player.take(this, 1);
int i = this.repairPlayerItems(player, this.value);