diff options
author | Lukas Pioch <lukas@zgow.de> | 2015-05-18 22:29:39 +0200 |
---|---|---|
committer | Lukas Pioch <lukas@zgow.de> | 2015-05-18 22:29:39 +0200 |
commit | 4d4d1e9c69a15e154bc358f1363b961de80b27d6 (patch) | |
tree | 9e95fe63ce0a3d006c71235f107f62bf0f10a86e /src/Entities/Entity.cpp | |
parent | APIDump: Removed an unneeded global variable. (diff) | |
download | cuberite-4d4d1e9c69a15e154bc358f1363b961de80b27d6.tar cuberite-4d4d1e9c69a15e154bc358f1363b961de80b27d6.tar.gz cuberite-4d4d1e9c69a15e154bc358f1363b961de80b27d6.tar.bz2 cuberite-4d4d1e9c69a15e154bc358f1363b961de80b27d6.tar.lz cuberite-4d4d1e9c69a15e154bc358f1363b961de80b27d6.tar.xz cuberite-4d4d1e9c69a15e154bc358f1363b961de80b27d6.tar.zst cuberite-4d4d1e9c69a15e154bc358f1363b961de80b27d6.zip |
Diffstat (limited to 'src/Entities/Entity.cpp')
-rw-r--r-- | src/Entities/Entity.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index 4a909a1fd..bc2b3e93e 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -1403,14 +1403,25 @@ bool cEntity::DoMoveToWorld(cWorld * a_World, bool a_ShouldSendRespawn) return false; } + // Ask the plugins if the entity is allowed to change the world + if (cRoot::Get()->GetPluginManager()->CallHookEntityChangeWorld(*this, *a_World)) + { + // A Plugin doesn't allow the entity to change the world + return false; + } + // Remove all links to the old world SetWorldTravellingFrom(GetWorld()); // cChunk::Tick() handles entity removal GetWorld()->BroadcastDestroyEntity(*this); // Queue add to new world a_World->AddEntity(this); + cWorld * OldWorld = cRoot::Get()->GetWorld(GetWorld()->GetName()); // Required for the hook HOOK_ENTITY_CHANGED_WORLD SetWorld(a_World); + // Entity changed the world, call the hook + cRoot::Get()->GetPluginManager()->CallHookEntityChangedWorld(*this, *OldWorld); + return true; } |