{ pkgs, config, ... }:
let
  common = import ../../common { inherit pkgs; };
in {
  services = {
    minecraft-servers.servers.johnside = {
      enable = true;
      package = pkgs.paperServers.paper-1_20_6;
      jvmOpts = "-Xmx2500M";
      serverProperties = common.serverProperties // {
        difficulty = 2;
        server-port = 30009;
        motd = "\\u00A7l\\u00A79Johnside SMP\\u00A7r \\u00A7l\\u00A7fworld for \\u00A74John lovers only.";
      };
      whitelist = common.whitelist;
      symlinks = common.paperSymlinks // {
        "plugins/BlueMap.jar" = builtins.fetchurl {
          url = "https://cdn.modrinth.com/data/swbUV1cr/versions/TL5ElRWX/BlueMap-5.3-spigot.jar";
          sha256 = "08ls3wk0333vjg49kcmri884pcgm2xk9xdhwcxyffbh4ra0xrlbw";
        };
        "plugins/BlueMapOfflinePlayers.jar" = builtins.fetchurl {
          url = "https://github.com/TechnicJelle/BlueMapOfflinePlayerMarkers/releases/download/v3.0/BlueMapOfflinePlayerMarkers-3.0.jar";
          sha256 = "1f07w53q7yr4mvph7013d7ajxmp4lnsv6b1ab14y2x0bmqv39nwr";
        };
        "plugins/BlueMapMarkerManager.jar" = builtins.fetchurl {
          url = "https://cdn.modrinth.com/data/a8UoyV2h/versions/E0XoPfJV/BMM-2.1.5.jar";
          sha256 = "1vpnqglybysxnqyzkjnwbwg000dqkbk516apzvhmg39wlfaysl9d";
        };
        "plugins/CustomDiscs.jar" = builtins.fetchurl {
          url = "https://github.com/Navoei/CustomDiscs/releases/download/v3.0/custom-discs-3.0.jar";
          sha256 = "0xv0zrkdmjx0d7l34nqag8j004pm9zqivc12d3zy9pdrkv7pz87d";
        };
        "plugins/NotTooExpensive.jar" = builtins.fetchurl {
          url = "https://github.com/Mrredstone5230/Not-Too-Expensive/releases/download/1.1/not-too-expensive-1.1.jar";
          sha256 = "0da4v5l7iwry3wc21292lkmjprgmign4vdshzmhp7qc9hx26pj2d";
        };
        "plugins/SilkTouchHands.jar" = builtins.fetchurl {
          url = "https://github.com/5U55/SilkTouchSpigot/releases/download/v1.1/SilkTouchv1.1.jar";
          sha256 = "0mbp73xclr7f5m2lbdfz6is1j8vvyv1qwpl28sm089zrpm73qn6w";
        };
      };
      files = common.configFiles;
    };

    # BlueMap webhost
    nginx.virtualHosts."john.${config.domains.jim1}" = {
      enableACME = true;
      forceSSL = true;
      locations."/" = {
        proxyPass = "http://127.0.0.1:31010";
        proxyWebsockets = true;
      };
    };
  };
}
