diff options
Diffstat (limited to 'MCServer')
-rw-r--r-- | MCServer/.gitignore | 2 | ||||
-rw-r--r-- | MCServer/Plugins/ChatLog/plugin.lua | 3 | ||||
-rw-r--r-- | MCServer/Plugins/ChunkWorx/chunkworx_main.lua | 3 | ||||
m--------- | MCServer/Plugins/Core | 0 | ||||
-rw-r--r-- | MCServer/Plugins/Debuggers/Debuggers.lua | 42 | ||||
-rw-r--r-- | MCServer/Plugins/DiamondMover/DiamondMover.lua | 12 | ||||
-rw-r--r-- | MCServer/Plugins/HookNotify/HookNotify.lua | 82 | ||||
-rw-r--r-- | MCServer/Plugins/MagicCarpet/plugin.lua | 5 | ||||
m--------- | MCServer/Plugins/ProtectionAreas | 0 |
9 files changed, 85 insertions, 64 deletions
diff --git a/MCServer/.gitignore b/MCServer/.gitignore index ca10d90e8..ac226a77d 100644 --- a/MCServer/.gitignore +++ b/MCServer/.gitignore @@ -10,7 +10,7 @@ schematics *.schematic *.ilk *.pdb -memdump.xml +memdump* *.grab ProtectionAreas.sqlite helgrind.log diff --git a/MCServer/Plugins/ChatLog/plugin.lua b/MCServer/Plugins/ChatLog/plugin.lua index c2f6fb81a..adbf986e0 100644 --- a/MCServer/Plugins/ChatLog/plugin.lua +++ b/MCServer/Plugins/ChatLog/plugin.lua @@ -13,8 +13,7 @@ function Initialize(Plugin) Plugin:SetName("ChatLog") Plugin:SetVersion(3) - PluginManager = cRoot:Get():GetPluginManager() - PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHAT) + cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChat) LOG("Initialized " .. Plugin:GetName() .. " v." .. Plugin:GetVersion()) return true diff --git a/MCServer/Plugins/ChunkWorx/chunkworx_main.lua b/MCServer/Plugins/ChunkWorx/chunkworx_main.lua index 66cf00b97..ab9962387 100644 --- a/MCServer/Plugins/ChunkWorx/chunkworx_main.lua +++ b/MCServer/Plugins/ChunkWorx/chunkworx_main.lua @@ -26,8 +26,7 @@ function Initialize(Plugin) PLUGIN:SetName("ChunkWorx") PLUGIN:SetVersion(6) - PluginManager = cRoot:Get():GetPluginManager() - PluginManager:AddHook(PLUGIN, cPluginManager.HOOK_TICK) + cPluginManager.AddHook(cPluginManager.HOOK_TICK, OnTick) Plugin:AddWebTab("(Re)Generation", HandleRequest_Generation) diff --git a/MCServer/Plugins/Core b/MCServer/Plugins/Core -Subproject e3a45f34303331be77aceacf2ba53e503ad7284 +Subproject c8ef7e9f8ed2bc1ffdbb3756c2024536bf00469 diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua index 90a897aa6..599b8a3a3 100644 --- a/MCServer/Plugins/Debuggers/Debuggers.lua +++ b/MCServer/Plugins/Debuggers/Debuggers.lua @@ -16,15 +16,21 @@ function Initialize(Plugin) Plugin:SetName("Debuggers") Plugin:SetVersion(1) - PluginManager = cRoot:Get():GetPluginManager() - PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_USING_BLOCK); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_USING_ITEM); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_TAKE_DAMAGE); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_TICK); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHAT); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_RIGHT_CLICKING_ENTITY); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_WORLD_TICK); - + --[[ + -- Test multiple hook handlers: + cPluginManager.AddHook(cPluginManager.HOOK_TICK, OnTick1); + cPluginManager.AddHook(cPluginManager.HOOK_TICK, OnTick2); + --]] + + cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_USING_BLOCK, OnPlayerUsingBlock); + cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_USING_ITEM, OnPlayerUsingItem); + cPluginManager.AddHook(cPluginManager.HOOK_TAKE_DAMAGE, OnTakeDamage); + cPluginManager.AddHook(cPluginManager.HOOK_TICK, OnTick); + cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChat); + cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_RIGHT_CLICKING_ENTITY, OnPlayerRightClickingEntity); + cPluginManager.AddHook(cPluginManager.HOOK_WORLD_TICK, OnWorldTick); + + PluginManager = cRoot:Get():GetPluginManager(); PluginManager:BindCommand("/le", "debuggers", HandleListEntitiesCmd, "- Shows a list of all the loaded entities"); PluginManager:BindCommand("/ke", "debuggers", HandleKillEntitiesCmd, "- Kills all the loaded entities"); PluginManager:BindCommand("/wool", "debuggers", HandleWoolCmd, "- Sets all your armor to blue wool"); @@ -415,6 +421,24 @@ end +function OnTick1() + -- For testing multiple hook handlers per plugin + LOGINFO("Tick1"); +end + + + + + +function OnTick2() + -- For testing multiple hook handlers per plugin + LOGINFO("Tick2"); +end + + + + + --- When set to a positive number, the following OnTick() will perform GC and decrease until 0 again GCOnTick = 0; diff --git a/MCServer/Plugins/DiamondMover/DiamondMover.lua b/MCServer/Plugins/DiamondMover/DiamondMover.lua index c89a3394f..0fdd32250 100644 --- a/MCServer/Plugins/DiamondMover/DiamondMover.lua +++ b/MCServer/Plugins/DiamondMover/DiamondMover.lua @@ -9,7 +9,6 @@ -- Global variables -PLUGIN = {} -- Reference to own plugin object MOVER_SIZE_X = 4; MOVER_SIZE_Y = 4; MOVER_SIZE_Z = 4; @@ -19,13 +18,10 @@ MOVER_SIZE_Z = 4; function Initialize(Plugin) - PLUGIN = Plugin; - Plugin:SetName("DiamondMover"); Plugin:SetVersion(1); - PluginManager = cRoot:Get():GetPluginManager(); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_USED_ITEM); + cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_USED_ITEM, OnPlayerUsedItem); return true; end @@ -80,4 +76,8 @@ function OnPlayerUsedItem(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, Cu Area:Write(Player:GetWorld(), BlockX - MOVER_SIZE_X, BlockY - MOVER_SIZE_Y, BlockZ - MOVER_SIZE_Z); return false; end -end
\ No newline at end of file +end + + + + diff --git a/MCServer/Plugins/HookNotify/HookNotify.lua b/MCServer/Plugins/HookNotify/HookNotify.lua index 6badc63e7..ed791090e 100644 --- a/MCServer/Plugins/HookNotify/HookNotify.lua +++ b/MCServer/Plugins/HookNotify/HookNotify.lua @@ -13,47 +13,47 @@ function Initialize(Plugin) Plugin:SetVersion(1); PluginManager = cPluginManager:Get(); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_BLOCK_TO_PICKUPS); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHAT); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHUNK_AVAILABLE); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHUNK_GENERATED); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHUNK_GENERATING); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHUNK_UNLOADED); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHUNK_UNLOADING); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_COLLECTING_PICKUP); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_CRAFTING_NO_RECIPE); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_DISCONNECT); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_EXECUTE_COMMAND); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_HANDSHAKE); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_KILLING); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_LOGIN); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_BREAKING_BLOCK); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_BROKEN_BLOCK); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_EATING); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_JOINED); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_LEFT_CLICK); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_MOVING); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_PLACED_BLOCK); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_PLACING_BLOCK); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_RIGHT_CLICK); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_SHOOTING); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_SPAWNED); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_TOSSING_ITEM); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_USED_BLOCK); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_USED_ITEM); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_USING_BLOCK); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_USING_ITEM); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_POST_CRAFTING); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_PRE_CRAFTING); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_SPAWNED_ENTITY); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_SPAWNED_MONSTER); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_SPAWNING_ENTITY); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_SPAWNING_MONSTER); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_TAKE_DAMAGE); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_UPDATED_SIGN); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_UPDATING_SIGN); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_WEATHER_CHANGED); - PluginManager:AddHook(Plugin, cPluginManager.HOOK_WEATHER_CHANGING); + cPluginManager.AddHook(cPluginManager.HOOK_BLOCK_TO_PICKUPS, OnBlockToPickups); + cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChat); + cPluginManager.AddHook(cPluginManager.HOOK_CHUNK_AVAILABLE, OnChunkAvailable); + cPluginManager.AddHook(cPluginManager.HOOK_CHUNK_GENERATED, OnChunkGenerated); + cPluginManager.AddHook(cPluginManager.HOOK_CHUNK_GENERATING, OnChunkGenerating); + cPluginManager.AddHook(cPluginManager.HOOK_CHUNK_UNLOADED, OnChunkUnloaded); + cPluginManager.AddHook(cPluginManager.HOOK_CHUNK_UNLOADING, OnChunkUnloading); + cPluginManager.AddHook(cPluginManager.HOOK_COLLECTING_PICKUP, OnCollectingPickup); + cPluginManager.AddHook(cPluginManager.HOOK_CRAFTING_NO_RECIPE, OnCraftingNoRecipe); + cPluginManager.AddHook(cPluginManager.HOOK_DISCONNECT, OnDisconnect); + cPluginManager.AddHook(cPluginManager.HOOK_EXECUTE_COMMAND, OnExecuteCommand); + cPluginManager.AddHook(cPluginManager.HOOK_HANDSHAKE, OnHandshake); + cPluginManager.AddHook(cPluginManager.HOOK_KILLING, OnKilling); + cPluginManager.AddHook(cPluginManager.HOOK_LOGIN, OnLogin); + cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_BREAKING_BLOCK, OnPlayerBreakingBlock); + cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_BROKEN_BLOCK, OnPlayerBrokenBlock); + cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_EATING, OnPlayerEating); + cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_JOINED, OnPlayerJoined); + cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_LEFT_CLICK, OnPlayerLeftClick); + cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_MOVING, OnPlayerMoving); + cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_PLACED_BLOCK, OnPlayerPlacedBlock); + cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_PLACING_BLOCK, OnPlayerPlacingBlock); + cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_RIGHT_CLICK, OnPlayerRightClick); + cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_SHOOTING, OnPlayerShooting); + cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_SPAWNED, OnPlayerSpawned); + cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_TOSSING_ITEM, OnPlayerTossingItem); + cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_USED_BLOCK, OnPlayerUsedBlock); + cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_USED_ITEM, OnPlayerUsedItem); + cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_USING_BLOCK, OnPlayerUsingBlock); + cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_USING_ITEM, OnPlayerUsingItem); + cPluginManager.AddHook(cPluginManager.HOOK_POST_CRAFTING, OnPostCrafting); + cPluginManager.AddHook(cPluginManager.HOOK_PRE_CRAFTING, OnPreCrafting); + cPluginManager.AddHook(cPluginManager.HOOK_SPAWNED_ENTITY, OnSpawnedEntity); + cPluginManager.AddHook(cPluginManager.HOOK_SPAWNED_MONSTER, OnSpawnedMonster); + cPluginManager.AddHook(cPluginManager.HOOK_SPAWNING_ENTITY, OnSpawningEntity); + cPluginManager.AddHook(cPluginManager.HOOK_SPAWNING_MONSTER, OnSpawningMonster); + cPluginManager.AddHook(cPluginManager.HOOK_TAKE_DAMAGE, OnTakeDamage); + cPluginManager.AddHook(cPluginManager.HOOK_UPDATED_SIGN, OnUpdatedSign); + cPluginManager.AddHook(cPluginManager.HOOK_UPDATING_SIGN, OnUpdatingSign); + cPluginManager.AddHook(cPluginManager.HOOK_WEATHER_CHANGED, OnWeatherChanged); + cPluginManager.AddHook(cPluginManager.HOOK_WEATHER_CHANGING, OnWeatherChanging); LOGINFO("HookNotify plugin is installed, beware, the log output may be quite large!"); LOGINFO("You want this plugin enabled only when developing another plugin, not for regular gameplay."); diff --git a/MCServer/Plugins/MagicCarpet/plugin.lua b/MCServer/Plugins/MagicCarpet/plugin.lua index 3101866cd..27dcdf45d 100644 --- a/MCServer/Plugins/MagicCarpet/plugin.lua +++ b/MCServer/Plugins/MagicCarpet/plugin.lua @@ -7,9 +7,8 @@ function Initialize( Plugin ) Plugin:SetName( "MagicCarpet" ) Plugin:SetVersion( 1 ) - PluginManager = cRoot:Get():GetPluginManager() - PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_MOVING) - PluginManager:AddHook(Plugin, cPluginManager.HOOK_DISCONNECT) + cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_MOVING, OnPlayerMoving) + cPluginManager.AddHook(cPluginManager.HOOK_DISCONNECT, OnDisconnect) PluginManager:BindCommand("/mc", "magiccarpet", HandleCarpetCommand, " - Spawns a magical carpet"); diff --git a/MCServer/Plugins/ProtectionAreas b/MCServer/Plugins/ProtectionAreas -Subproject 3019c7b396221b987cd3f89d422276f764834ff +Subproject ecd3fce4409f9a9c6045a2ec3fca8c749f52a1b |