-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSkyGrid.lua
58 lines (45 loc) · 1.63 KB
/
SkyGrid.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
-- Bad, bad random generator
math.randomseed(os.time())
math.random(); math.random(); math.random()
function LoadLuaFiles()
local folders = { "/code", "/code/classes", "/code/commands" }
local localFolder = cPluginManager:Get():GetCurrentPlugin():GetLocalFolder()
for _, folder in pairs(folders) do
local files = cFile:GetFolderContents(localFolder .. folder)
for _, file in pairs(files) do
if (string.sub(file, #file -3, #file) == ".lua") then
dofile(localFolder .. folder .. "/" .. file)
end
end
end
end
LoadLuaFiles()
function Initialize(a_Plugin)
a_Plugin:SetName("SkyGrid")
a_Plugin:SetVersion(1)
PLUGIN = a_Plugin
SKYGRID = cRoot:Get():GetWorld("skygrid")
if (SKYGRID == nil) then
LOGWARN("The plugin SkyGrid requires the world skygrid. Please add this line")
LOGWARN("World=skygrid")
LOGWARN("to the section [Worlds] in the settings.ini.")
LOGWARN("Then stop and start the server again.")
return false
end
CreateRecipes()
-- The classes containing the blocks for the generator
BLOCKS_OVERWORLD = cBlocksOverworld.new()
BLOCKS_NETHER = cBlocksNether.new()
BLOCKS_END = cBlocksEnd.new()
-- Hooks
cPluginManager:AddHook(cPluginManager.HOOK_CHUNK_GENERATING, OnChunkGenerating)
cPluginManager:AddHook(cPluginManager.HOOK_CRAFTING_NO_RECIPE, OnCraftingNoRecipe)
cPluginManager:AddHook(cPluginManager.HOOK_PLAYER_BROKEN_BLOCK, OnPlayerBrokenBlock)
-- Commands
cPluginManager:BindCommand("/skygrid", "skygrid.command", CommandSkygrid , " - Access to the skygrid commands")
LOG("Initialized " .. a_Plugin:GetName())
return true
end
function OnDisable()
LOG(PLUGIN:GetName() .. " is shutting down...")
end