check if slot has custom name and nbt data

This commit is contained in:
bixilon 2020-06-08 14:15:29 +02:00
parent 44bcaf43ee
commit 9e23b13a31
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4

View File

@ -45,7 +45,7 @@ public class Slot {
}
public String getDisplayName() {
if (nbt.containsKey("display") && nbt.getCompoundTag("display").containsKey("Name")) {
if (nbt != null && nbt.containsKey("display") && nbt.getCompoundTag("display").containsKey("Name")) { // check if object has nbt data, and a custom display name
return new ChatComponent(nbt.getCompoundTag("display").getStringTag("Name").getValue()).getColoredMessage();
}
return "<ToDo>"; //ToDo display name per Item