From f5adebb13f1ce2034804408c80fff8f41c5c080e Mon Sep 17 00:00:00 2001 From: Kodi Craft Date: Sun, 4 Aug 2024 07:44:03 +0200 Subject: [PATCH] Send brand --- lib/servers/configuration.ex | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/servers/configuration.ex b/lib/servers/configuration.ex index e789a15..ed782c3 100644 --- a/lib/servers/configuration.ex +++ b/lib/servers/configuration.ex @@ -242,13 +242,15 @@ defmodule Amethyst.Server.Configuration do def handle(tuple, _) do Logger.error("Unhandled but known packet #{elem(tuple, 0)}") end - defp handle_plugin_message("minecraft:brand", data, _client, state) do + defp handle_plugin_message("minecraft:brand", data, client, state) do {[brand], ""} = Read.start(data) |> Read.string |> Read.stop Logger.info("Client using brand: #{brand}") + transmit({:clientbound_plugin_message, "minecraft:brand", "amethyst"}, client) {:ok, Keyword.put(state, :brand, brand)} end - defp handle_plugin_message("amethyst:hello", _data, _client, state) do + defp handle_plugin_message("amethyst:hello", _data, client, state) do Logger.info("Client is Amethyst aware! Hello!") + transmit({:clientbound_plugin_message, "amethyst:hello", ""}, client) {:ok, Keyword.put(state, :knows_amethyst, true)} end end