mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-11 11:49:12 +00:00
Simplify copy operation
This commit is contained in:
parent
d39615d906
commit
73ad945101
1 changed files with 2 additions and 5 deletions
|
@ -6,6 +6,7 @@ import org.bukkit.inventory.Inventory;
|
|||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -43,11 +44,7 @@ public final class InventoryWorkaround {
|
|||
|
||||
private static Inventory makeTruncatedPlayerInventory(PlayerInventory playerInventory) {
|
||||
Inventory fakeInventory = Bukkit.getServer().createInventory(null, USABLE_PLAYER_INV_SIZE);
|
||||
|
||||
ItemStack[] truncatedContents = new ItemStack[fakeInventory.getSize()];
|
||||
System.arraycopy(playerInventory.getContents(), 0, truncatedContents, 0, truncatedContents.length);
|
||||
fakeInventory.setContents(truncatedContents);
|
||||
|
||||
fakeInventory.setContents(Arrays.copyOf(playerInventory.getContents(), fakeInventory.getSize()));
|
||||
return fakeInventory;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue