Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
shulng committed Aug 2, 2024
1 parent 105a453 commit 91f8826
Showing 1 changed file with 8 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package cc.baka9.catseedlogin.bukkit.object;

import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
Expand Down Expand Up @@ -182,19 +181,15 @@ public static void sendBlankInventoryPacket(Player player) {
ItemStack[] blankInventory = new ItemStack[inventorySize];
Arrays.fill(blankInventory, new ItemStack(Material.AIR));

try {
StructureModifier<ItemStack[]> itemArrayModifier = inventoryPacket.getItemArrayModifier();
if (itemArrayModifier.size() > 0) {
itemArrayModifier.write(0, blankInventory);
} else {
StructureModifier<List<ItemStack>> itemListModifier = inventoryPacket.getItemListModifier();
itemListModifier.write(0, Arrays.asList(blankInventory));
}

protocolManager.sendServerPacket(player, inventoryPacket, false);
} catch (InvocationTargetException e) {
e.printStackTrace();
StructureModifier<ItemStack[]> itemArrayModifier = inventoryPacket.getItemArrayModifier();
if (itemArrayModifier.size() > 0) {
itemArrayModifier.write(0, blankInventory);
} else {
StructureModifier<List<ItemStack>> itemListModifier = inventoryPacket.getItemListModifier();
itemListModifier.write(0, Arrays.asList(blankInventory));
}

protocolManager.sendServerPacket(player, inventoryPacket, false);
}

}

0 comments on commit 91f8826

Please sign in to comment.