/*
         * DoRespawn
         *
         * Respawn Bradley
         */
        bool DoRespawn(IPlayer player)
        {
            BradleySpawner singleton = BradleySpawner.singleton;

            if (singleton == null)
            {
                Puts("No Bradley spawner found!");
                return(false);
            }

            if (!Bradley.enabled)
            {
                Puts("Bradley has been disabled! Enable it if you want this plugin to work.");
                return(false);
            }

            if ((bool)singleton.spawned)
            {
                singleton.spawned.Kill(BaseNetworkable.DestroyMode.None);
            }

            singleton.spawned = null;
            singleton.DoRespawn();

            if (this.config_data.Options.LockBradleyOnRespawn && !player.HasPermission("respawnbradley.nolock"))
            {
                if (LootDefender != null)
                {
                    // Telling LootDefender Bradley took max amount of damage, this should hopefully always lock it whatever Damage Lock Threshold has been configured to
                    HitInfo hit_info = new HitInfo(player.Object as BaseEntity, singleton.spawned as BaseEntity, DamageType.Generic, singleton.spawned.MaxHealth(), new Vector3());
                    LootDefender.Call("OnEntityTakeDamage", singleton.spawned, hit_info);
                }
                else
                {
                    Puts("Unable to lock Bradley without LootDefender plugin!");
                }
            }

            return(true);
        }
        private void Init()
        {
            Instance = this;
            AddCovalenceCommand("testlootdef", nameof(CommandTest), permAdm);
            permission.RegisterPermission(permUse, this);

            try
            {
                config = Config.ReadObject <PluginConfig>();
            }
            catch { }

            if (config == null)
            {
                config = new PluginConfig();
            }

            Config.WriteObject(config, true);
            LoadData();

            storedData.Sanitize();
        }
 private void Unload()
 {
     SaveData();
     Instance = null;
 }