aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/notenoughupdates/repo/ItemCache.kt
diff options
context:
space:
mode:
authornea <nea@nea.moe>2023-05-04 15:34:02 +0200
committernea <nea@nea.moe>2023-05-04 15:34:02 +0200
commitbcd86e28228d2ee35a2009d4f7e2fea55ea3c02f (patch)
tree0a6e2e8551900b5f5b3f0e178e58873a8c68a146 /src/main/kotlin/moe/nea/notenoughupdates/repo/ItemCache.kt
parent857427b0766fe68590589c22e86dbcf1196b4ed5 (diff)
downloadfirmament-bcd86e28228d2ee35a2009d4f7e2fea55ea3c02f.tar.gz
firmament-bcd86e28228d2ee35a2009d4f7e2fea55ea3c02f.tar.bz2
firmament-bcd86e28228d2ee35a2009d4f7e2fea55ea3c02f.zip
Display broken favourites
Diffstat (limited to 'src/main/kotlin/moe/nea/notenoughupdates/repo/ItemCache.kt')
-rw-r--r--src/main/kotlin/moe/nea/notenoughupdates/repo/ItemCache.kt9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/main/kotlin/moe/nea/notenoughupdates/repo/ItemCache.kt b/src/main/kotlin/moe/nea/notenoughupdates/repo/ItemCache.kt
index 5f9159e..cf2fc21 100644
--- a/src/main/kotlin/moe/nea/notenoughupdates/repo/ItemCache.kt
+++ b/src/main/kotlin/moe/nea/notenoughupdates/repo/ItemCache.kt
@@ -56,10 +56,10 @@ object ItemCache : IReloadable {
null
}
- private fun brokenItemStack(neuItem: NEUItem): ItemStack {
+ fun brokenItemStack(neuItem: NEUItem?): ItemStack {
return ItemStack(Items.PAINTING).apply {
- setCustomName(Text.literal(neuItem.displayName))
- appendLore(listOf(Text.translatable("notenoughupdates.repo.brokenitem", neuItem.skyblockItemId)))
+ setCustomName(Text.literal(neuItem?.displayName ?: "null"))
+ appendLore(listOf(Text.translatable("notenoughupdates.repo.brokenitem", neuItem?.skyblockItemId)))
}
}
@@ -79,7 +79,8 @@ object ItemCache : IReloadable {
}
}
- fun NEUItem.asItemStack(): ItemStack {
+ fun NEUItem?.asItemStack(): ItemStack {
+ if (this == null) return brokenItemStack(null)
var s = cache[this.skyblockItemId]
if (s == null) {
s = asItemStackNow()