forked from OnfireNetwork/OnsetJavaPlugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPluginInterface.cpp
More file actions
49 lines (39 loc) · 1.02 KB
/
PluginInterface.cpp
File metadata and controls
49 lines (39 loc) · 1.02 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
#include <PluginSDK.h>
#include "Plugin.hpp"
#include "version.hpp"
Onset::IServerPlugin* Onset::Plugin::_instance = nullptr;
EXPORT(int) OnPluginGetApiVersion()
{
return PLUGIN_API_VERSION;
}
EXPORT(void) OnPluginCreateInterface(Onset::IBaseInterface *PluginInterface)
{
Onset::Plugin::Init(PluginInterface);
}
EXPORT(int) OnPluginStart()
{
Plugin::Get();
Onset::Plugin::Get()->Log("OnsetJavaPlugin (" PLUGIN_VERSION ") loaded!");
return PLUGIN_API_VERSION;
}
EXPORT(void) OnPluginStop()
{
Plugin::Singleton::Destroy();
Onset::Plugin::Get()->Log("OnsetJavaPlugin unloaded!");
Onset::Plugin::Destroy();
}
EXPORT(void) OnPluginTick(float DeltaSeconds)
{
(void)DeltaSeconds;
}
EXPORT(void) OnPackageLoad(const char *PackageName, lua_State *L)
{
(void)PackageName;
for (auto const &f : Plugin::Get()->GetFunctions())
Lua::RegisterPluginFunction(L, std::get<0>(f), std::get<1>(f));
Plugin::Get()->AddPackage(PackageName, L);
}
EXPORT(void) OnPackageUnload(const char *PackageName)
{
Plugin::Get()->RemovePackage(PackageName);
}