From 7821b20758bfc06aff0380e87dcad80db7db3a58 Mon Sep 17 00:00:00 2001 From: Kodi Craft Date: Thu, 3 Oct 2024 20:35:50 +0200 Subject: [PATCH] Minor tweaks --- apps/amethyst/lib/states/login.ex | 2 +- apps/amethyst/lib/states/macros.ex | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/amethyst/lib/states/login.ex b/apps/amethyst/lib/states/login.ex index 2e6f752..ae9fa97 100644 --- a/apps/amethyst/lib/states/login.ex +++ b/apps/amethyst/lib/states/login.ex @@ -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" diff --git a/apps/amethyst/lib/states/macros.ex b/apps/amethyst/lib/states/macros.ex index 0cd5722..a6def10 100644 --- a/apps/amethyst/lib/states/macros.ex +++ b/apps/amethyst/lib/states/macros.ex @@ -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)