With JSONAPI-Commands you can easily register real ingame commands like /spawn or /tp silvinci Notch.
This is it. No downsides. No quirky hacks. It just works. You don't even get these pesky Unknown command messages.


Download the latest version of JSONAPI-Commands and put it in your server's plugins directory. If you haven't already grab the latest version of JSONAPI and put in the very same directory.

How it works

JSONAPI-Commands listens on the PlayerCommandPreprocessEvent, that is fired whenever a player (it has to be a player, console doesn't count) enters a command. As the name suggests it is called before any other plugin or Bukkit itself can interfere. This way we can cancel the whole command and noone will ever notice, that in reality the issued command never was officially registered.


JSONAPI-Commands creates a commands.yml in the JSONAPI folder. This file is pretty self-explanatory.
It contains all registered commands and may be edited by hand. This file survives server reloads and restarts.
This way you're programs don't have to re-register (refer to 'Methods') their commands all the time,
nevertheless I do encourage you to implement checks into your software. You'll never now what can possibly happen.

How to use it

JSONAPI-Commands introduces new methods and a stream to @alecgorge's great JSONAPI.


  • addListener(String command) registers the given command
  • addListeners(String[] command) registers the given commands
  • removeListener(String command) removes the given command
  • removeListeners(String[] command) removes the given commands
  • removeAllListeners() removes all listeners (use with caution!)
  • allListeners() returns an array of all registered commands


The new stream is named commands. This means you can subscribe to it with this URL:


A sample (prettifyed) response for /tp silvinci Notch run by the player alecgorge may look like this:

  "result": "success",
  "source": "commands",
  "success": {
    "time": 1353715957,
    "command": "tp",
    "args": ["silvinci", "Notch"],
    "player": "alecgorge"
  • time is the exact timestamp when the command was issued
  • command is the command issued
  • args is an array of the arguments concatenated to the command (no args = empty array)
  • player is the player who issued the command (not the affected player)


... will follow shortly.


You must login to post a comment. Don't have an account? Register to get one!

  • Avatar of nullschritt nullschritt Feb 04, 2015 at 04:02 UTC - 0 likes

    Can someone post an example of how to get it to push the stream automatically with push locations? I've tried to set it up but nothing happens.

    Is this right?

    - stream_name: commands



  • Avatar of dtschaedler dtschaedler Jul 23, 2013 at 16:54 UTC - 0 likes

    Could Someone make a tutorial on how to use this. For example i Want /survival to run /mv tp Survival.

  • Avatar of NodexServers NodexServers Jun 15, 2013 at 12:16 UTC - 0 likes

    Is there anyway you can add registering the commands with bukkit so they show up as registered and allow auto completion?

    I have built MANY command around this plugin and would like to see some autocompletion capabilities.


  • Avatar of silvinci silvinci Apr 13, 2013 at 23:27 UTC - 0 likes

    @joshwenke: Go

    Haha, busted. Yep, I've totally copied it. :D

    @NodexServers: Go

    Thanks! I'll have a look into that.

    Last edited Apr 13, 2013 by silvinci
  • Avatar of NodexServers NodexServers Feb 25, 2013 at 07:11 UTC - 0 likes

    Love the plugin! Please keep developing!

    One issue when listing Listeners - Running newest dev JSONAPI and Spigot Server 2013-02-25 02:08:52 [INFO] [JSONAPI] [API Call] method=commands.allListeners?args=[] 2013-02-25 02:08:52 [SEVERE] java.lang.reflect.InvocationTargetException 2013-02-25 02:08:52 [SEVERE] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 2013-02-25 02:08:52 [SEVERE] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 2013-02-25 02:08:52 [SEVERE] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 2013-02-25 02:08:52 [SEVERE] at java.lang.reflect.Method.invoke(Method.java:601) 2013-02-25 02:08:52 [SEVERE] at com.alecgorge.minecraft.jsonapi.dynamic.Call.call(Call.java:53) 2013-02-25 02:08:52 [SEVERE] at com.alecgorge.minecraft.jsonapi.dynamic.Caller$1.call(Caller.java:84) 2013-02-25 02:08:52 [SEVERE] at org.bukkit.craftbukkit.v1_4_R1.scheduler.CraftFuture.run(CraftFuture.java:89) 2013-02-25 02:08:52 [SEVERE] at org.bukkit.craftbukkit.v1_4_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:344) 2013-02-25 02:08:52 [SEVERE] at net.minecraft.server.v1_4_R1.MinecraftServer.r(MinecraftServer.java:522) 2013-02-25 02:08:52 [SEVERE] at net.minecraft.server.v1_4_R1.DedicatedServer.r(DedicatedServer.java:224) 2013-02-25 02:08:52 [SEVERE] at net.minecraft.server.v1_4_R1.MinecraftServer.q(MinecraftServer.java:485) 2013-02-25 02:08:52 [SEVERE] at net.minecraft.server.v1_4_R1.MinecraftServer.run(MinecraftServer.java:420) 2013-02-25 02:08:52 [SEVERE] at net.minecraft.server.v1_4_R1.ThreadServerApplication.run(SourceFile:849) 2013-02-25 02:08:52 [SEVERE] Caused by: java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Ljava.lang.String; 2013-02-25 02:08:52 [SEVERE] at com.github.cubixcraft.jsonapi.commands.APIMethods.allListeners(APIMethods.java:63) 2013-02-25 02:08:52 [SEVERE] ... 13 more

  • Avatar of joshwenke joshwenke Jan 20, 2013 at 00:49 UTC - 1 like

    Did you like totally copy the less logo? :P

    Nice plugin!

    Owner of the Cobalt network. Log on at hub.cobalt-mc.com.BFAK:joshwenke,90576601,436fccee15835282e353044c00703a5604f912b0b06d29586c5d13649af1da0a

  • Avatar of S1lverK3y S1lverK3y Jan 19, 2013 at 08:19 UTC - 0 likes

    seems nice, thanks for working on something like this



    Check it out! > ZirconCraft



Date created
Nov 24, 2012
Last update
Apr 14, 2013
Development stage
  • enUS
MIT License
Curse link
Recent files
  • R: 1.0.1 for 1.5.1 Apr 14, 2013
  • R: 1.0.0 for CB 1.4.7-R0.1 Jan 17, 2013
  • R: 1.0.0 for CB 1.4.5-R0.2 Nov 24, 2012