JSONAPI-Commands

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.
Installation
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.
Configuration
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.
Methods
addListener(String command)registers the given commandaddListeners(String[] command)registers the given commandsremoveListener(String command)removes the given commandremoveListeners(String[] command)removes the given commandsremoveAllListeners()removes all listeners (use with caution!)allListeners()returns an array of all registered commands
Stream
The new stream is named commands. This means you can subscribe to it with this URL:
/api/2/subscribe?json={"name":"commands","username":"yourName","key":sha256("yourName"+"commands"+"yourPassword"+"yourSalt")}
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"
}
}
timeis the exact timestamp when the command was issuedcommandis the command issuedargsis an array of the arguments concatenated to the command (no args = empty array)playeris the player who issued the command (not the affected player)
Examples
... will follow shortly.
Help
- If you encounter a bug or have a feature request, feel free to open an issue.
- If you can't get everything up and running and need a helping hand, you can post to the forum thread.
-
View User Profile
-
Send Message
Posted Feb 3, 2015Can 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
Thanks!
-
View User Profile
-
Send Message
Posted Feb 23, 2014wheres the latest one, they went off of bukkit like 1 week or so ago
-
View User Profile
-
Send Message
Posted Jul 23, 2013Could Someone make a tutorial on how to use this. For example i Want /survival to run /mv tp Survival.
-
View User Profile
-
Send Message
Posted Jun 15, 2013Is 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.
Thanks.
-
View User Profile
-
Send Message
Posted Apr 13, 2013@joshwenke
Haha, busted. Yep, I've totally copied it. :D
@NodexServers
Thanks! I'll have a look into that.
-
View User Profile
-
Send Message
Posted Feb 24, 2013Love 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] 127.0.0.1: 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
-
View User Profile
-
Send Message
Posted Jan 19, 2013Did you like totally copy the less logo? :P
Nice plugin!
-
View User Profile
-
Send Message
Posted Jan 19, 2013seems nice, thanks for working on something like this