diff --git a/server/server.js b/server/server.js index 5a3125f..e1d92de 100644 --- a/server/server.js +++ b/server/server.js @@ -1036,14 +1036,15 @@ app.post('/api/chunks', (req, res) => { // Search blocks by name pattern in area app.get('/api/world/blocks/search', (req, res) => { try { - const { fromX, fromY, fromZ, toX, toY, toZ, pattern } = req.query; - if (!pattern) { - return res.status(400).json({ error: 'Missing pattern parameter' }); + const { fromX, fromY, fromZ, toX, toY, toZ, pattern, name } = req.query; + const searchPattern = pattern || name; + if (!searchPattern) { + return res.status(400).json({ error: 'Missing pattern or name parameter' }); } const blocks = db.getBlocksWithNameLike( parseInt(fromX) || -1000, parseInt(fromY) || -64, parseInt(fromZ) || -1000, parseInt(toX) || 1000, parseInt(toY) || 320, parseInt(toZ) || 1000, - pattern + searchPattern ); res.json({ blocks }); } catch (error) {