mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 11:06:29 +01:00
0976d52bbd
Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Please note that this build includes changes to meet upstreams requirements for nullability annotations. While we aim for a level of accuracy, these might not be 100% correct, if there are any issues, please speak to us on discord, or open an issue on the tracker to discuss. Bukkit Changes: 9a6a1de3 Remove nullability annotations from enum constructors 3f0591ea SPIGOT-2540: Add nullability annotations to entire Bukkit API CraftBukkit Changes:8d8475fc
SPIGOT-4666: Force parameter in HumanEntity#sleep8b1588e2
Fix ExplosionPrimeEvent#setFire not working with EnderCrystals39a287b7
Don't ignore newlines in PlayerListHeader/Footer Spigot Changes: cf694d87 Add nullability annotations
43 lines
2.0 KiB
Diff
43 lines
2.0 KiB
Diff
From 881a02abeb1dd87d2aa9ac12483907e236dbeab9 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Thu, 18 Jan 2018 01:00:27 -0500
|
|
Subject: [PATCH] Optimize Hoppers
|
|
|
|
Adds data about what Item related methods were used in InventoryMoveItem event
|
|
so that the server can improve the performance of this event.
|
|
|
|
diff --git a/src/main/java/org/bukkit/event/inventory/InventoryMoveItemEvent.java b/src/main/java/org/bukkit/event/inventory/InventoryMoveItemEvent.java
|
|
index 2bb57d23..f0a16d3c 100644
|
|
--- a/src/main/java/org/bukkit/event/inventory/InventoryMoveItemEvent.java
|
|
+++ b/src/main/java/org/bukkit/event/inventory/InventoryMoveItemEvent.java
|
|
@@ -31,6 +31,8 @@ public class InventoryMoveItemEvent extends Event implements Cancellable {
|
|
private final Inventory destinationInventory;
|
|
private ItemStack itemStack;
|
|
private final boolean didSourceInitiate;
|
|
+ public boolean calledGetItem; // Paper
|
|
+ public boolean calledSetItem; // Paper
|
|
|
|
public InventoryMoveItemEvent(@NotNull final Inventory sourceInventory, @NotNull final ItemStack itemStack, @NotNull final Inventory destinationInventory, final boolean didSourceInitiate) {
|
|
Validate.notNull(itemStack, "ItemStack cannot be null");
|
|
@@ -58,7 +60,8 @@ public class InventoryMoveItemEvent extends Event implements Cancellable {
|
|
*/
|
|
@NotNull
|
|
public ItemStack getItem() {
|
|
- return itemStack.clone();
|
|
+ calledGetItem = true; // Paper - record this method was used for auto detection of mode
|
|
+ return itemStack; // Paper - Removed clone, handled better in Server
|
|
}
|
|
|
|
/**
|
|
@@ -70,6 +73,7 @@ public class InventoryMoveItemEvent extends Event implements Cancellable {
|
|
*/
|
|
public void setItem(@NotNull ItemStack itemStack) {
|
|
Validate.notNull(itemStack, "ItemStack cannot be null. Cancel the event if you want nothing to be transferred.");
|
|
+ calledSetItem = true; // Paper - record this method was used for auto detection of mode
|
|
this.itemStack = itemStack.clone();
|
|
}
|
|
|
|
--
|
|
2.21.0
|
|
|