Prevent /spawnentity from spawning unknown entity (#6388)

This commit is contained in:
Wuzzy 2017-09-08 18:39:02 +02:00 committed by SmallJoker
parent 151c95bb9b
commit e3093cbe85

@ -629,6 +629,9 @@ core.register_chatcommand("spawnentity", {
core.log("error", "Unable to spawn entity, player is nil") core.log("error", "Unable to spawn entity, player is nil")
return false, "Unable to spawn entity, player is nil" return false, "Unable to spawn entity, player is nil"
end end
if not minetest.registered_entities[entityname] then
return false, "Cannot spawn an unknown entity"
end
if p == "" then if p == "" then
p = player:getpos() p = player:getpos()
else else