1 local function tp_func(y, goal)
3 local player = minetest.localplayer
4 local pos = player:get_pos()
7 return false, "Can't teleport to " .. goal .. " from this location."
16 local function disconnect_wrapper(func)
18 local success, msg = func()
20 minetest.after(0, minetest.disconnect)
26 local function menu_wrapper(func)
30 minetest.display_chat_message(msg)
35 local end_func = tp_func(-27000, "End")
36 local nether_func = tp_func(-29000, "Nether")
37 local spawn_func = disconnect_wrapper(tp_func(-32000, "Spawn"))
39 minetest.register_chatcommand("end", {
40 description = "Teleport to the end (works in the overworld only). This may drop you above the void, so make sure you have Fly or Jetpack enabled.",
44 minetest.register_chatcommand("nether", {
45 description = "Teleport to the nether (works in the overworld or the end). This may move you into solid blocks, so make sure you have a pickaxe ready or Noclip enabled.",
49 minetest.register_chatcommand("spawn", {
50 description = "Teleport to your spawn location. This will disconnect you, you have to reconnect afterwards.",
54 minetest.register_cheat("End", "Exploit", menu_wrapper(end_func))
55 minetest.register_cheat("Nether", "Exploit", menu_wrapper(nether_func))
56 minetest.register_cheat("Spawn", "Exploit", menu_wrapper(spawn_func))