-
Notifications
You must be signed in to change notification settings - Fork 41
/
main.lua
69 lines (57 loc) · 3.13 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
-- main.lua
-- Implements the main plugin entrypoint
function Initialize(Plugin)
Plugin:SetName(g_PluginInfo.Name)
-- Register for all hooks needed
cPluginManager:AddHook(cPluginManager.HOOK_BLOCK_SPREAD, OnBlockSpread)
cPluginManager:AddHook(cPluginManager.HOOK_CHAT, OnChat)
cPluginManager:AddHook(cPluginManager.HOOK_CRAFTING_NO_RECIPE, OnCraftingNoRecipe)
cPluginManager:AddHook(cPluginManager.HOOK_PLAYER_DESTROYED, OnDisconnect)
cPluginManager:AddHook(cPluginManager.HOOK_EXPLODING, OnExploding)
cPluginManager:AddHook(cPluginManager.HOOK_KILLING, OnKilling)
cPluginManager:AddHook(cPluginManager.HOOK_PLAYER_BREAKING_BLOCK, OnPlayerBreakingBlock)
cPluginManager:AddHook(cPluginManager.HOOK_PLAYER_JOINED, OnPlayerJoined)
cPluginManager:AddHook(cPluginManager.HOOK_PLAYER_JOINED, OnPlayerJoined_WebChat)
cPluginManager:AddHook(cPluginManager.HOOK_PLAYER_MOVING, OnPlayerMoving)
cPluginManager:AddHook(cPluginManager.HOOK_PLAYER_PLACING_BLOCK, OnPlayerPlacingBlock)
cPluginManager:AddHook(cPluginManager.HOOK_PLAYER_RIGHT_CLICK, OnPlayerRightClick)
cPluginManager:AddHook(cPluginManager.HOOK_SPAWNING_MONSTER, OnSpawningMonster)
cPluginManager:AddHook(cPluginManager.HOOK_TAKE_DAMAGE, OnTakeDamage)
cPluginManager:AddHook(cPluginManager.HOOK_TICK, OnTick)
cPluginManager:AddHook(cPluginManager.HOOK_WORLD_TICK, OnWorldTick)
-- Bind ingame commands:
dofile(cPluginManager:GetPluginsPath() .. "/InfoReg.lua")
RegisterPluginInfoCommands()
RegisterPluginInfoConsoleCommands()
-- Load SpawnProtection and WorldLimit settings for individual worlds:
cRoot:Get():ForEachWorld(
function (World)
LoadWorldSettings(World)
end
)
-- Initialize the banlist, load its DB, do whatever processing it needs on startup:
InitializeBanlist()
-- Initialize the whitelist, load its DB, do whatever processing it needs on startup:
InitializeWhitelist()
-- Initialize the Item Blacklist (the list of items that cannot be obtained using the give command):
IntializeItemBlacklist(Plugin)
-- Add webadmin tabs:
cWebAdmin:AddWebTab("Manage Server", "manage-server", HandleRequest_ManageServer)
cWebAdmin:AddWebTab("Server Settings", "server-settings", HandleRequest_ServerSettings)
cWebAdmin:AddWebTab("Chat", "chat", HandleRequest_Chat)
cWebAdmin:AddWebTab("Players", "players", HandleRequest_Players)
cWebAdmin:AddWebTab("Whitelist", "whitelist", HandleRequest_WhiteList)
cWebAdmin:AddWebTab("Permissions", "permissions", HandleRequest_Permissions)
cWebAdmin:AddWebTab("Plugins", "plugins", HandleRequest_ManagePlugins)
cWebAdmin:AddWebTab("Time & Weather", "time-weather", HandleRequest_Weather)
cWebAdmin:AddWebTab("Ranks", "ranks", HandleRequest_Ranks)
cWebAdmin:AddWebTab("Player Ranks", "player-ranks", HandleRequest_PlayerRanks)
-- Load the message of the day from file, and cache it:
LoadMOTD()
WEBLOGINFO("Core is initialised")
LOG("Initialised!")
return true
end
function OnDisable()
LOG("Disabling...")
end