-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAutoSaveMain.cs
65 lines (46 loc) · 2.07 KB
/
AutoSaveMain.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
using Rocket.Core.Logging;
using Rocket.Core.Plugins;
using Rocket.Unturned.Chat;
using SDG.Unturned;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using Rocket.API.Collections;
namespace educatalan02.AutoSaveKingModdingNetwork
{
public class AutoSaveMain : RocketPlugin<AutoSaveConfig>
{
public static AutoSaveMain Instance = null;
protected override void Load()
{
Instance = this;
Rocket.Core.Logging.Logger.Log("Plugin Loaded correctly. Made by educatalan02");
Rocket.Core.Logging.Logger.Log("If you have issues join to this discord: https://discord.gg/Q89FmUk");
Rocket.Core.Logging.Logger.Log("Plugin version: 2.5.0.1");
if (Configuration.Instance.SaveServerEnabled)
InvokeRepeating("SaveServer", Configuration.Instance.SaveServerInterval, Configuration.Instance.SaveServerInterval);
if (Configuration.Instance.SaveVehiclesEnabled)
InvokeRepeating("SaveVehicles", Configuration.Instance.SaveVehiclesInterval, Configuration.Instance.SaveVehiclesInterval);
}
protected override void Unload()
{
Rocket.Core.Logging.Logger.Log("Plugin unloaded");
CancelInvoke("SaveServer");
CancelInvoke("SaveVehicles");
}
public void SaveServer()
{
ChatManager.serverSendMessage(Configuration.Instance.SaveServerMsg.Replace('{', '<').Replace('}', '>'), Color.white, null, null, EChatMode.GLOBAL, Configuration.Instance.UrlServer, true);
Rocket.Core.Logging.Logger.Log("Server Saving...!");
SaveManager.save();
}
public void SaveVehicles()
{
ChatManager.serverSendMessage(Configuration.Instance.SaveVehiclesMsg.Replace('{', '<').Replace('}', '>'), Color.white, null, null, EChatMode.GLOBAL, Configuration.Instance.UrlVehicle, true);
Rocket.Core.Logging.Logger.Log("Vehicles Saving...!");
SaveManager.save();
}
}
}