{ config, lib, pkgs, ... }:
let
  common = import ../../common { inherit pkgs; };
  uberBukkitZip = pkgs.fetchzip {
    url = "https://github.com/Moresteck/Project-Poseidon-Uberbukkit/releases/download/2.0.0/uberbukkit-2.0.0-java17.zip";
    sha256 = "m4hgcqXJ43SnBGn6qNBGeEcXFv5Q8f/VFYJmx3aJ9PE=";
    stripRoot = false;
  };
  uberBukkit = pkgs.vanillaServers.vanilla.overrideAttrs (oldAttrs: {
    src = "${uberBukkitZip}/uberbukkit-2.0.0.jar";
  });
in {
  services = {
    minecraft-servers.servers.uberbeta = {
      package = uberBukkit;
      jvmOpts = "-Xmx512M";
      serverProperties = common.serverProperties // {
        difficulty = 3;
        server-port = 30005;
      };
    };
    cloudflare-dyndns.domains = lib.mkIf config.services.minecraft-servers.servers.uberbeta.enable [ "beta.nixfox.ca" ];
  };
}
