public static void HouseReload(CommandArgs args) { HConfigFile.ForceLoad(); var reader = TShock.DB.QueryReader("Select * from HousingDistrict"); TShock.Log.Info("House Config Reloaded"); args.Player.SendMessage("House Config Reloaded", Color.Lime); HousingDistricts.Houses = new List <House>(); while (reader.Read()) { if (reader.Get <string>("WorldID") != Main.worldID.ToString()) { continue; } int id = reader.Get <int>("ID"); List <string> owners = reader.Get <string>("Owners").Split(',').ToList(); int locked = reader.Get <int>("Locked"); int chatenabled = reader.Get <int>("ChatEnabled") == 1 ? 1 : 0; List <string> visitors = reader.Get <string>("Visitors").Split(',').ToList(); HousingDistricts.Houses.Add(new House(new Rectangle(reader.Get <int>("TopX"), reader.Get <int>("TopY"), reader.Get <int>("BottomX"), reader.Get <int>("BottomY")), owners, id, reader.Get <string>("Name"), locked, chatenabled, visitors)); } TShock.Log.Info("Houses Reloaded"); args.Player.SendMessage("Houses Reloaded", Color.Lime); }
public override void Initialize() { HConfigFile.ForceLoad(); ServerApi.Hooks.GameInitialize.Register(this, OnInitialize, -5); ServerApi.Hooks.ServerChat.Register(this, OnChat, 5); ServerApi.Hooks.NetGreetPlayer.Register(this, OnGreetPlayer, -5); ServerApi.Hooks.ServerLeave.Register(this, OnLeave, 5); ServerApi.Hooks.NetGetData.Register(this, GetData, 10); ServerApi.Hooks.GamePostInitialize.Register(this, PostInitialize, -5); GetDataHandlers.InitGetDataHandler(); if (!HConfig.DisableUpdateTimer) { Update.Elapsed += OnUpdate; Update.Start(); URunning = true; } }