Begin "implementing" configuration stage
Some checks failed
Build & Test / nix-build (push) Failing after 11s

This commit is contained in:
Kodi Craft 2024-07-09 16:18:04 +02:00
parent 7526ffae62
commit 38da310fd8
Signed by: kodi
GPG Key ID: 69D9EED60B242822
2 changed files with 12 additions and 2 deletions

View File

@ -227,7 +227,17 @@ defmodule Amethyst.Server.Configuration do
end
## HANDLING
def handle({:serverbound_plugin_message, channel, data}, client) do
handle_plugin_message(channel, data, client)
end
def handle(tuple, _) do
Logger.error("Unhandled but known packet #{elem(tuple, 0)}")
end
defp handle_plugin_message("minecraft:brand", data, _client) do
{[brand], ""} = Read.start(data) |> Read.string |> Read.stop
Logger.info("Client using brand: #{brand}")
end
defp handle_plugin_message("amethyst:hello", _data, _client) do
Logger.info("Client is Amethyst aware! Hello!")
end
end

View File

@ -116,8 +116,8 @@ defmodule Amethyst.Server.Login do
transmit({:login_success, uuid, name, [], false}, client)
end
end
def handle({:login_acknowledged}, _client) do
raise RuntimeError, "Configuration stage is not implemented."
def handle({:login_acknowledged}, client) do
Amethyst.Server.Configuration.serve(client)
end
def handle(tuple, _) do
Logger.error("Unhandled but known packet #{elem(tuple, 0)}")