Minor tweaks

This commit is contained in:
Kodi Craft 2024-10-03 20:35:50 +02:00
parent 0fdc00148e
commit 7821b20758
Signed by: kodi
GPG Key ID: 69D9EED60B242822
2 changed files with 3 additions and 3 deletions

View File

@ -60,7 +60,7 @@ defmodule Amethyst.ConnectionState.Login do
Macros.defpacket_serverbound :login_acknowledged, 0x03, 767, []
Macros.defpacket_serverbound :cookie_response, 0x04, 767, [identifier: :string, payload: {:optional, :byte_array}]
def handle(%{packet_type: :login_start, name: name, player_uuid: player_uuid}, 767, state) do
def handle(%{packet_type: :login_start, name: name, player_uuid: player_uuid}, 767, _state) do
Logger.debug("Received login start for #{name} with UUID #{player_uuid}")
if Application.fetch_env!(:amethyst, :encryption) do
raise RuntimeError, "Encryption is not currently supported"

View File

@ -78,7 +78,7 @@ defmodule Amethyst.ConnectionState.Macros do
end
def write_signature(packet, signature) do
data = Enum.reduce(signature, "", fn {name, type}, acc ->
Enum.reduce(signature, "", fn {name, type}, acc ->
#acc <> apply(Write, type, [Map.get(packet, name)])
case type do
{:optional, {:compound, signature}} ->
@ -145,7 +145,7 @@ defmodule Amethyst.ConnectionState.Macros do
_ -> false
end
end
def type_matches(value, {:optional, type}) when is_nil(value), do: true
def type_matches(value, {:optional, _type}) when is_nil(value), do: true
def type_matches(value, {:optional, type}), do: type_matches(value, type)
def type_matches(value, {:array, signature}) when is_list(value), do: Enum.all?(value, fn item -> check_type(item, signature) end)
def type_matches(value, {:compound, signature}) when is_map(value), do: check_type(value, signature)