---
- name: Dependencies installed
  community.general.pkgng:
    name: openjdk16,tmux
    state: latest

- name: Minecraft JAR downloaded
  ansible.builtin.unzip:
    src: https://launcher.mojang.com/v1/objects/0a269b5f2c5b93b1712d0f5dc43b6182b9ab254e/server.jar
    dest: /usr/local/bin/minecraft-server.jar
    remote_src: yes

- name: Minecraft JAR downloaded
  ansible.builtin.unzip:
    src: https://cdn.getbukkit.org/spigot/spigot-1.17.jar
    dest: /usr/local/bin/spigot.jar
    remote_src: yes

- name: Minecraft RC file installed
  copy:
    src: minecraft.rc
    dest: /usr/local/etc/rc.d/minecraft
    owner: root
    mode: 0644
  notify: Minecraft restarted
