Respect result of Amethyst.API.Game.login/2
All checks were successful
Build & Test / nix-build (push) Successful in 1m33s

This commit is contained in:
Kodi Craft 2024-09-04 13:10:39 +02:00
parent 903d2fd3be
commit acc814a056
Signed by: kodi
GPG Key ID: 69D9EED60B242822
2 changed files with 10 additions and 8 deletions

View File

@ -329,7 +329,9 @@ defmodule Amethyst.Server.Configuration do
def handle({:acknowledge_finish_configuration}, client, state) do def handle({:acknowledge_finish_configuration}, client, state) do
game = Application.fetch_env!(:amethyst, :default_game) |> Amethyst.GameCoordinator.find_or_create() game = Application.fetch_env!(:amethyst, :default_game) |> Amethyst.GameCoordinator.find_or_create()
state = Keyword.put(state, :game, game) state = Keyword.put(state, :game, game)
Amethyst.API.Game.login(game, state) if Amethyst.API.Game.login(game, state) == :reject do
raise RuntimeError, "Default game rejected login!"
else
# TODO: All of this stuff should obviously not be hardcoded here # TODO: All of this stuff should obviously not be hardcoded here
Amethyst.Server.Play.transmit({:login, Amethyst.Server.Play.transmit({:login,
0, false, ["minecraft:overworld"], 0, 16, 16, false, true, true, 0, 0, false, ["minecraft:overworld"], 0, 16, 16, false, true, true, 0,
@ -337,6 +339,7 @@ defmodule Amethyst.Server.Configuration do
}, client) }, client)
Amethyst.Server.Play.serve(client, state) Amethyst.Server.Play.serve(client, state)
end end
end
# Serverbound Plugin Message https://wiki.vg/Protocol#Serverbound_Plugin_Message_(configuration) # Serverbound Plugin Message https://wiki.vg/Protocol#Serverbound_Plugin_Message_(configuration)
def handle({:serverbound_plugin_message, channel, data}, client, state) do def handle({:serverbound_plugin_message, channel, data}, client, state) do
handle_plugin_message(channel, data, client, state) handle_plugin_message(channel, data, client, state)

View File

@ -12,4 +12,3 @@ import Config
level: :debug, level: :debug,
format: "$date $time [$level] $metadata$message", format: "$date $time [$level] $metadata$message",
metadata: [] metadata: []
config :pre_commit, commands: ["test", "credo"]