Paper/patches/server/0487-Item-no-age-no-player-pickup.patch
Jake Potrebic a73ed9572e
Updated Upstream (CraftBukkit/Spigot) (#9598)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

CraftBukkit Changes:
b76ceb4f5 PR-1235: Move EntityType return to base Entity class
e795d7490 SPIGOT-7458: Exception when Entity CommandSender executes Vanilla command
46c7fc3b1 SPIGOT-7452: Player#openSign cannot edit
d91e5aa0b SPIGOT-7447: Rewrite --forceUpgrade to minimise diff and properly handle CraftBukkit world layout
921ae06d6 Revert "SPIGOT-7447: Fix --forceUpgrade"

Spigot Changes:
94e187b5 Rebuild patches
3bce7935 SPIGOT-7091: Update bungeecord-chat
2023-08-13 16:32:51 -07:00

51 lines
1.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Alfie Smith <alfie@alfiesmith.net>
Date: Sat, 7 Nov 2020 01:20:33 +0000
Subject: [PATCH] Item no age & no player pickup
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
index 66e69cb13e2d82acc0a2398625766a49bc701a09..ff6868ab31cec208045353c842f20ca31191bc0a 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java
@@ -9,6 +9,12 @@ import org.bukkit.entity.Item;
import org.bukkit.inventory.ItemStack;
public class CraftItem extends CraftEntity implements Item {
+
+ // Paper start
+ private final static int NO_AGE_TIME = (int) Short.MIN_VALUE;
+ private final static int NO_PICKUP_TIME = (int) Short.MAX_VALUE;
+ // Paper end
+
private final ItemEntity item;
public CraftItem(CraftServer server, Entity entity, ItemEntity item) {
@@ -75,6 +81,26 @@ public class CraftItem extends CraftEntity implements Item {
public void setCanMobPickup(boolean canMobPickup) {
item.canMobPickup = canMobPickup;
}
+
+ @Override
+ public boolean canPlayerPickup() {
+ return item.pickupDelay != NO_PICKUP_TIME;
+ }
+
+ @Override
+ public void setCanPlayerPickup(boolean canPlayerPickup) {
+ item.pickupDelay = canPlayerPickup ? 0 : NO_PICKUP_TIME;
+ }
+
+ @Override
+ public boolean willAge() {
+ return item.age != NO_AGE_TIME;
+ }
+
+ @Override
+ public void setWillAge(boolean willAge) {
+ item.age = willAge ? 0 : NO_AGE_TIME;
+ }
// Paper End
@Override