Solved Problem with giving a kit mothod

Discussion in 'Spigot Plugin Development' started by RoboBoy99, Feb 20, 2020.

  1. I changed my code to hold a class with the kit variables you know how it goes but when I'm giving myself the kit it's updating the icon of the kit and the items inside the kit

    The problem I have is in the giveKit method

    Code (Text):
    public class KitData
    {
        public static Map<String, KitClass> Kits = new HashMap<>();
        public static void createKit(Player player, String kitName)
        {
            if(Kits.containsKey(kitName)) {

                player.sendMessage(ChatColor.RED + "The Kit " + kitName + " is already exits");
            } else {
                @SuppressWarnings("deprecation")
                KitClass kc = new KitClass(kitName ,player.getItemInHand(), player.getInventory().getContents());
                Kits.put(kitName, kc);
            }
        }
        public static void giveKit(Player player, String kitName)
        {
            if(Kits.containsKey(kitName)) {
                KitClass kits = Kits.get(kitName);
                for(ItemStack m : kits.items()) {
                    if(m == null) continue;
                        player.getInventory().addItem(m);
                }
            }
            else {
                return;
            }
        }
    }
    }
     
  2. No errors at all? Also where is method? Show kitclass how exactly are you storing the items