Minecraft Blogs / Tutorial

How To Make Custom Commands

  • 13,048 views, 5 today
  • 3
  • 3
  • 1
CameronBrandt avatar CameronBrandt
Level 38 : Artisan Engineer
Server Owners Rejoice!
Have you ever joined another server that had commands you've never seen before? And when you exicuted them, they did things you didn't know could be done? Those are custom commands! This short blog will teach you everything you need to know about them and how to make one yourself.

Getting your tools
You will need a Bukkit server for starters. Next head over to the rTriggers plugin page of bukkit. There are other custom command plugins, but this one has the most independability. The best way to describe it is that its an API for Java coding that allows you to make your own event triggers without knowing any javascript at all. The next plugin is optional, but after you read what it does, you'll most likely end up downloading it. Anyway, the plugin is Skript and it pretty much does the same thing rTriggers does, but its commands are recognized by your server console! (Your custom made commands can be run by the console too) Most of you may not know this, but custom command plugin users often get frustrated because their commands aren't recognized by the console. Why would I want the console to exicute my custom commands? The main is reason is for sudo-ing other players. But enough of that... let's move on.

 - rTriggers (Personalize messages with tag replacements)
 - Skript (A plugin that allows you to customize Minecraft's mechanics with simple scripts written in plain English sentences)

Creating the command
After you install rtriggers, go to your plugin directory and open the rtriggers folder. Inside you will see a .properties file. Open it to find nothing but the time stamp for when it was created. Lucky for you, the plugin dev. put a ton of examples right on the Bukkit page. However, I'm going to explain the part for making your own commands.

[color=rgb(51, 102, 255)]permgroup[/color]=<<command-triggerer>>:oncommand|[color=rgb(51, 102, 255)]/yourcommand[/color]:[color=rgb(51, 102, 255)]real command[/color]

Above is a line of code that you would paste into the rtriggers.properties file. The first word in blue is the permssion group that has access to the command. So if I was in the group (permgroup) and my friend was in the group (regular), I would be able to run the command and he couldn't. Next in blue is the command (case sensative) that you want to make up. Obviously /yourcommand is an unknown command, but when using rtriggers it becomes anything you want. Lasty in blue is the REAL command you want to be triggered when someone types, /yourcommand. To put this in better prespective, here is a custom command I made.

[size=14pt][size=12pt][color=rgb(51, 102, 255)]vip=<<command-triggerer>>:oncommand|/getlove:give <<param1>> cookie 1[/color][/size]

<<param1>> is put in place of someone's name. Now when someone in my VIP permission group runs the /getlove command, they are given a cookie! You can even take it another step with chain commands.

[size=14pt][color=rgb(51, 102, 255)][size=12pt]vip=<<command-triggerer>>:oncommand|/getlove:give <<param1>> cookie 1$[/size]
[size=12pt]@say <<param1>> could use some lovin right about now.[/size]
Now when the user in my VIP group runs the /getlove command, they are given a cookie and the server will announce to everyone that the user is in need of some lovin. You can also have your custom commands output a message too!

[color=rgb(51, 102, 255)][size=14pt][size=12pt]vip=<<triggerer>>:oncommand|/getlove|override:&c<3 &bYou are loved dont worry :) &c<3[/size]

[size=14pt]Now when a user in the VIP group runs the /getlove command, they will be given a cookie, the server will announce that they need love and a personal message will be sent to them telling them they are, indeed, loved.

[b]Running the commands in console[/b]
You'll notice that trying to /sudo crueladevil getlove doesn't work. The console sees past your bulls**t and knows there is no such command as /getlove. Well you've got one more trick up your sleve. Upon downloading Skript, it will generate its config like all plugins do, you're gonna want to find your [color=rgb(51, 102, 255)]scripts[/color] folder. Open it up and you'll see some examples. Let's explain the one that will trick the console.

[color=rgb(51, 102, 255)]#[/color]
[color=rgb(51, 102, 255)]# Trick the console into running your fake command.[/color]
[color=rgb(51, 102, 255)]#[/color]

[color=rgb(51, 102, 255)]command [b]/forcethelove[/b]:[/color]
[color=rgb(51, 102, 255)] description: Force the console to distribute love[/color]
[color=rgb(51, 102, 255)] permission: [b]skript.getlove[/b][/color]
[color=rgb(51, 102, 255)] trigger:[/color]
[color=rgb(51, 102, 255)] make player execute command "[b]/getlove[/b]"[/color]

The first thing in bold is the alias for your custom command. I.E. A custom command that will trigger your custom command. The next thing bolded is the permission node the player you plan on sudo-ing MUST have. Make sure these allways start with skript. (.) Lastly, we have your /getlove command that the console didn't recognize.

YOU'RE DONE! Save the skript document you just edited along with the rtriggers properties file. Restart or (/rtriggers reload) and (/skript reload all) The skript command IS RECOGNIZED by the console and therefore can be exicuted with it. So what does all this even do.

It does something so simple yet so potentialy powerfull... You can now sudo players to run your custom commands!!!!!!! Its a breakthru!

NOTE: When sudo-ing, be sure to use the skript command you made, NOT the rtriggers one. For example - [color=rgb(51, 102, 255)]/sudo crueladevil forcethelove[/color]

I understand this is very confusing, just comment if you have questions!

CreditThree years of bukkit

Create an account or sign in to comment.

06/25/2014 7:53 pm
Level 11 : Journeyman Mage
Icyblue145 avatar
I was very surprised to see you featuring the plugin Skript. I have been using it for quite some time on my server, and it has greatly benefitted me. Without it, running a server would be much harder than it is now. As I read your article, I noticed you made a slight mistake. You can make the console execute your custom command without making the console make the player execute a command. Before your command trigger (Keep in mind, this is Skript, not rTriggers), simply type the following:
    executable by: console
This will enable your command to be recognized by console. It is very helpful to do this over your technique.

Skript is a great plugin, and I pretty much rely on it for my server to grow and prosper.

~ Icy
Planet Minecraft


© 2010 - 2023