Mineuniverse
Log in Register
Plugins

BukkitCLI

BukkitCLI provides a simple way for plugins to execute commands on the command line and can be used as API.
by _ForgeUser10659865
Download Claim this project
824 downloads
0 likes
Updated Jun 30, 2026
0 hypes
Admin Tools Developer Tools

With BukkitCLI you can define and execute commands on the servers command line. With a CallbackHandler you can handle possible output. It will work as an API for other plugins to use and may support native ways of command triggering.

You need to be in control of the server minecraft is running on. This plugin wont wont work if you have no rights on the underlying server.

I recommend to group commands into little scripts and execute them instead of complex commands via BukkitCLI. You can run commands through bash but JavaRuntime does not do this by default. See examples for more information.

Links

Use Cases

  • Run an external backup script
  • Check availability of a service
  • Create a control room for your server for fun

Usage

  • Include BukkitCLI.jar in your build path
  • Import de.wrenchbox.cli.BukkitCLI in your class
  • Use one of the BukkitCLI.createJob() methods to schedule a job

Info

  • The job manager will queue all jobs and run them one after another according to FIFO principle.
  • You can define the working directory of a job
  • You can pass a callback handler to handle exit code, output and errors resulting from your command

Road Map

  • Native support for defining commands in addition to the API functionality
  • Permissions

Examples

package de.wrenchbox.test;

import org.bukkit.plugin.java.JavaPlugin;

import de.wrenchbox.cli.BukkitCLI;
import de.wrenchbox.cli.jobs.CallbackHandler;

public class TestPlugin extends JavaPlugin {
  
  @Override
  public void onEnable() {
    if (!getDataFolder().exists()) {
      getDataFolder().mkdirs();
    }

    // print the current working directory. should be the server root
    // [13:24:21 INFO]: [TestPlugin] Current directory: /home/amshaegar/workspace/Minecraft
    BukkitCLI.createJob("pwd", new CallbackHandler() {
      
      @Override
      public void execute(int exitCode, String out, String err) {
        getLogger().info(String.format("Current directory: %s", out));
      }
    });
    
    // create a file 'last_run' in the plugin directory
    // plugins/TestPlugin/last_run
    BukkitCLI.createJob("touch last_run", getDataFolder());
    
    // print the system date and time
    // [13:24:21 INFO]: [TestPlugin] System time: So 25. Mai 13:24:21 CEST 2014
    BukkitCLI.createJob("date", getDataFolder(), new CallbackHandler() {
      
      @Override
      public void execute(int exitCode, String out, String err) {
        if (exitCode == 0) {
          getLogger().info(String.format("System time: %s", out));
        } else {
          getLogger().warning(err);
        }
      }
    });
  }

}
v1.0
MC CB 1.7.9-R0.1
Release 2014-05-29 Get
v0.1
MC CB 1.7.9-R0.1
Alpha 2014-05-25 Get

More from _ForgeUser10659865

OpenCTF
7,035
Easy Plant
4,409
Easy Path
1,734
ServerMonitor
1,599

You Might Also Like

WorldGuard Custom Flags
WorldGuard Custom Flags
97,851
HoloAPI
Advanced and powerful holographic displays
93,959
Minequery
Minequery
91,099
SQLibrary
SQLibrary aims to streamline driver wrappers in Java for every database engine
85,675
WolfyUtilities
Utils and APIs: Config, Language and Inventory API, Protection Utils: WorldGuard, LWC, PlotSquared
84,728
DisguiseTester
Experiment with disguises!
9,677