diff options
author | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-02-05 20:57:22 +0100 |
---|---|---|
committer | madmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2013-02-05 20:57:22 +0100 |
commit | dedb414a50328bf00462409d14d8917ff24844be (patch) | |
tree | 8024df89792a668ad675730b124429c4f03dc1dd /source/PluginManager.cpp | |
parent | BiomeVisualiser: initial import (diff) | |
download | cuberite-dedb414a50328bf00462409d14d8917ff24844be.tar cuberite-dedb414a50328bf00462409d14d8917ff24844be.tar.gz cuberite-dedb414a50328bf00462409d14d8917ff24844be.tar.bz2 cuberite-dedb414a50328bf00462409d14d8917ff24844be.tar.lz cuberite-dedb414a50328bf00462409d14d8917ff24844be.tar.xz cuberite-dedb414a50328bf00462409d14d8917ff24844be.tar.zst cuberite-dedb414a50328bf00462409d14d8917ff24844be.zip |
Diffstat (limited to '')
-rw-r--r-- | source/PluginManager.cpp | 71 |
1 files changed, 67 insertions, 4 deletions
diff --git a/source/PluginManager.cpp b/source/PluginManager.cpp index f25b8ec73..8ff4f4e8f 100644 --- a/source/PluginManager.cpp +++ b/source/PluginManager.cpp @@ -233,7 +233,28 @@ bool cPluginManager::CallHookChat(cPlayer * a_Player, const AString & a_Message) -bool cPluginManager::CallHookChunkGenerated(cWorld * a_World, int a_ChunkX, int a_ChunkZ) +bool cPluginManager::CallHookChunkAvailable(cWorld * a_World, int a_ChunkX, int a_ChunkZ) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_CHUNK_AVAILABLE); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnChunkAvailable(a_World, a_ChunkX, a_ChunkZ)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookChunkGenerated(cWorld * a_World, int a_ChunkX, int a_ChunkZ, cChunkDesc * a_ChunkDesc) { HookMap::iterator Plugins = m_Hooks.find(HOOK_CHUNK_GENERATED); if (Plugins == m_Hooks.end()) @@ -242,7 +263,7 @@ bool cPluginManager::CallHookChunkGenerated(cWorld * a_World, int a_ChunkX, int } for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) { - if ((*itr)->OnChunkGenerated(a_World, a_ChunkX, a_ChunkZ)) + if ((*itr)->OnChunkGenerated(a_World, a_ChunkX, a_ChunkZ, a_ChunkDesc)) { return true; } @@ -254,7 +275,7 @@ bool cPluginManager::CallHookChunkGenerated(cWorld * a_World, int a_ChunkX, int -bool cPluginManager::CallHookChunkGenerating(cWorld * a_World, int a_ChunkX, int a_ChunkZ, cChunkDesc * a_LuaChunk) +bool cPluginManager::CallHookChunkGenerating(cWorld * a_World, int a_ChunkX, int a_ChunkZ, cChunkDesc * a_ChunkDesc) { HookMap::iterator Plugins = m_Hooks.find(HOOK_CHUNK_GENERATING); if (Plugins == m_Hooks.end()) @@ -263,7 +284,49 @@ bool cPluginManager::CallHookChunkGenerating(cWorld * a_World, int a_ChunkX, int } for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) { - if ((*itr)->OnChunkGenerating(a_World, a_ChunkX, a_ChunkZ, a_LuaChunk)) + if ((*itr)->OnChunkGenerating(a_World, a_ChunkX, a_ChunkZ, a_ChunkDesc)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookChunkUnloaded(cWorld * a_World, int a_ChunkX, int a_ChunkZ) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_CHUNK_UNLOADED); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnChunkUnloaded(a_World, a_ChunkX, a_ChunkZ)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookChunkUnloading(cWorld * a_World, int a_ChunkX, int a_ChunkZ) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_CHUNK_UNLOADING); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnChunkUnloading(a_World, a_ChunkX, a_ChunkZ)) { return true; } |