Clean some warnings
This commit is contained in:
parent
5063e8af12
commit
0fdc00148e
@ -19,7 +19,6 @@ defmodule Amethyst.ConnectionHandler do
|
|||||||
This module is responsible for handling incoming packets and sending outgoing packets. It keeps track of what state the connection is in and which game should
|
This module is responsible for handling incoming packets and sending outgoing packets. It keeps track of what state the connection is in and which game should
|
||||||
receive the packets.
|
receive the packets.
|
||||||
"""
|
"""
|
||||||
alias ElixirSense.Log
|
|
||||||
require Logger
|
require Logger
|
||||||
|
|
||||||
@spec child_spec(:gen_tcp.socket()) :: Supervisor.child_spec()
|
@spec child_spec(:gen_tcp.socket()) :: Supervisor.child_spec()
|
||||||
@ -30,7 +29,7 @@ alias ElixirSense.Log
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@spec start(:gen_tcp.socket(), atom(), pos_integer()) :: no_return()
|
@spec start(:gen_tcp.socket(), atom(), integer()) :: no_return()
|
||||||
def start(socket, connstate, version) do
|
def start(socket, connstate, version) do
|
||||||
{:ok, spawn(fn ->
|
{:ok, spawn(fn ->
|
||||||
Process.set_label("ConnectionHandler for #{inspect(socket)}")
|
Process.set_label("ConnectionHandler for #{inspect(socket)}")
|
||||||
@ -38,7 +37,7 @@ alias ElixirSense.Log
|
|||||||
end)}
|
end)}
|
||||||
end
|
end
|
||||||
|
|
||||||
@spec start_link(:gen_tcp.socket(), atom(), pos_integer()) :: no_return()
|
@spec start_link(:gen_tcp.socket(), atom(), integer()) :: no_return()
|
||||||
def start_link(socket, connstate, version) do
|
def start_link(socket, connstate, version) do
|
||||||
{:ok, spawn_link(fn ->
|
{:ok, spawn_link(fn ->
|
||||||
Process.set_label("ConnectionHandler for #{inspect(socket)}")
|
Process.set_label("ConnectionHandler for #{inspect(socket)}")
|
||||||
@ -46,7 +45,7 @@ alias ElixirSense.Log
|
|||||||
end)}
|
end)}
|
||||||
end
|
end
|
||||||
|
|
||||||
@spec loop(:gen_tcp.socket(), atom(), pos_integer(), map()) :: no_return()
|
@spec loop(:gen_tcp.socket(), atom(), integer(), map()) :: no_return()
|
||||||
defp loop(socket, connstate, version, state) do
|
defp loop(socket, connstate, version, state) do
|
||||||
receive do
|
receive do
|
||||||
:closed ->
|
:closed ->
|
||||||
|
@ -36,7 +36,7 @@ defmodule Amethyst.NBT.Write do
|
|||||||
def check_type({:byte_array, values}) when is_list(values), do: Enum.all?(values, &is_integer/1)
|
def check_type({:byte_array, values}) when is_list(values), do: Enum.all?(values, &is_integer/1)
|
||||||
def check_type({:string, value}) when is_binary(value), do: true
|
def check_type({:string, value}) when is_binary(value), do: true
|
||||||
def check_type({:list, {type, values}}) when is_list(values), do: Enum.all?(values, &check_type({type, &1}))
|
def check_type({:list, {type, values}}) when is_list(values), do: Enum.all?(values, &check_type({type, &1}))
|
||||||
def check_type({:compound, values}) when is_map(values), do: Enum.all?(values, fn {name, {type, value}} -> check_type({type, value}) end)
|
def check_type({:compound, values}) when is_map(values), do: Enum.all?(values, fn {_name, {type, value}} -> check_type({type, value}) end)
|
||||||
def check_type({:int_array, values}) when is_list(values), do: Enum.all?(values, &is_integer/1)
|
def check_type({:int_array, values}) when is_list(values), do: Enum.all?(values, &is_integer/1)
|
||||||
def check_type({:long_array, values}) when is_list(values), do: Enum.all?(values, &is_integer/1)
|
def check_type({:long_array, values}) when is_list(values), do: Enum.all?(values, &is_integer/1)
|
||||||
def check_type(_), do: false
|
def check_type(_), do: false
|
||||||
|
@ -16,13 +16,13 @@ defmodule Example.Game do
|
|||||||
end
|
end
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def player_position(from, {x, y, z}, refs) do
|
def player_position(from, {x, y, z}, _refs) do
|
||||||
Logger.info("Player at #{inspect(from)} moved to #{x}, #{y}, #{z}")
|
Logger.info("Player at #{inspect(from)} moved to #{x}, #{y}, #{z}")
|
||||||
:ok
|
:ok
|
||||||
end
|
end
|
||||||
|
|
||||||
@impl true
|
@impl true
|
||||||
def joinable?(refs) do
|
def joinable?(_refs) do
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user