Paper/Spigot-Server-Patches/0210-PlayerPickupItemEvent-setFlyAtPlayer.patch
Zach Brown 6f2009754d
Stop explicitly blocking Vanilla Method Profiler
At the time this was re-added, there was concern around how the JIT
would handle the system property that enabled it.

This shouldn't be a problem, and as such we no longer need to block
access to it.

The Vanilla Method Profiler will not provide much to most users however
there is no harm in providing it as an option. For most users, the
recommended and supported method for determining performance issues with
Paper will continue to be Timings.
2018-03-31 14:55:42 -04:00

49 lines
2.3 KiB
Diff

From 32dbe9a6e036ce0b9481cd58393dd0f533835ac4 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Sun, 7 May 2017 06:26:09 -0500
Subject: [PATCH] PlayerPickupItemEvent#setFlyAtPlayer
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
index 99dbb139..ae4910b4 100644
--- a/src/main/java/net/minecraft/server/EntityItem.java
+++ b/src/main/java/net/minecraft/server/EntityItem.java
@@ -332,6 +332,7 @@ public class EntityItem extends Entity implements HopperPusher {
// CraftBukkit start - fire PlayerPickupItemEvent
int canHold = entityhuman.inventory.canHold(itemstack);
int remaining = i - canHold;
+ boolean flyAtPlayer = false; // Paper
if (this.pickupDelay <= 0 && canHold > 0) {
itemstack.setCount(canHold);
@@ -339,7 +340,13 @@ public class EntityItem extends Entity implements HopperPusher {
PlayerPickupItemEvent playerEvent = new PlayerPickupItemEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining);
playerEvent.setCancelled(!entityhuman.canPickUpLoot);
this.world.getServer().getPluginManager().callEvent(playerEvent);
+ flyAtPlayer = playerEvent.getFlyAtPlayer(); // Paper
if (playerEvent.isCancelled()) {
+ // Paper Start
+ if (flyAtPlayer) {
+ entityhuman.receive(this, i);
+ }
+ // Paper End
return;
}
@@ -359,7 +366,11 @@ public class EntityItem extends Entity implements HopperPusher {
// CraftBukkit end
if (this.pickupDelay == 0 && (this.h == null || 6000 - this.age <= 200 || this.h.equals(entityhuman.getName())) && entityhuman.inventory.pickup(itemstack)) {
- entityhuman.receive(this, i);
+ // Paper Start
+ if (flyAtPlayer) {
+ entityhuman.receive(this, i);
+ }
+ // Paper End
if (itemstack.isEmpty()) {
this.die();
itemstack.setCount(i);
--
2.14.3