public override void Initialize() { ConfigsFolder = ModuleFolder; ConfigFile = Path.Combine(ConfigsFolder, "Rust++.cfg"); Core.Init(); Core.config = new IniParser(ConfigFile); if (Core.config == null) { Logger.LogError("[RPP] Can't load config!"); return; } string chatname = Core.config.GetSetting("Settings", "chatname"); if (!string.IsNullOrEmpty(chatname)) { Core.Name = Core.config.GetSetting("Settings", "chatname"); } if (Core.config.ContainsSetting("Settings", "joinmsg")) { JoinMsg = Core.config.GetSetting("Settings", "joinmsg"); } if (Core.config.ContainsSetting("Settings", "leavemsg")) { LeaveMsg = Core.config.GetSetting("Settings", "leavemsg"); } if (Core.config.ContainsSetting("Settings", "startermsg")) { StarterMsg = Core.config.GetSetting("Settings", "startermg"); } if (Core.config.ContainsSetting("Settings", "startercdmsg")) { StarterCDMsg = Core.config.GetSetting("Settings", "startercdmsg"); } TimedEvents.startEvents(); AuthComponent.Init(); Fougerite.Hooks.OnDoorUse += DoorUse; Fougerite.Hooks.OnEntityHurt += EntityHurt; Fougerite.Hooks.OnPlayerConnected += PlayerConnect; Fougerite.Hooks.OnPlayerDisconnected += PlayerDisconnect; Fougerite.Hooks.OnPlayerHurt += PlayerHurt; Fougerite.Hooks.OnPlayerKilled += PlayerKilled; Fougerite.Hooks.OnServerShutdown += OnServerShutdown; Fougerite.Hooks.OnShowTalker += ShowTalker; Fougerite.Hooks.OnChatRaw += ChatReceived; Fougerite.Hooks.OnChat += Chat; Fougerite.Hooks.OnFallDamage += OnFallDamage; Fougerite.Hooks.OnServerSaved += OnServerSaved; Fougerite.Hooks.OnEntityDeployedWithPlacer += OnEntityDeployedWithPlacer; Server.GetServer().LookForRustPP(); RaidComponent.initComponent(); Components.LanguageComponent.LanguageComponent.InitComponent(); Components.EconomyComponent.EconomyComponent.InitComponent(); Components.AdminComponent.AdminComponent.InitComponent(); Components.FriendComponent.FriendComponent.InitComponent(); }
public PersonController() { _personDao = new PersonDao(); _authComponent = new AuthComponent(); }
void ChatReceived(ref ConsoleSystem.Arg arg) { Fougerite.Player pl = Fougerite.Server.Cache[arg.argUser.userID]; if (!Core.userLang.ContainsKey(pl.UID)) { if (arg.Args[0] != "ES" && arg.Args[0] != "PT") { pl.SendClientMessage("[color red]<Error>[/color] Idioma Incorrecto, escriba ES o PT."); arg.ArgsStr = string.Empty; } pl.SendClientMessage(Components.LanguageComponent.LanguageComponent.getMessage("warning_lang", arg.Args[0])); Core.userLang[pl.UID] = arg.Args[0]; arg.ArgsStr = string.Empty; AuthComponent.aTimer.Stop(); AuthComponent.aTimer.Dispose(); AuthComponent.ShowLoginMessages(pl); //RustPP.Components.LanguageComponent.LanguageComponent.waitingLanguage.Remove(pl.UID); } string lang = Components.LanguageComponent.LanguageComponent.GetPlayerLangOrDefault(pl); var command = ChatCommand.GetCommand("ir") as TeleportToCommand; if (IsSpam(arg.ArgsStr)) { pl.SendClientMessage(Components.LanguageComponent.LanguageComponent.getMessage("spam_not_allowed", lang)); arg.ArgsStr = string.Empty; } if (command.GetTPWaitList().Contains(pl.UID)) { command.PartialNameTP(ref arg, arg.GetInt(0)); arg.ArgsStr = string.Empty; } else if (Core.shareWaitList.Contains(pl.UID)) { (ChatCommand.GetCommand("share") as ShareCommand).PartialNameDoorShare(ref arg, arg.GetInt(0)); Core.shareWaitList.Remove(pl.UID); arg.ArgsStr = string.Empty; } else if (Core.killWaitList.Contains(pl.UID)) { (ChatCommand.GetCommand("kill") as KillCommand).PartialNameKill(ref arg, arg.GetInt(0)); Core.killWaitList.Remove(pl.UID); arg.ArgsStr = string.Empty; } else if (Core.unfriendWaitList.Contains(pl.UID)) { (ChatCommand.GetCommand("unfriend") as UnfriendCommand).PartialNameUnfriend(ref arg, arg.GetInt(0)); Core.unfriendWaitList.Remove(pl.UID); arg.ArgsStr = string.Empty; } else if (Core.unshareWaitList.Contains(pl.UID)) { (ChatCommand.GetCommand("unshare") as UnshareCommand).PartialNameUnshareDoors(ref arg, arg.GetInt(0)); Core.unshareWaitList.Remove(pl.UID); arg.ArgsStr = string.Empty; } else if (Core.whiteWaitList.Contains(pl.UID)) { (ChatCommand.GetCommand("addwl") as WhiteListAddCommand).PartialNameWhitelist(ref arg, arg.GetInt(0)); Core.whiteWaitList.Remove(pl.UID); arg.ArgsStr = string.Empty; } else if (Core.adminAddWaitList.Contains(arg.argUser.userID)) { (ChatCommand.GetCommand("addadmin") as AddAdminCommand).PartialNameNewAdmin(ref arg, arg.GetInt(0)); Core.adminAddWaitList.Remove(arg.argUser.userID); arg.ArgsStr = string.Empty; } else if (Core.adminRemoveWaitList.Contains(pl.UID)) { (ChatCommand.GetCommand("unadmin") as RemoveAdminCommand).PartialNameRemoveAdmin(ref arg, arg.GetInt(0)); Core.adminRemoveWaitList.Remove(pl.UID); arg.ArgsStr = string.Empty; } else if (Core.adminFlagsWaitList.Contains(pl.UID)) { (ChatCommand.GetCommand("getflags") as GetFlagsCommand).PartialNameGetFlags(ref arg, arg.GetInt(0)); Core.adminFlagsWaitList.Remove(pl.UID); arg.ArgsStr = string.Empty; } else if (Core.muteWaitList.Contains(pl.UID)) { (ChatCommand.GetCommand("mutear") as MuteCommand).PartialNameMute(ref arg, arg.GetInt(0)); Core.muteWaitList.Remove(pl.UID); arg.ArgsStr = string.Empty; } else if (Core.adminFlagWaitList.Contains(pl.UID)) { (ChatCommand.GetCommand("addflag") as AddFlagCommand).PartialNameAddFlags(ref arg, arg.GetInt(0)); Core.adminFlagWaitList.Remove(pl.UID); arg.ArgsStr = string.Empty; } else if (Core.adminUnflagWaitList.Contains(pl.UID)) { (ChatCommand.GetCommand("unflag") as RemoveFlagsCommand).PartialNameRemoveFlags(ref arg, arg.GetInt(0)); Core.adminUnflagWaitList.Remove(pl.UID); arg.ArgsStr = string.Empty; } if (Core.IsEnabled()) { Core.handleCommand(ref arg); } }
public AdminController() { _authComponent = new AuthComponent(); _testComponent = new TestComponent(); }