Use Keyword instead of manual changes
All checks were successful
Build & Test / nix-build (push) Successful in 1m11s

This commit is contained in:
Kodi Craft 2024-07-09 19:00:03 +02:00
parent ec9f9c87ac
commit 361655da52
Signed by: kodi
GPG Key ID: 69D9EED60B242822
2 changed files with 3 additions and 2 deletions

View File

@ -236,10 +236,10 @@ defmodule Amethyst.Server.Configuration do
defp handle_plugin_message("minecraft:brand", data, _client, state) do
{[brand], ""} = Read.start(data) |> Read.string |> Read.stop
Logger.info("Client using brand: #{brand}")
{:ok, [{:brand, brand} | state]}
{:ok, Keyword.put(state, :brand, brand)}
end
defp handle_plugin_message("amethyst:hello", _data, _client, state) do
Logger.info("Client is Amethyst aware! Hello!")
{:ok, [{:amethyst, true} | state]}
{:ok, Keyword.put(state, :knows_amethyst, true)}
end
end

View File

@ -53,6 +53,7 @@ require Logger
@spec serve(:gen_tcp.socket()) :: no_return()
def serve(client, state \\ []) do
{id, data} = Amethyst.Server.Generic.get_packet(client)
Logger.debug("State: #{inspect(state)}")
packet = deserialize(id, data)
Logger.debug("Got packet #{inspect(packet)}")
{result, state} = handle(packet, client, state)