summaryrefslogtreecommitdiffstats
path: root/source/ChunkMap.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-02-05 20:57:22 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-02-05 20:57:22 +0100
commitdedb414a50328bf00462409d14d8917ff24844be (patch)
tree8024df89792a668ad675730b124429c4f03dc1dd /source/ChunkMap.cpp
parentBiomeVisualiser: initial import (diff)
downloadcuberite-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 'source/ChunkMap.cpp')
-rw-r--r--source/ChunkMap.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/source/ChunkMap.cpp b/source/ChunkMap.cpp
index ede16ffa6..142a009f5 100644
--- a/source/ChunkMap.cpp
+++ b/source/ChunkMap.cpp
@@ -11,6 +11,7 @@
#include "Chunk.h"
#include "Generating/Trees.h" // used in cChunkMap::ReplaceTreeBlocks() for tree block discrimination
#include "BlockArea.h"
+#include "PluginManager.h"
#ifndef _WIN32
#include <cstdlib> // abs
@@ -711,6 +712,9 @@ void cChunkMap::SetChunkData(
{
Chunk->MarkDirty();
}
+
+ // Notify plugins of the chunk becoming available
+ cPluginManager::Get()->CallHookChunkAvailable(m_World, a_ChunkX, a_ChunkZ);
}
@@ -1992,7 +1996,11 @@ void cChunkMap::cChunkLayer::UnloadUnusedChunks(void)
{
for (int i = 0; i < ARRAYCOUNT(m_Chunks); i++)
{
- if ((m_Chunks[i] != NULL) && (m_Chunks[i]->CanUnload()))
+ if (
+ (m_Chunks[i] != NULL) && // Is valid
+ (m_Chunks[i]->CanUnload()) && // Can unload
+ !cPluginManager::Get()->CallHookChunkUnloading(m_Parent->GetWorld(), m_Chunks[i]->GetPosX(), m_Chunks[i]->GetPosZ()) // Plugins agree
+ )
{
// The cChunk destructor calls our GetChunk() while removing its entities
// so we still need to be able to return the chunk. Therefore we first delete, then NULLify