Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ItemTag meta not being set #861

Merged
merged 1 commit into from
Apr 29, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import javax.annotation.Nullable;
import org.apache.commons.codec.DecoderException;
import org.apache.commons.codec.binary.Hex;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
Expand Down Expand Up @@ -53,8 +54,11 @@ public String get(ItemStack item) {

@Override
public void set(ItemStack item, String value) {
if (!item.hasItemMeta()) return;
ItemMeta itemMeta = item.getItemMeta();
if (!item.hasItemMeta()) {
// Create missing item meta if none is found
itemMeta = Bukkit.getItemFactory().getItemMeta(item.getType());
}
List<String> lore = itemMeta.getLore();

// If the item has no lore, ensure there is at least 1 line.
Expand Down