diff --git a/apps/amethyst/lib/servers/configuration.ex b/apps/amethyst/lib/servers/configuration.ex index 74957da..2411237 100644 --- a/apps/amethyst/lib/servers/configuration.ex +++ b/apps/amethyst/lib/servers/configuration.ex @@ -329,13 +329,16 @@ defmodule Amethyst.Server.Configuration do def handle({:acknowledge_finish_configuration}, client, state) do game = Application.fetch_env!(:amethyst, :default_game) |> Amethyst.GameCoordinator.find_or_create() state = Keyword.put(state, :game, game) - Amethyst.API.Game.login(game, state) - # TODO: All of this stuff should obviously not be hardcoded here - Amethyst.Server.Play.transmit({:login, - 0, false, ["minecraft:overworld"], 0, 16, 16, false, true, true, 0, - "minecraft:overworld", <<0::64>>, :spectator, nil, false, true, nil, 0, false - }, client) - Amethyst.Server.Play.serve(client, 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 + Amethyst.Server.Play.transmit({:login, + 0, false, ["minecraft:overworld"], 0, 16, 16, false, true, true, 0, + "minecraft:overworld", <<0::64>>, :spectator, nil, false, true, nil, 0, false + }, client) + Amethyst.Server.Play.serve(client, state) + end end # Serverbound Plugin Message https://wiki.vg/Protocol#Serverbound_Plugin_Message_(configuration) def handle({:serverbound_plugin_message, channel, data}, client, state) do diff --git a/config/config.exs b/config/config.exs index 7235c23..000c5f1 100644 --- a/config/config.exs +++ b/config/config.exs @@ -12,4 +12,3 @@ import Config level: :debug, format: "$date $time [$level] $metadata$message", metadata: [] - config :pre_commit, commands: ["test", "credo"]