Skip to content
DMBuce edited this page Mar 11, 2012 · 14 revisions

clicraft is a command-line wrapper for operation and administration of a Minecraft or Bukkit server.

Requirements

This program should work if you have the following:

  • Linux
  • GNU coreutils
  • BASH
  • tmux
  • The minecraft server jar, a drop-in replacement (e.g. bukkit), or a download utility (e.g. cURL)

If you have these requirements and it does not work for you, please file a bug report. If you have something close to this and it almost works, let me know, maybe I'll be able to add support for your setup.

Install

See the project README for installation and configuration. Better documentation coming soon (I promise!).

Action Scripts

You can extend clicraft's functionality by writing your own action scripts. These are simple scripts written in BASH that get executed from within clicraft, giving you access to clicraft's internal functions and variables, including those defined in clicraft.conf.

Clicraft's internal action scripts are located in src/lib/action.d/. To define your own script, give it a .sh extension and place it in src/etc/action.d/ so it won't get overwritten when upgrading clicraft. A contrived action script named foo.sh might look like this:

#!bash
#
# Usage: clicraft foo [bar]
#
#    Stops the server if it's running. If "bar" is specified, prints "foo" instead.
#

case "$1" in
  "")
    if status; then
        action stop
    else
        err "$SERVER_NAME is already stopped"
        return 1
    fi
  ;;
  "bar") msg "foo bar" ;;
  *)     action help foo ;;
esac

In this script, the 'Usage: ...' comment marks the beginning of the action's usage message. This message will be displayed when invoking clicraft help foo.

status, action, err, and msg are all functions internal to clicraft. You can see their declaration in lib/functions.sh. SERVER_NAME is a configuration option defined in clicraft.conf, while ACTION is the name of our action script ("foo" in this case).

Clone this wiki locally