-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathmain.lua
85 lines (49 loc) · 1.67 KB
/
main.lua
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
-- main.lua
-- Contains the Initialize and OnDisable functions. It also loads all the necessary files.
-- First of all load all the library expansions
dofolder(cPluginManager:Get():GetCurrentPlugin():GetLocalFolder() .. "/LibrariesExpansion")
--- All the folders that shouldn't be loaded by
g_ExcludedFolders = table.todictionary{
"craftscripts",
"LibrariesExpansion",
"Tests",
".",
"..",
}
-- Load all the folders
local WorldEditPath = cPluginManager:Get():GetCurrentPlugin():GetLocalFolder()
for _, Folder in ipairs(cFile:GetFolderContents(WorldEditPath)) do repeat
local Path = WorldEditPath .. "/" .. Folder
if (not cFile:IsFolder(Path)) then
break -- Is a continue due to a do-while directly after the for
end
if (g_ExcludedFolders[Folder]) then
break -- Is a continue due to a do-while directly after the for
end
dofolder(Path)
until true end
function Initialize(a_Plugin)
a_Plugin:SetName(g_PluginInfo.Name)
a_Plugin:SetVersion(g_PluginInfo.Version)
InitializeConfiguration(a_Plugin:GetLocalFolder() .. "/config.cfg")
-- Load the InfoReg shared library:
dofile(cPluginManager:GetPluginsPath() .. "/InfoReg.lua")
--Bind all the commands:
RegisterPluginInfoCommands();
if (g_Config.Updates.CheckForUpdates) then
cUpdater:CheckForNewerVersion()
end
-- Initialize SQL Storage
cSQLStorage:Get()
cFile:CreateFolder("schematics")
LOG("Enabling v" .. g_PluginInfo.DisplayVersion)
return true
end
function OnDisable()
LOG("Disabling v" .. g_PluginInfo.DisplayVersion)
ForEachPlayerState(
function(a_State)
a_State:Save(a_State:GetUUID())
end
)
end