Skip to content

Commit

Permalink
Spigot utils: saw a rare situation where a NPE happened when prison h…
Browse files Browse the repository at this point in the history
…ad custom blocks setup, but the plugin was removed.

This prevents a NPE if the backing 3rd plugin goes away.
  • Loading branch information
rbluer committed May 31, 2024
1 parent dea241f commit 48fb165
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
7 changes: 6 additions & 1 deletion docs/changelog_v3.3.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@
These change logs represent the work that has been going on within prison.


# 3.3.0-alpha.18a 2024-05-29
# 3.3.0-alpha.18a 2024-05-30


* **Spigot utils: saw a rare situation where a NPE happened when prison had custom blocks setup, but the plugin was removed.**
This prevents a NPE if the backing 3rd plugin goes away.



* **Mine reset notifications: Forgot to add support for 'server' notification mode.**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,14 @@ public static ItemStack getItemStack( XMaterial xMaterial, int amount ) {
public static SpigotItemStack getSpigotItemStackXMat( XMaterial xMaterial, int amount ) {
SpigotItemStack itemStack = null;

try {
itemStack = new SpigotItemStack( getItemStack( xMaterial, amount ) );
}
catch (PrisonItemStackNotSupportedRuntimeException e) {
// ignore
if ( xMaterial != null ) {

try {
itemStack = new SpigotItemStack( getItemStack( xMaterial, amount ) );
}
catch (PrisonItemStackNotSupportedRuntimeException e) {
// ignore
}
}

return itemStack;
Expand Down

0 comments on commit 48fb165

Please sign in to comment.