#!/bin/bash

## Send commands to the neoforge server as if in the server console
#
# Example usage:
#    ./cm give pizza2d1 minecraft:oak_log 1
#
# Troubleshooting:
#    If the command shows an error that you are denied permission to the docker socket, you need to add your user to the docker group:
#
#    sudo usermod -aG docker $USER 
#
#    And then you will need to log out in order for it to take effect:
#        - For desktop environments you need to actually log out 
#        - If you are running this through SSH on a remote device you just need to close the terminal and reconnect

command=()
while [[ ! -z "${1}" ]]; do 
  command+=("${1}") 
  shift
done
docker exec -i neoforge_server rcon-cli "${command[@]}"
