What causes "Initializing Legacy Material Support."

Discussion in 'Plugin Development' started by MCMastery, Jan 27, 2020.

Thread Status:
Not open for further replies.
  1. Offline

    MCMastery

    I have not been using Bukkit in a while, so I am not up to date about a lot of things. What causes this warning? It causes a lot of server lag. Is there any way around it?

    > Initializing Legacy Material Support. Unless you have legacy plugins and/or data this is a bug!

    Here is my code:

    Code:
    private void init(Market market) {
            String title = market.getSector().getColor() + market.getSector().getName() + Messages.format(" &7Market Data");
            this.inventory = Bukkit.createInventory(null, 6 * SLOTS_PER_ROW, title);
            // sort alphabetically
            List<Material> items = new ArrayList<>(market.getItemValues().keySet());
            for (Material item : items) {
                ItemStack button = new ItemStack(item);
                ItemMeta im = button.getItemMeta();
                // im should never be null
                if (im != null) {
                    String itemName = item.name().toLowerCase().replace("_", " ");
                    // capitalize first letter
                    itemName = itemName.substring(0, 1).toUpperCase() + itemName.substring(1);
                    im.setDisplayName(Messages.format("&b" + itemName));
    
                    List<String> lore = new ArrayList<>();
                    lore.add(Messages.format("&7" + Bank.formatCurrency(market.getItemValue(item))));
                    im.setLore(lore);
                    button.setItemMeta(im);
                }
                this.inventory.addItem(button);
            }
        }
    The warning does not show if I just comment out the final addItem call.
     
  2. Online

    timtower Administrator Administrator Moderator

    @MCMastery What version are you running? What version are you building with?
     
  3. Offline

    Zombie_Striker

    Did you include the "api-version" tag to the plugin.yml? If not, you need to include that in order to use 1.13+ items.
     
  4. Offline

    MCMastery

    I did include "api-version: 1.15". But I forgot Spigot is not supported here so I'll go over there
     
  5. Online

    timtower Administrator Administrator Moderator

    We do support it these days
     
  6. Offline

    MCMastery

    Ah ok, thank you.
     
Thread Status:
Not open for further replies.

Share This Page