mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
PlayerPickupExperienceEvent
Allows plugins to cancel a player picking up an experience orb
This commit is contained in:
parent
ed76af5637
commit
533b86c3fc
1 changed files with 2 additions and 1 deletions
|
@ -177,8 +177,9 @@
|
|||
@Override
|
||||
public void playerTouch(Player player) {
|
||||
if (player instanceof ServerPlayer entityplayer) {
|
||||
if (player.takeXpDelay == 0) {
|
||||
- if (player.takeXpDelay == 0) {
|
||||
- player.takeXpDelay = 2;
|
||||
+ if (player.takeXpDelay == 0 && new com.destroystokyo.paper.event.player.PlayerPickupExperienceEvent(entityplayer.getBukkitEntity(), (org.bukkit.entity.ExperienceOrb) this.getBukkitEntity()).callEvent()) { // Paper - PlayerPickupExperienceEvent
|
||||
+ player.takeXpDelay = CraftEventFactory.callPlayerXpCooldownEvent(player, 2, PlayerExpCooldownChangeEvent.ChangeReason.PICKUP_ORB).getNewCooldown(); // CraftBukkit - entityhuman.takeXpDelay = 2;
|
||||
player.take(this, 1);
|
||||
int i = this.repairPlayerItems(entityplayer, this.value);
|
||||
|
|
Loading…
Reference in a new issue