From be8193e22a1a17527c8beb24fcd1036afdb10fd4 Mon Sep 17 00:00:00 2001 From: Gabriel Fontes Date: Fri, 2 Jun 2023 15:20:22 -0300 Subject: [PATCH] minecraft: make librelogin respect forcedhosts --- .../minecraft/servers/proxy/librelogin.nix | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/hosts/celaeno/services/minecraft/servers/proxy/librelogin.nix b/hosts/celaeno/services/minecraft/servers/proxy/librelogin.nix index 79ab63ab..c61c827e 100644 --- a/hosts/celaeno/services/minecraft/servers/proxy/librelogin.nix +++ b/hosts/celaeno/services/minecraft/servers/proxy/librelogin.nix @@ -1,4 +1,6 @@ -{ pkgs, config, ... }: { +{ pkgs, config, lib, ... }: let + inherit (lib) mapAttrs' replaceStrings nameValuePair; +in { services.minecraft-servers.servers.proxy = { symlinks."plugins/LibreLogin.jar" = pkgs.fetchurl rec { pname = "LibreLogin"; @@ -33,10 +35,18 @@ milliseconds-to-refresh-notification = 10000; minimum-password-length = -1; new-uuid-creator = "MOJANG"; - # Use the same config as velocity's "try" - pass-through.root = config.services.minecraft-servers.servers.proxy.files."velocity.toml".value.servers.try; + # Use the same config as velocity's "try" and "forced-hosts + pass-through = let + velocityCfg = config.services.minecraft-servers.servers.proxy.files."velocity.toml".value; + in { + root = velocityCfg.servers.try; + } // ( + mapAttrs' + (n: nameValuePair (replaceStrings [ "." ] [ "ยง" ] n)) + velocityCfg.forced-hosts + ); ping-servers = true; - remember-last-server = false; + remember-last-server = true; revision = 3; seconds-to-authorize = -1; session-timeout = 604800;