feat(inferium-server): add list-seeds route

This commit is contained in:
Guillaume ARM 2024-05-24 01:56:54 +02:00
parent 2febed4d6e
commit 8687ec057b
2 changed files with 28 additions and 1 deletions

View File

@ -10,7 +10,6 @@ local function centerString(str, width)
return string.rep(' ', padding) .. str
end
local function formatSeedName(essenceName)
if not essenceName then
return false

View File

@ -52,6 +52,14 @@ local function saveConfigForComputer(computerId, config)
end
-- Utils
local function formatSeedName(essenceName)
if not essenceName then
return false
end
return 'mysticalagriculture:' .. essenceName .. '_seeds'
end
local function getConfigWithLength(config)
if not config then
return config
@ -144,6 +152,25 @@ local function listHarvesters()
return result
end
local function listAvailableSeeds()
return {
formatSeedName('inferium'),
formatSeedName('experience'),
formatSeedName('soulium'),
formatSeedName('diamond'),
formatSeedName('redstone'),
formatSeedName('coal'),
formatSeedName('iron'),
formatSeedName('dye'),
formatSeedName('nether_quartz'),
formatSeedName('yellorium'),
formatSeedName('glowstone'),
formatSeedName('fire'),
formatSeedName('water'),
formatSeedName('dirt')
}
end
local function exitServer(_, _, stopServer)
stopServer();
return true
@ -159,6 +186,7 @@ local ROUTES = {
['set-config'] = setConfig,
['delete-config'] = deleteConfig,
['list-harvesters'] = listHarvesters,
['list-seeds'] = listAvailableSeeds,
['exit-server'] = exitServer,
['upgrade-server'] = upgradeServer,
}