Repository navigation
Expand file tree
/
Copy pathconfiguration.lua
More file actions
68 lines (51 loc) · 1.7 KB
/
Copy pathconfiguration.lua
File metadata and controls
68 lines (51 loc) · 1.7 KB
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
local types = require("types")
local packet = require("packet")
local configuration = {}
function configuration.handle(client, name, uuid)
while true do
local pkt = packet.decode(client)
if pkt.id == 2 then
print("User has mods")
else
break
end
end
local message = [[
This server software is currently being worked on and may be buggy.
If you encounter any bugs while playing,
please report them here:
https://github.com/Jimhasaburger/lua-mc-server/issues
]]
-- send message
client:send(packet.encode(19, types.writeString(message)))
-- wait for accept
local accept = packet.decode(client)
if not accept.id == 9 then
print("Expected Code of Conduct accept, got:", accept.id)
end
-- this is needed
local known_packs_payload = types.writeVarInt(1)
.. types.writeString("minecraft")
.. types.writeString("core")
.. types.writeString("26.2")
client:send(packet.encode(14, known_packs_payload))
local client_packs_response = packet.decode(client)
if not client_packs_response.id == 7 then
warn("Expected Known Packs response (7), got:", client_packs_response.id)
end
local registry = require("registry")
-- registry time!
registry.send(client)
local tags = require("tags")
-- tag time!
tags.send(client)
-- finish
client:send(packet.encode(3, ""))
local ack = packet.decode(client)
if not ack.id == 3 then
error("ERROR!")
end
local play = require("play")
play.handle(client, name, uuid)
end
return configuration