+ Extending Pages
parent
a8aa5ccdd8
commit
17dea2a42e
50
Plugins.md
50
Plugins.md
@ -59,3 +59,53 @@ The following options can be configured by modifying `ActionOnReport.js`
|
|||||||
#### Shared GUID Kicker [Script Plugin]
|
#### Shared GUID Kicker [Script Plugin]
|
||||||
- This plugin kicks users using a specific GUID
|
- This plugin kicks users using a specific GUID
|
||||||
- GUID `F4D2C30B712AC6E3` on IW4x was packed into a torrent version of the game.
|
- GUID `F4D2C30B712AC6E3` on IW4x was packed into a torrent version of the game.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Extending Plugins
|
||||||
|
|
||||||
|
#### NuGet Package
|
||||||
|
The NuGet package for **IW4MAdmin's** "Shared Library" can be obtained from the [NuGet Gallery](https://www.nuget.org/packages/RaidMax.IW4MAdmin.SharedLibraryCore)
|
||||||
|
Referencing this package will give you the ability to write plugins against **IW4MAdmin's** core library.
|
||||||
|
#### Code
|
||||||
|
**IW4MAdmin's** functionality can be extended by writing additional plugins in C#.
|
||||||
|
Each class library must implement the `IPlugin` interface.
|
||||||
|
See the existing [plugins](https://github.com/RaidMax/IW4M-Admin/tree/master/Plugins) for examples.
|
||||||
|
#### JavaScript
|
||||||
|
**IW4MAdmin** functionality can also be extended using JavaScript.
|
||||||
|
The JavaScript parser supports [ECMA 5.1](https://ecma-international.org/ecma-262/5.1/) standards.
|
||||||
|
#### Plugin Object Template
|
||||||
|
In order to be properly parsed by the JavaScript engine, every plugin must conform to the following template.
|
||||||
|
```js
|
||||||
|
var plugin = {
|
||||||
|
author: 'YourHandle',
|
||||||
|
version: 1.0,
|
||||||
|
name: 'Sample JavaScript Plugin',
|
||||||
|
|
||||||
|
onEventAsync: function (gameEvent, server) {
|
||||||
|
},
|
||||||
|
|
||||||
|
onLoadAsync: function (manager) {
|
||||||
|
},
|
||||||
|
|
||||||
|
onUnloadAsync: function () {
|
||||||
|
},
|
||||||
|
|
||||||
|
onTickAsync: function (server) {
|
||||||
|
}
|
||||||
|
};
|
||||||
|
```
|
||||||
|
#### Required Properties
|
||||||
|
- `author` — [string] Author of the plugin (usually your name or online name/alias)
|
||||||
|
- `version` — [float] Version number of your plugin (useful if you release several different versions)
|
||||||
|
- `name` — [string] Name of your plugin (be descriptive!)
|
||||||
|
- `onEventAsync` — [function] Handler executed when an event occurs
|
||||||
|
- `gameEvent` — [parameter object] Object containing event type, origin, target, and other info (see the GameEvent class declaration)
|
||||||
|
- `server` — [parameter object] Object containing information and methods about the server the event occured on (see the Server class declaration)
|
||||||
|
- `onLoadAsync` — [function] Handler executed when the plugin is loaded by code
|
||||||
|
- `manager` — [parameter object] Object reference to the application manager (see the IManager interface definition)
|
||||||
|
- `onUnloadAsync` — [function] Handler executed when the plugin is unloaded by code (see live reloading)
|
||||||
|
- `onTickAsync` — [function] Handler executed approximately once per second by code *(unimplemented as of version 2.\*)*
|
||||||
|
- `server` — [parameter object] Object containing information and methods about the server the event occured on (see the Server class declaration)
|
||||||
|
### Live Reloading
|
||||||
|
Thanks to JavaScript's flexibility and parsability, the plugin importer scans the plugins folder and reloads the JavaScript plugins on demand as they're modified. This allows faster development/testing/debugging.
|
Loading…
Reference in New Issue
Block a user