-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.lua
More file actions
67 lines (53 loc) · 2.23 KB
/
main.lua
File metadata and controls
67 lines (53 loc) · 2.23 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
-- main.lua
-- Implements the plugin's main entrypoint.
-- Configuration: should prefixes be used or not?
-- If set to true, messages are prefixed. If false, messages are colored.
g_UsePrefixes = false
-- Global variables.
WorldsSpawnProtect = {}
WorldsWorldLimit = {}
WorldsWorldDifficulty = {}
lastsender = {}
-- Called on plugin start for initialization.
function Initialize(Plugin)
Plugin:SetName("Basics")
Plugin:SetVersion(tonumber(g_PluginInfo["Version"]))
-- Register for all hooks needed.
cPluginManager:AddHook(cPluginManager.HOOK_BLOCK_SPREAD, OnBlockSpread)
cPluginManager:AddHook(cPluginManager.HOOK_CHAT, OnChat)
cPluginManager:AddHook(cPluginManager.HOOK_EXPLODING, OnExploding)
cPluginManager:AddHook(cPluginManager.HOOK_PLAYER_BREAKING_BLOCK, OnPlayerBreakingBlock)
cPluginManager:AddHook(cPluginManager.HOOK_PLAYER_JOINED, MotdOnPlayerJoined)
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_TICK, OnTick)
cPluginManager:AddHook(cPluginManager.HOOK_WORLD_TICK, OnWorldTick)
cPluginManager:AddHook(cPluginManager.HOOK_ENTITY_TELEPORT, OnEntityTeleport)
cPluginManager:AddHook(cPluginManager.HOOK_KILLED, OnKilled)
cPluginManager:AddHook(cPluginManager.HOOK_ENTITY_CHANGING_WORLD, OnEntityChangingWorld)
cPluginManager:AddHook(cPluginManager.HOOK_EXECUTE_COMMAND, OnExecuteCommand)
-- Bind in-game commands...
-- Load the InfoReg shared library...
dofile(cPluginManager:GetPluginsPath() .. "/InfoReg.lua")
-- Bind all the commands...
RegisterPluginInfoCommands()
-- Bind all the console commands...
RegisterPluginInfoConsoleCommands()
-- Load SpawnProtection and WorldLimit settings...
cRoot:Get():ForEachWorld(
function (a_World)
LoadWorldSettings(a_World)
end
)
InitializeBanlist()
-- InitializeWhitelist()
-- Initialize the item blacklist i.e. what can't be contained using in-game commands.
-- IntializeItemBlacklist(Plugin)
LoadMOTD()
return true
end
function OnChat(Player, Message)
LOGINFO(Player:GetName() .. ": " .. StripColorCodes(Message));
return false
end