Skip to content

Commit

Permalink
Fix NPE error if the item has no tag compound in nbt
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreeam-qwq committed Jan 9, 2024
1 parent 43262a5 commit 5099e96
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
10 changes: 9 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
push:
branches:
- master
- dev

jobs:
build:
Expand Down Expand Up @@ -33,11 +34,18 @@ jobs:
prerelease: false

- name: Upload DeathMessages DevBuild
#if: github.ref_name == 'nextgen'
if: github.ref_name == 'master'
uses: marvinpinto/action-automatic-releases@master
with:
title: "DeathMessages v1.4.18-SNAPSHOT"
automatic_release_tag: "dev-build"
repo_token: "${{ secrets.GITHUB_TOKEN }}"
files: "Core/build/libs/DeathMessages-*.jar"
prerelease: true

- name: Upload DeathMessages Nightly
if: github.ref_name == 'dev'
uses: actions/upload-artifact@main
with:
name: DeathMessages-Nightly
path: Core/build/libs/DeathMessages-*.jar
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,12 @@ private static void buildHover(Player player, String msg, TextComponent.Builder

showItem = HoverEvent.showItem(Key.key(i.getType().name().toLowerCase()), i.getAmount(), BinaryTagHolder.binaryTagHolder(NBT.itemStackToNBT(tempItem).getCompound("tag").toString()));
} else {
showItem = HoverEvent.showItem(Key.key(i.getType().name().toLowerCase()), i.getAmount(), BinaryTagHolder.binaryTagHolder(NBT.itemStackToNBT(i).getCompound("tag").toString()));
try {
showItem = HoverEvent.showItem(Key.key(i.getType().name().toLowerCase()), i.getAmount(), BinaryTagHolder.binaryTagHolder(NBT.itemStackToNBT(i).getCompound("tag").toString()));
} catch (NullPointerException e) {
// Item has no `tag` compound in nbt
showItem = HoverEvent.showItem(Key.key(i.getType().name().toLowerCase()), i.getAmount());
}
}

Component weapon = Component.text()
Expand Down

0 comments on commit 5099e96

Please sign in to comment.