public void EnableProtection(IMySlimBlock slimBlock) { using (Log.BeginMethod(nameof(EnableProtection))) { if (slimBlock == null) { return; } Log.Debug($"Enable protection for: {slimBlock}"); var cubeGrid = slimBlock.CubeGrid; if (_protectedInfos.ContainsKey(cubeGrid.EntityId)) { _protectedInfos[cubeGrid.EntityId].EnableProtection(slimBlock); } else { var protectInfo = new ProtectInfo(cubeGrid); protectInfo.EnableProtection(slimBlock); _protectedInfos.Add(cubeGrid.EntityId, protectInfo); cubeGrid.OnClose += OnClose; } } }