Update B/CB/S
This commit is contained in:
parent
6e3ef06255
commit
aad194a32e
320 changed files with 790 additions and 882 deletions
42
Spigot-API-Patches/0083-Optimize-Hoppers.patch
Normal file
42
Spigot-API-Patches/0083-Optimize-Hoppers.patch
Normal file
|
@ -0,0 +1,42 @@
|
|||
From 6c67c5ba8e8ce89bfdd90a1d6264d14ba6a9037b 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 06ec99ae..b44cc45b 100644
|
||||
--- a/src/main/java/org/bukkit/event/inventory/InventoryMoveItemEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/inventory/InventoryMoveItemEvent.java
|
||||
@@ -30,6 +30,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(final Inventory sourceInventory, final ItemStack itemStack, final Inventory destinationInventory, final boolean didSourceInitiate) {
|
||||
Validate.notNull(itemStack, "ItemStack cannot be null");
|
||||
@@ -55,7 +57,8 @@ public class InventoryMoveItemEvent extends Event implements Cancellable {
|
||||
* @return ItemStack
|
||||
*/
|
||||
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
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -67,6 +70,7 @@ public class InventoryMoveItemEvent extends Event implements Cancellable {
|
||||
*/
|
||||
public void setItem(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.18.0
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue