Esempio n. 1
0
        public void Execute(IRocketPlayer caller, string[] command)
        {
            UnturnedPlayer callr   = (UnturnedPlayer)caller;
            string         kitName = Plugin.CustomKitsPlugin.Instance.Configuration.Instance.DefaultKitName;

            if (Plugin.CustomKitsPlugin.Instance.Configuration.Instance.DefaultKitName == "preset_name")
            {
                foreach (Plugin.CustomKitsConfig.Preset Preset in Plugin.CustomKitsPlugin.Instance.Configuration.Instance.Presets)
                {
                    if (caller.HasPermission(Plugin.CustomKitsPlugin.PERMISSION + Preset.Name))
                    {
                        kitName = Preset.Name;
                    }
                }
            }

            if (command.Length == 1)
            {
                kitName = command[0];
            }

            if (!KitManager.HasSavedKits(callr, KitManager.Kits))
            {
                UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("no_saved_kits"), Color.red);
                return;
            }

            if (!KitManager.HasKit(callr, kitName, KitManager.Kits))
            {
                UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("no_kit_exists"), Color.red);
                return;
            }

            InventoryManager.Clear(callr, Plugin.CustomKitsPlugin.Instance.Configuration.Instance.IncludeClothingInKits);
            KitManager.LoadKit(callr, callr, kitName, Plugin.CustomKitsPlugin.Instance.Configuration.Instance.IncludeClothingInKits, KitManager.Kits);

            UnturnedChat.Say(caller, Plugin.CustomKitsPlugin.Instance.Translate("kit_loaded", kitName), Color.green);
        }