summaryrefslogtreecommitdiff
path: root/init.lua
blob: 6e0cf2795c80d1088280761e8141258af0790317 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
local spawn_spawnpos = minetest.setting_get_pos("static_spawnpoint")
local execution_pos = {x=-310,y=0,z=-40}

places = {}

places.register_place = function (name, pos, command)
   if not command then
      command = name
   end
   minetest.register_chatcommand(command, {
        params = "",
        description = "Teleport to "..name,
        func = function(nm, param)
                local player = minetest.get_player_by_name(nm)
                if not player then
                        return false, "Player not found"
                end
		if xban and xban.get_property(nm, "jailed") then
		   player:setpos(execution_pos)
		   return true, "Nice try! You can't escape!"
		end
		player:setpos(pos)
		return true, "Teleporting to "..name.."..."
        end,
   })
end

				    
if spawn_spawnpos then
   places.register_place("Spawn", spawn_spawnpos, "spawn")
end
places.register_place("Origin", {x=0, y=0, z=0}, "origin")
places.register_place("South Forest", {x=285, y=9, z=-2047}, "sf")

-- minetest.register_chatcommand("spawn", {
--         params = "",
--         description = "Teleport to the spawn point",
--         func = function(name, param)
--                 local player = minetest.get_player_by_name(name)
--                 if not player then
--                         return false, "Player not found"
--                 end
--                 if spawn_spawnpos then
--                         player:setpos(spawn_spawnpos)
--                         return true, "Teleporting to spawn..."
--                 else
--                         return false, "The spawn point is not set!"
--                 end
--         end,
-- })

-- minetest.register_chatcommand("origin", {
--         params = "",
--         privs = {teleport = true},
--         description = "Teleport to (0,0,0)",
--         func = function(name, param)
--                 local player = minetest.get_player_by_name(name)
--                 if not player then
--                         return false, "Player not found"
--                 end
--                 player:setpos({x=0, y=0, z=0})
--                 return true, "Teleporting to origin..."
--         end,
-- })


minetest.register_on_newplayer(function(player)
        player:setpos({x=0, y=-1, z=0})
        end
)