-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlugin.cs
58 lines (52 loc) · 1.91 KB
/
Plugin.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
using Rocket.API;
using Rocket.API.Collections;
using Rocket.Core;
using Rocket.Core.Plugins;
using Rocket.Unturned;
using Rocket.Unturned.Events;
using Rocket.Unturned.Player;
using SDG.Unturned;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TR.自定义指令
{
public class Plugin : RocketPlugin<Configuration>
{
public static Plugin Instance;
bool 加载 = false;
protected override void Load()
{
Instance = this;
Rocket.Core.Logging.Logger.Log("Welcome to use TR.CustomCommand!——By TR.Plugin");
Rocket.Core.Logging.Logger.Log("———————————");
Rocket.Core.Logging.Logger.Log("————Author—————");
Rocket.Core.Logging.Logger.Log("————长风—————");
Rocket.Core.Logging.Logger.Log("——TCD.ROCKETMOD———");
Rocket.Core.Logging.Logger.Log("Verson 1.1.0 Load Succused!");
U.Events.OnPlayerConnected += 玩家进服;
}
private void 玩家进服(UnturnedPlayer player)
{
if(加载==false)
{
加载 = true;
foreach (Command 指令 in Configuration.Instance.CustomCommand)
{
IRocketCommand command = R.Commands.GetCommand(指令.OldCommand);
if (command != null&&指令.OldCommand!=null)
{
R.Commands.Register(command, 指令.NewCommand);
}
}
Rocket.Core.Logging.Logger.Log("All CustomCommand Load!");
}
}
protected override void Unload()
{
U.Events.OnPlayerConnected -= 玩家进服;
}
}
}