How do I get this to work?

Discussion in 'Plugin Development' started by NoahBerg, Sep 28, 2021.

  1. Offline

    NoahBerg

    I'm pretty new to bukkit and wanted to create a simple compass tracker as practice. I saw that there was a setCompass function, but I have no idea how to implement it into the actual item I created. Help would be greatly appreciated! This is all in bukkit 1.17 btw

    Code:

    Code:
    package me.luke.Glacies.Items;
    
    import java.util.ArrayList;
    import java.util.List;
    
    import org.bukkit.Material;
    import org.bukkit.enchantments.Enchantment;
    import org.bukkit.inventory.ItemFlag;
    import org.bukkit.inventory.ItemStack;
    import org.bukkit.inventory.meta.ItemMeta;
    
    public class GlaciesItems {
       
        public static ItemStack Compass;
       
        public static void init() {
            createCompass();
           
        }
       
        public static void createCompass() {
           
            ItemStack item = new ItemStack(Material.COMPASS, 1);
           
            ItemMeta meta = item.getItemMeta();
           
            List<String> lore = new ArrayList<>();
           
            meta.setDisplayName("Tracker");
           
           
            meta.addEnchant(Enchantment.VANISHING_CURSE, 1, false);
            meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);   
           
            item.setItemMeta(meta);
            meta.setLore(lore);
           
            Compass = item;
           
           
           
        }
           
           
    }
     
  2. Online

    davidclue

Share This Page