using Oxide.Core; using Oxide.Core.Configuration; using UnityEngine; namespace Oxide.Plugins { [Info("AlwaysDay", "Jason", "1.0.0")] [Description("Makes Your Rust Server Always Day")] public class AlwaysDay : RustPlugin { private float NoonTime; private DynamicConfigFile config; private void Init() { // Initialize the configuration file with the name "AlwaysDay.json" config = Interface.GetMod().DataFileSystem.GetFile("AlwaysDay"); LoadConfig(); } private void OnServerInitialized() { // Set the initial time to the configured value SetTimeToNoon(); // Set up a repeating timer to ensure time is always the configured value timer.Repeat(30f, 0, SetTimeToNoon); } private void LoadConfig() { // Load the configuration values var configData = config.ReadObject(); NoonTime = configData.Time; // Check if the configData.Time is valid if (NoonTime <= 0 || NoonTime > 24) { Puts("Invalid time value in configuration. Using default time 12.0."); NoonTime = 12.0f; SaveConfig(); } else { Puts($"Configuration loaded. Setting time to {NoonTime}."); } } private void SaveConfig() { // Save the configuration config.WriteObject(new ConfigData { Time = NoonTime }); } private void SetTimeToNoon() { // Set the server time to the configured value ConVar.Env.time = NoonTime; } private class ConfigData { public float Time { get; set; } = 12.0f; } } }