Correctly show voucher item names in editor main menu

This commit is contained in:
xsmeths 2024-04-15 00:06:09 +01:00
parent 5c29ac1850
commit ea3445280e

View File

@ -8,9 +8,11 @@ import com.craftaro.epicvouchers.libraries.ItemBuilder;
import com.craftaro.epicvouchers.libraries.inventory.IconInv; import com.craftaro.epicvouchers.libraries.inventory.IconInv;
import com.craftaro.epicvouchers.libraries.inventory.icons.Icon; import com.craftaro.epicvouchers.libraries.inventory.icons.Icon;
import com.craftaro.epicvouchers.voucher.Voucher; import com.craftaro.epicvouchers.voucher.Voucher;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import static org.bukkit.Material.PAPER; import static org.bukkit.Material.PAPER;
@ -25,7 +27,12 @@ public class VoucherMenu extends IconInv {
for (Voucher voucher : instance.getVoucherManager().getVouchers()) { for (Voucher voucher : instance.getVoucherManager().getVouchers()) {
if (getInventory().firstEmpty() != -1) { if (getInventory().firstEmpty() != -1) {
addIcon(getInventory().firstEmpty(), voucher.toItemStack(), event -> new OptionMenu(instance, voucher).open(event.getPlayer())); ItemStack voucherr = voucher.toItemStack();
ItemMeta vouchermeta = voucherr.getItemMeta();
vouchermeta.setDisplayName(voucher.getName());
Bukkit.broadcastMessage(voucher.getName());
voucherr.setItemMeta(vouchermeta);
addIcon(getInventory().firstEmpty(), voucherr, event -> new OptionMenu(instance, voucher).open(event.getPlayer()));
} }
} }