-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAllDay.cs
66 lines (54 loc) · 1.84 KB
/
AllDay.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
using System;
using Rocket.Unturned;
using Rocket.Core.Plugins;
using Rocket.Unturned.Chat;
using Rocket.Unturned.Player;
using Rocket.API.Collections;
using SDG.Unturned;
using UnityEngine;
using Logger = Rocket.Core.Logging.Logger;
namespace NEXIS.AllDay
{
public class AllDay : RocketPlugin<AllDayConfiguration>
{
#region Fields
public static AllDay Instance;
#endregion
#region Overrides
protected override void Load()
{
Instance = this;
U.Events.OnPlayerConnected += Events_OnPlayerConnected;
Logger.Log("AllDay plug-in loaded", ConsoleColor.Green);
}
protected override void Unload()
{
Logger.Log("AllDay plug-in unloaded", ConsoleColor.Green);
}
public override TranslationList DefaultTranslations
{
get
{
return new TranslationList() {
{"allday_reset_message", "Skipping night... Time has been reset to Day!"},
{"allday_player_connect", "This server uses the [AllDay] plugin to maintain Daytime all the time!"}
};
}
}
#endregion
#region Events
public void Events_OnPlayerConnected(UnturnedPlayer player)
{
UnturnedChat.Say(player, AllDay.Instance.Translations.Instance.Translate("allday_player_connect"), Color.yellow);
}
#endregion
public void FixedUpdate()
{
if (LightingManager.time >= AllDay.Instance.Configuration.Instance.CycleResetTime)
{
UnturnedChat.Say(AllDay.Instance.Translations.Instance.Translate("allday_reset_message"), Color.green);
LightingManager.time = AllDay.Instance.Configuration.Instance.CycleStartTime;
}
}
}
}