-
Notifications
You must be signed in to change notification settings - Fork 0
Tutorial
This Tutorial should explain the concept of the plugin better than I could in the examples.
If you still have in-depth questions, look at the documentation/features, not the Tutorial.
First off, think of a command name. For this tutorial, I will just call it command-name.
One of the easiest things to start off with is a message, so let's make one.
command-name:
message: 'Hello, World'When you run this command, You should receive a text in chat that says Hello, World.
But let's say you need multiple lines to send to the player. In that case you can just make message a list.
There have been some problems with keeping the order of lists when having large indents. This problem only appeared in version 0.01, but I'll warn you, because no code of mine issues this behavior. It looks like it's a YAML problem, so it might persist.
command-name:
message:
- '------------'
- 'Hello, World'
- '------------'Because message can be a String or List, I call it a Listable.
You will notice, that in this plugin many things are Listables, which makes command creation easy.
But now, we get to the fun part!
Commands can do the most cool stuff.
You can define some by just typing the commands as a String, but by convention, it is always a list.
Also, from now on, I will leave out the command-name part, just know that all objects shown will be in that section.
commands:
- 'give <player> diamond'In this example, there is also a placeholder. Placeholders get replaced by certain values.
This placeholder <player> simply returns the name of the sender.
Also good to know is, that if the sender is a console, it will simply return 'console'
Here is another example of commands
message:
commands:
- 'tellraw <arg1> "<player> says: <arg2..>"'
args: []
usage: /<command> <player> <message>In this command, arguments are used for the sender to specify to whom the message should be sent and what the message should be.
But... what even are arguments? Arguments, short 'args', are the things you type after the command name in chat, split by spaces.
Here is a visualization of that:
/command arg1 arg2 arg3
The args: [] just indicates, you can type however many args you want.
The commands just sends the message to the specified player it should be sent to.
Also, <arg2..> returns the second argument + all after that