mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-29 19:52:55 +01:00
a207d14a0e
Signed-off-by: Mariell Hoversholm <proximyst@proximyst.com>
28 lines
1.7 KiB
Diff
28 lines
1.7 KiB
Diff
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
|
|
index 3ddb0a9f15c920c9a2080f76edfda0504c1e287a..885c5a920204a31b24c7d360390eaf4177c30698 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/ExperienceOrb.java
|
|
@@ -5,6 +5,7 @@ import net.minecraft.core.BlockPos;
|
|
import net.minecraft.nbt.CompoundTag;
|
|
import net.minecraft.network.protocol.Packet;
|
|
import net.minecraft.network.protocol.game.ClientboundAddExperienceOrbPacket;
|
|
+import net.minecraft.server.level.ServerPlayer;
|
|
import net.minecraft.sounds.SoundEvents;
|
|
import net.minecraft.tags.FluidTags;
|
|
import net.minecraft.tags.Tag;
|
|
@@ -231,7 +232,7 @@ public class ExperienceOrb extends Entity {
|
|
@Override
|
|
public void playerTouch(Player player) {
|
|
if (!this.level.isClientSide) {
|
|
- if (this.throwTime == 0 && player.takeXpDelay == 0) {
|
|
+ if (this.throwTime == 0 && player.takeXpDelay == 0 && new com.destroystokyo.paper.event.player.PlayerPickupExperienceEvent(((ServerPlayer) player).getBukkitEntity(), (org.bukkit.entity.ExperienceOrb) this.getBukkitEntity()).callEvent()) { // Paper
|
|
player.takeXpDelay = 2;
|
|
player.take(this, 1);
|
|
Entry<EquipmentSlot, ItemStack> entry = EnchantmentHelper.getRandomItemWith(Enchantments.MENDING, (LivingEntity) player, ItemStack::isDamaged);
|