-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathEvents.cs
More file actions
54 lines (46 loc) · 1.72 KB
/
Copy pathEvents.cs
File metadata and controls
54 lines (46 loc) · 1.72 KB
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
#if HSM
using HintServiceMeow.Core.Utilities;
using PlayerRoles;
#endif
using LabApi.Events.Arguments.PlayerEvents;
using LabApi.Events.CustomHandlers;
using LabApi.Features.Console;
using LabApi.Features.Wrappers;
using MEC;
using PlayerRoles;
using Respawning;
using Respawning.Waves;
using RueI.API;
using UserSettings.ServerSpecific;
namespace Timers
{
public class Events : CustomEventsHandler
{
public override void OnPlayerJoined(PlayerJoinedEventArgs ev) =>
ServerSpecificSettingsSync.SendToPlayer(ev.Player.ReferenceHub);
public override void OnPlayerChangedRole(PlayerChangedRoleEventArgs ev)
{
if (ev.NewRole.Team != Team.Dead)
{
RueDisplay.Get(ev.Player).Remove(HintManager.Tag);
return;
}
ev.Player.AddHint();
}
public override void OnServerRoundStarted() =>
Timing.RunCoroutine(HintManager.GenerateElements());
public static void OnSettingUpdated(ReferenceHub hub, ServerSpecificSettingBase setting)
{
if (setting is not SSTwoButtonsSetting buttons || buttons.SettingId != Plugin.Instance.Setting.SettingId)
return;
RueDisplay display = RueDisplay.Get(hub);
if (buttons.SyncIsB)
display.Remove(HintManager.Tag);
else if (hub.roleManager.CurrentRole.Team == Team.Dead && Round.IsRoundStarted)
{
display.Show(HintManager.Tag, HintManager.CurrentElement);
}
Logger.Debug($"Player settings updated, round is {(Round.IsRoundStarted ? "started" : "not started")}", Plugin.Instance.Config.Debug);
}
}
}