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,13 +329,16 @@ 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
# TODO: All of this stuff should obviously not be hardcoded here raise RuntimeError, "Default game rejected login!"
Amethyst.Server.Play.transmit({:login, else
0, false, ["minecraft:overworld"], 0, 16, 16, false, true, true, 0, # TODO: All of this stuff should obviously not be hardcoded here
"minecraft:overworld", <<0::64>>, :spectator, nil, false, true, nil, 0, false Amethyst.Server.Play.transmit({:login,
}, client) 0, false, ["minecraft:overworld"], 0, 16, 16, false, true, true, 0,
Amethyst.Server.Play.serve(client, state) "minecraft:overworld", <<0::64>>, :spectator, nil, false, true, nil, 0, false
}, client)
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

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"]