Skip to content

Commit

Permalink
エラー回避
Browse files Browse the repository at this point in the history
  • Loading branch information
meyason committed Nov 4, 2024
1 parent bdcb35c commit 8b27b9e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,13 @@ public int[] scanHotbar(Player player){

for (int i = 0; i < 9; i++) {
ItemStack item = player.getInventory().getItem(i);
if (item == null || !item.hasItemMeta()) {
if(item == null){
continue;
}
if(item.getType().isAir()){
continue;
}
if (!item.hasItemMeta()) {
continue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ public void onPlayerInteract(PlayerInteractEvent event) {
return;
}
ItemStack itemInHand = player.getInventory().getItemInMainHand();
ItemMeta meta = itemInHand.getItemMeta();
if (!itemInHand.hasItemMeta()) {
return;
}
ItemMeta meta = itemInHand.getItemMeta();
PersistentDataContainer container = meta.getPersistentDataContainer();

NamespacedKey itemKey = new NamespacedKey(UniverseCoreV2.getInstance(), UniverseItemKeyString.ITEM_NAME);
Expand Down

0 comments on commit 8b27b9e

Please sign in to comment.