Prevent /spawnentity from spawning unknown entity (#6388)
authorWuzzy <wuzzy2@mail.ru>
Fri, 8 Sep 2017 16:39:02 +0000 (18:39 +0200)
committerSmallJoker <SmallJoker@users.noreply.github.com>
Fri, 8 Sep 2017 16:39:02 +0000 (18:39 +0200)
builtin/game/chatcommands.lua

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