forked from Pryaxis/TSAPI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTerrariaPlugin.cs
More file actions
143 lines (128 loc) · 2.81 KB
/
TerrariaPlugin.cs
File metadata and controls
143 lines (128 loc) · 2.81 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
using System;
using Terraria;
namespace TerrariaApi.Server
{
public abstract class TerrariaPlugin : IDisposable
{
///<summary>
/// The plugin's name. This is used for display purposes and secondary ordering when loading.
/// See <see cref="Order"/> for more information.
///</summary>
public virtual string Name
{
get
{
return "None";
}
}
///<summary>
/// The plugin's version. This is used for display purposes.
///</summary>
public virtual Version Version
{
get
{
return new Version(1, 0);
}
}
///<summary>
/// The plugin's author. This is used for display purposes.
///</summary>
public virtual string Author
{
get
{
return "None";
}
}
///<summary>
/// The plugin's description. This is used for display purposes.
///</summary>
public virtual string Description
{
get
{
return "None";
}
}
///<summary>
/// Whether or not the plugin is enabled.
///</summary>
public virtual bool Enabled
{
get;
set;
}
///<summary>
/// The plugin's order. This represents load priority.
/// Plugins are sorted first based on order, then on name where conflicts occur.
/// A lower order represents a higher load priority - I.E., order 1 is loaded before order 5.
/// This value may be negative.
/// The default plugin constructor will set order to 1.
///</summary>
public int Order
{
get;
set;
}
///<summary>
/// Deprecated - this value is never used
///</summary>
public virtual string UpdateURL
{
get
{
return "";
}
}
///<summary>
/// Reference to Terraria's <see cref="Main"/> class containing server state.
///</summary>
protected Main Game
{
get;
private set;
}
///<summary>
/// Instantiates a new instance of the plugin with the given server state.
/// Sets <see cref="Order"/> to 1.
///</summary>
protected TerrariaPlugin(Main game)
{
this.Order = 1;
this.Game = game;
}
///<summary>
/// Deconstructor. Implements the Dispose pattern.
///</summary>
~TerrariaPlugin()
{
this.Dispose(false);
}
///<summary>
/// Implements the Dispose pattern. Disposes the plugin
///</summary>
public void Dispose()
{
this.Dispose(true);
GC.SuppressFinalize(this);
}
///<summary>
/// Implements the Dispose pattern. Release managed resources here.
///</summary>
protected virtual void Dispose(bool disposing)
{
}
///<summary>
/// Invoked after the plugin is constructed. Initialization logic should occur here.
///</summary>
public abstract void Initialize();
/// <summary>
/// Implements weak inter-plugin communication. Allows interaction with other plugins without referencing their types or namespaces.
/// </summary>
public virtual object Call(params object[] args)
{
return null;
}
}
}