{ pkgs, ... }:
let
  common = import ../../common { inherit pkgs; };
in {
  services.minecraft-servers.servers.velocity = {
    package = pkgs.velocityServers.velocity;
    jvmOpts = "-Xmx512M";
    symlinks = {
      "plugins/Geyser.jar" = builtins.fetchurl {
        url = "https://download.geysermc.org/v2/projects/geyser/versions/2.4.2/builds/660/downloads/velocity";
        sha256 = "09z938v6xrgbiba8rxgi7cdh3xxkv9fdampy15k6fmwddmj9y4a2";
      };
      "plugins/Floodgate.jar" = builtins.fetchurl {
        url = "https://download.geysermc.org/v2/projects/floodgate/versions/2.2.3/builds/109/downloads/velocity";
        sha256 = "1hxdf38qzpzdnyn2gn1152fyd54bi37i0ayc82dgcjf0qrcbmv0c";
      };
      "plugins/LuckPerms.jar" = builtins.fetchurl {
        url = "https://download.luckperms.net/1556/velocity/LuckPerms-Velocity-5.4.141.jar";
        sha256 = "0j5f7r3g8h4f8z8ppakwfk96hijp3slr0vxyj9v8x4h8w5rcl9d1";
      };
      "plugins/SkinsRestorer.jar" = builtins.fetchurl {
        url = "https://github.com/SkinsRestorer/SkinsRestorer/releases/download/15.4.2/SkinsRestorer.jar";
        sha256 = "14nl9mi958bfqwqz9182cxj7m6l15kalq3wjmjqzy50s52si35wf";
      };
      "plugins/ViaVersion.jar" = builtins.fetchurl {
        url = "https://github.com/ViaVersion/ViaVersion/releases/download/5.0.3/ViaVersion-5.0.3.jar";
        sha256 = "02gf91ysialgvbl0w8awa0dsi1yb33ac7clmz0wika1xigk9z10r";
      };
      "plugins/ViaBackwards.jar" = builtins.fetchurl {
        url = "https://github.com/ViaVersion/ViaBackwards/releases/download/5.0.3/ViaBackwards-5.0.3.jar";
        sha256 = "1wqk68pjrzl1zhajb9lxa1s6wzj85rb0c2riycv9yysr5bcxssqi";
      };
      "plugins/Voicechat.jar" = builtins.fetchurl {
        url = "https://cdn.modrinth.com/data/9eGKb6K1/versions/svvcJhgC/voicechat-velocity-2.5.20.jar";
        sha256 = "0nw85x24qa9skbhfgbhsjl2r7d9xshr9f04nnq490zbgz7716lqq";
      };
    };
  };

  # Open ports for proxy
  networking.firewall = {
    # Server and info
    allowedTCPPorts = [
      25565
      19132
      5657
    ];
    # Server, VC, and Bedrock
    allowedUDPPorts = [
      25565
      19132
    ];
  };
}
