-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMain.cs
40 lines (39 loc) · 1.35 KB
/
Main.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
using Rocket.Core.Plugins;
using SDG.Unturned;
using System.Collections;
using System.Collections.Generic;
using Logger = Rocket.Core.Logging.Logger;
using UnityEngine;
namespace educatalan02.RichAnnouncer
{
public class Main : RocketPlugin<Configuration>
{
private int index = 0;
protected override void Load()
{
Logger.Log("RichAnnouncer loaded correctly by educatalan02#1236");
Logger.LogWarning("[RichAnnouncer] Discord Support: discord.gg/Q89FmUk");
StartCoroutine((IEnumerator)Count());
}
protected override void Unload()
{
StopCoroutine((IEnumerator)Count());
Logger.Log("RichAnnouncer Unloaded");
}
private IEnumerator<WaitForSeconds> Count()
{
while (true)
{
PrintMessages();
yield return new WaitForSeconds((float)Configuration.Instance.IntervalSecs);
}
}
private void PrintMessages()
{
if (index >= Configuration.Instance.Messages.Count) { index = 0; }
Message message = Configuration.Instance.Messages[index];
ChatManager.serverSendMessage(message.MessageText.Replace('{', '<').Replace('}', '>'), Color.white, null, null, EChatMode.GLOBAL, message.Img, true);
index++;
}
}
}