summaryrefslogtreecommitdiffstats
path: root/source/World.cpp
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-08-08 09:13:13 +0200
committermadmaxoft <github@xoft.cz>2013-08-08 09:13:13 +0200
commit3f4abe8c95e4d37a84018ca4d478a908fca423ac (patch)
tree4315077d767775ae9bd938a6301d59c0191c507d /source/World.cpp
parentMerge branch 'master' of github.com:mc-server/MCServer (diff)
downloadcuberite-3f4abe8c95e4d37a84018ca4d478a908fca423ac.tar
cuberite-3f4abe8c95e4d37a84018ca4d478a908fca423ac.tar.gz
cuberite-3f4abe8c95e4d37a84018ca4d478a908fca423ac.tar.bz2
cuberite-3f4abe8c95e4d37a84018ca4d478a908fca423ac.tar.lz
cuberite-3f4abe8c95e4d37a84018ca4d478a908fca423ac.tar.xz
cuberite-3f4abe8c95e4d37a84018ca4d478a908fca423ac.tar.zst
cuberite-3f4abe8c95e4d37a84018ca4d478a908fca423ac.zip
Diffstat (limited to 'source/World.cpp')
-rw-r--r--source/World.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/source/World.cpp b/source/World.cpp
index 699767d5e..6a83da489 100644
--- a/source/World.cpp
+++ b/source/World.cpp
@@ -2414,14 +2414,24 @@ int cWorld::SpawnMob(double a_PosX, double a_PosY, double a_PosZ, int a_EntityTy
default:
{
- LOGWARNING("cWorld::SpawnMob(): Unhandled entity type: %d. Not spawning.", a_EntityType);
+ LOGWARNING("%s: Unhandled entity type: %d. Not spawning.", __FUNCTION__, a_EntityType);
return -1;
}
}
Monster->SetPosition(a_PosX, a_PosY, a_PosZ);
Monster->SetHealth(Monster->GetMaxHealth());
- Monster->Initialize(this);
+ if (cPluginManager::Get()->CallHookSpawningMonster(*this, *Monster))
+ {
+ delete Monster;
+ return -1;
+ }
+ if (!Monster->Initialize(this))
+ {
+ delete Monster;
+ return -1;
+ }
BroadcastSpawnEntity(*Monster);
+ cPluginManager::Get()->CallHookSpawnedMonster(*this, *Monster);
return Monster->GetUniqueID();
}