-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathClass1.cs
More file actions
54 lines (43 loc) · 1.45 KB
/
Copy pathClass1.cs
File metadata and controls
54 lines (43 loc) · 1.45 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
using System;
using System.Collections.Generic;
using TShockAPI;
namespace MyTShockPlugin
{
[APIVersion(1, 25)]
public class MyPlugin : TerrariaPlugin
{
public override string Author => "YourName";
public override string Description => "My First TShock Plugin";
public override string Name => "MyPlugin";
public override Version Version => new Version(1, 0, 0, 0);
public MyPlugin(Main game) : base(game)
{
Order = 1;
}
public override void Initialize()
{
Commands.ChatCommands.Add(new Command(
permissions: new List<string> { "myplugin.use" },
cmd: MyCommand,
"mycommand", "mc"
));
TShockAPI.GetDataHandlers.PlayerUpdate += OnPlayerUpdate;
TShockAPI.TSPlayer.All.SendSuccessMessage($"[{Name}] Plugin loaded!");
}
protected override void Dispose(bool disposing)
{
if (disposing)
{
TShockAPI.GetDataHandlers.PlayerUpdate -= OnPlayerUpdate;
}
base.Dispose(disposing);
}
private void MyCommand(CommandArgs args)
{
args.Player.SendSuccessMessage("Hello from my plugin command!");
}
private void OnPlayerUpdate(object sender, TShockAPI.GetDataHandlers.PlayerUpdateEventArgs args)
{
}
}
}