Exemple #1
0
        public static void Kit(ISender sender, ArgumentList args)
        {
            Essentials Plugin = (Essentials)args.Plugin;

            Player player = args.GetOnlinePlayer(0);

            if (args.Count > 0)
            {
                if (KitManager.ContainsKit(args[0]))
                {
                    Kit kit = KitManager.GetKit(args[0]);
                    if (kit.ItemList != null && kit.ItemList.Count > 0)
                    {
                        foreach (KeyValuePair <Int32, Int32> ItemID in kit.ItemList)
                        {
                            Item.NewItem((int)player.Position.X, (int)player.Position.Y, player.Width, player.Height, ItemID.Key, ItemID.Value, false);
                        }

                        player.sendMessage("Recived the '" + kit.Name + "' Kit.");
                    }
                    else
                    {
                        player.sendMessage("Issue with null kit/list");
                    }
                }

                //Help ::: Shows what kits there are
                else if (args[0].Equals("help"))
                {
                    String Kits = "";
                    foreach (Kit kit in KitManager.KitList)
                    {
                        if (kit.Name.Trim().Length > 0)
                        {
                            Kits = Kits + ", " + kit.Name;
                        }
                    }
                    if (Kits.StartsWith(","))
                    {
                        Kits = Kits.Remove(0, 1).Trim();
                    }

                    if (Kits.Length > 0)
                    {
                        player.sendMessage("Available Kits: " + Kits);
                    }
                }

                //If kit does not exist
                else
                {
                    player.sendMessage("Error: specified kit " + args[0] + " does not exist. Please do /kit help");
                }
            }
            //Error message
            else
            {
                player.sendMessage("Error: You did not specify a kit! Do /kit help!");
            }
        }