Send brand

This commit is contained in:
Kodi Craft 2024-08-04 07:44:03 +02:00
parent 4c05158f23
commit f5adebb13f
Signed by: kodi
GPG Key ID: 69D9EED60B242822

View File

@ -242,13 +242,15 @@ defmodule Amethyst.Server.Configuration do
def handle(tuple, _) do def handle(tuple, _) do
Logger.error("Unhandled but known packet #{elem(tuple, 0)}") Logger.error("Unhandled but known packet #{elem(tuple, 0)}")
end end
defp handle_plugin_message("minecraft:brand", data, _client, state) do defp handle_plugin_message("minecraft:brand", data, client, state) do
{[brand], ""} = Read.start(data) |> Read.string |> Read.stop {[brand], ""} = Read.start(data) |> Read.string |> Read.stop
Logger.info("Client using brand: #{brand}") Logger.info("Client using brand: #{brand}")
transmit({:clientbound_plugin_message, "minecraft:brand", "amethyst"}, client)
{:ok, Keyword.put(state, :brand, brand)} {:ok, Keyword.put(state, :brand, brand)}
end end
defp handle_plugin_message("amethyst:hello", _data, _client, state) do defp handle_plugin_message("amethyst:hello", _data, client, state) do
Logger.info("Client is Amethyst aware! Hello!") Logger.info("Client is Amethyst aware! Hello!")
transmit({:clientbound_plugin_message, "amethyst:hello", ""}, client)
{:ok, Keyword.put(state, :knows_amethyst, true)} {:ok, Keyword.put(state, :knows_amethyst, true)}
end end
end end