]> git.lizzy.rs Git - elidragon_v2.git/blob - mods/elidragon_commands/init.lua
6ef447e2c82233343e8f955e9630f968dd797b01
[elidragon_v2.git] / mods / elidragon_commands / init.lua
1 local descriptions = {}
2
3 local current_world = elidragon.WORLD
4 for _, world in ipairs(elidragon.WORLDS) do
5         if world ~= current_world then
6                 local desc = world:sub(1, 1):upper() .. world:sub(2)
7                 descriptions[world] = desc
8                 minetest.register_chatcommand(world, {
9                         description = "Join " .. desc,
10                         func = function(name)
11                                 multiserver.redirect(name, world)
12                         end
13                 })
14         end
15 end
16
17 multiserver.register_on_redirect_done(function(name, world, success)
18         if not success then
19                 minetest.send_chat_message(name, minetest.colorize(mcl_colors.RED, descriptions[world] .. " is down."))
20         end
21 end)