private bool CheckConformation(ICooldownKey cooldownKey, long playerId, string gridName, IMyCharacter character, long ID = 0) { var cooldownManager = Plugin.ConfirmationCooldownManager; if (!cooldownManager.CheckCooldown(cooldownKey, gridName, out _)) { cooldownManager.StopCooldown(cooldownKey); return(true); } List <MyCubeGrid> GridGroups; CheckResult SearchResult; if (character == null && ID != 0) { GridGroups = ShipFixerCore.FindGridGroupsForPlayer(gridName, playerId, out SearchResult, ID); } else { if (character == null) { GridGroups = ShipFixerCore.FindGridGroupsForPlayer(gridName, playerId, out SearchResult); } else { GridGroups = ShipFixerCore.FindLookAtGridGroup(character, playerId, out SearchResult); } } if (GridGroups == null || GridGroups.Count == 0 || SearchResult != CheckResult.OK) { WriteResponse(SearchResult); return(false); } var EjectPlayers = false; CheckResult result = ShipFixerCore.CheckGroups(GridGroups, out _, playerId, EjectPlayers); if (result != CheckResult.OK) { WriteResponse(result); return(false); } cooldownManager.StartCooldown(cooldownKey, gridName, Plugin.CooldownConfirmation); Context.Respond("Are you sure you want to continue? Enter the command again within " + Plugin.CooldownConfirmationSeconds + " seconds to confirm fixship on " + GridGroups[0].DisplayName + "."); return(false); }
/// <inheritdoc /> public override void Init(ITorchBase torch) { base.Init(torch); Instance = this; var configFile = Path.Combine(StoragePath, "ShipFixer.cfg"); try { _config = Persistent <ShipFixerConfig> .Load(configFile); } catch (Exception e) { Log.Warn(e); } if (_config?.Data == null) { Log.Info("Create Default Config, because none was found!"); _config = new Persistent <ShipFixerConfig>(configFile, new ShipFixerConfig()); Save(); } ShipFixerCore.Init(); }
public static void Init() { Instance = new ShipFixerCore(); }