Skip to content

Commit

Permalink
Avoid null itemmetas in GUI
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Feb 4, 2021
1 parent ef25c16 commit 8fe73be
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/main/java/net/citizensnpcs/api/gui/InventoryMenuSlot.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,17 @@ void initialise(MenuSlot data) {
}
if (defaultItem != null) {
ItemMeta meta = defaultItem.getItemMeta();
meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
if (!data.lore().equals("EMPTY")) {
meta.setLore(Arrays.asList(Colorizer.parseColors(Messaging.tryTranslate(data.lore())).split("\\n|\n")));
if (meta != null) {
meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
if (!data.lore().equals("EMPTY")) {
meta.setLore(
Arrays.asList(Colorizer.parseColors(Messaging.tryTranslate(data.lore())).split("\\n|\n")));
}
if (!data.title().equals("EMPTY")) {
meta.setDisplayName(Colorizer.parseColors(Messaging.tryTranslate(data.title())));
}
defaultItem.setItemMeta(meta);
}
if (!data.title().equals("EMPTY")) {
meta.setDisplayName(Colorizer.parseColors(Messaging.tryTranslate(data.title())));
}
defaultItem.setItemMeta(meta);
}
inventory.setItem(index, defaultItem);
setFilter(Arrays.asList(data.filter()));
Expand Down

0 comments on commit 8fe73be

Please sign in to comment.