Custom Abilities: Keywords - BoBoBalloon/InnovativeItemsDOCS GitHub Wiki

Intro

Abilities give server owners an immense amount of control over their custom items and allow them to bring their ideas to life. But, abilities need to get code from somewhere, and that's where keywords come in. Keywords are developed and registered by Java developers (via the developer API) and once registered can be used by anyone (regardless of Java expertise) to customize and innovate.

If you don't know Java and can't take advantage of the developer API that's fine, because there are a lot of keywords built into the plugin.

Example

An example of a keyword named test without any arguments is provided below:

- 'test()'

Keywords are structured so that the name of the keyword is first, after that parentheses, inside of said parentheses contains all the arguments with commas separating each one. If you do not follow this syntax the keyword will fail to load and you will be notified with a warning in console.

The "\" (Escape) Character

When writing configuration for the plugin you may run into a small issue. Let's say that you want to use the message keyword to send a message to a player, but you want to add proper punctuation because you’re not a monkey. Because of that, you find yourself adding commas to the message text, but there is an issue, the interpreter tells you that you provided invalid arguments. This is because when a comma is placed in a keyword’s arguments, the interpreter thinks it means you want to add a new argument, but in this case, you just want to add a normal comma. This is where the new escape character comes in. By placing a backslash (\) before the comma you are telling the interpreter that you want the comma to act like a normal character and to “escape” all of its special functionality. If you wrote the keyword:

- 'message(?player, Hello, my name is Bob.)'

It would throw an error, but if you wrote it like this:

- 'message(?player, Hello\, my name is Bob.)'

It would work perfectly fine and when the message is parsed the backslash is removed so the final message sent to the player would be:

Hello, my name is Bob.

List of Native Keywords

Below will be a list of all built-in keywords that you may reference while writing new abilities.

If a keyword can take more than one targeter inside of an argument, they will be separated by "|".

(Remember, this is an incomplete list, and keywords can be removed and added at any time)

Keyword Description Arguments Example
delay Delays the rest of unexecuted keywords by a set amount {delay in ticks} - 'delay(20)'
ability Executes another ability with a trigger that has at least the same targeters {ability name} - 'ability(test-ability)'
randomability Executes a random ability from the list with a trigger that has at least the same targeters (unlimited arguments) {ability name 1} {ability name 2} {ability name 3} {ability name x} - 'randomability(test-ability, testing-2)'
command Executes a command from console (replaces player targeter with player name and entity targeter with entity UUID or player name) {command} - 'command(tp ?player 5 10 2)'
damage Damages the targeted entity by a set amount ?player|?entity {amount of damage} - 'damage(?player, 5)'
heal Heals the targeted entity by a set amount ?player|?entity {amount of healing} - 'heal(?player, 5)'
damagepercent Damages the targeted entity by a percent of their max health ?player|?entity {percent} - 'damagepercent(?player, 75)'
healpercent Heals the targeted entity by a percent of their max health ?player|?entity {percent} - 'healpercent(?player, 25)'
sethealth Sets the health of targeted entity by a set amount ?player|?entity {amount} - 'sethealth(?player, 6)'
feed Adds to the hunger level of targeted entity by a set amount ?player|?entity {amount} - 'feed(?player, 10)'
kindle Sets the targeted entity on fire for a set amount of ticks ?player|?entity {duration in ticks} - 'kindle(?player, 100)'
lightning Strikes lightning at the specified location and deals a set amount of damage to those nearby ?player|?entity|?block {amount} - 'lightning(?player, 2)'
message Sends a chat message to a target entity ?player|?entity {message with color codes} - 'message(?player, &e&lHello World!)'
particle Fires a particle at the targeted location ?player|?entity|?block {name of particle} {amount of particles} {x offset} {y offset} {z offset} - 'particle(?player, FLAME, 10, 0, 0, 0)'
effect Gives an entity a potion effect ?player|?entity {name of effect} {duration in ticks} {level} - 'effect(?player, SLOW, 100, 2)'
playsound Plays a sound to a player ?player|?entity {sound} {volume} {pitch} - 'playsound(?player, BLOCK_COMPARATOR_CLICK, 1, 1)'
giveitem Gives a vanilla minecraft item to a player ?player|?entity {material} {amount} - 'giveitem(?player, PLAYER_HEAD, 3)'
givecustomitem Gives an innovative custom item to a player ?player|?entity {item name} {amount} - 'givecustomitem(?player, blood-blade, 1)'
removehelditem Removes a set amount of the item the target is holding ?player|?entity {amount} - 'removehelditem(?player, 2)'
gamemode Sets the targets gamemode ?player|?entity {gamemode} - 'gamemode(?player, creative)'
velocity Adds to the targets velocity ?player|?entity {change in x} {change in y} {change in z} - 'velocity(?player, 0, 1.5, 0)'
switcheroo Swaps the positions of the casting player and the trigger related entity ?entity - 'switcheroo(?entity)'
actionbar Sends an actionbar message to the targeted entity ?player|?entity {message with color codes} - 'actionbar(?player, &e&lHello World!)'
titlemessage Sends a title message to the targeted entity ?player|?entity {title with color codes} {subtitle with color codes, could also be null for no subtitle} {ticks to fade in} {duration} {ticks to fade out} - 'titlemessage(?player, &e&lHello World!, null, 0, 60, 0)'
teleport Teleports the entity to the specified location ?player|?entity {x coordinate} {y coordinate} {z coordinate} {world name} - 'teleport(?player, 50, 75, 100, world)'
teleportto Teleports the entity to the location of another targeter ?player|?entity ?player|?entity|?block - 'teleportto(?player, ?entity)'
time Sets the time in the world {MORNING,NOON,NIGHT} - 'time(NIGHT)'
sudo Executes a command as a target entity (replaces player targeter with player name and entity targeter with entity UUID or player name) ?player|?entity {command} - 'sudo(?player, gamemode creative)'
dropitem Drops a vanilla minecraft item at the location of the target ?player|?entity|?block {material} {amount} - 'dropitem(?player, DIAMOND_SWORD, 3)'
dropcustomitem Drops a innovative custom item at the location of the target ?player|?entity|?block {item name} {amount} - 'dropcustomitem(?player, blood-blade, 1)'
explode Creates an explosion at the target location ?player|?entity|?block {power/yield} {should break blocks} - 'explode(?player, 4, false)'
shootprojectile Fires a projectile the way the executing player is facing {projectile type} - 'shootprojectile(WITHER_SKULL)'
setequipmentslot Sets the equipment slot on the provided player ?player|?entity {item name or material} {HAND,OFFHAND,HEAD,CHEST,LEGS,FEET} {is custom item} - 'setequipmentslot(?player, DIAMOND_HELMET, HEAD, false)'
lunge Causes the entity to jump towards the direction they are facing ?player|?entity {multiplier} - 'lunge(?player, 1.5)'
removeeffect Removes a potion effect from an entity ?player|?entity {name of effect} - 'removeeffect(?player, SLOW)'
setblock Changes the material of the block at the provided location {x} {y} {z} {world name} {material} - 'setblock(0, 0, 0, world, BEDROCK)'
setblockat Changes the material of the block at the location of the provided targeter ?player|?entity|?block {material} - 'setblockat(?player, AIR)'
setexperience Sets the experience of the provided player (not in levels) ?player|?entity {amount that is >= 0} - 'setexperience(?player, 4)'
addexperience Changes the experience of the provided player (not in levels) ?player|?entity {amount} - 'addexperience(?player, -3)'
modifydurability Changes the durability of an item in the specified slot ?player|?entity {amount} {HAND,OFFHAND,HEAD,CHEST,LEGS,FEET,ALL} {should set durability or add} - 'modifydurability(?player, -1, HAND, false)'
jsonmessage Sends a json message to the player ?player|?entity {message with color codes} {text hover message with color codes or null for no hover message} {click action} {action value, for example, the command you want to run} - 'jsonmessage(?player, &d&l&oRunic Realms, null, OPEN_URL, https://runicrealms.com/)'
gills Changes amount of time left until a player starts to drown ?player|?entity {ticks} - 'gills(?player, 20)'
setyaw Sets the yaw of the player ?player|?entity {yaw value} - 'setyaw(?player, 90)'
setpitch Sets the pitch of the player ?player|?entity {pitch value} - 'setpitch(?player, 90)'
addscoreboardtag Adds a persistent scoreboard tag on the target entity ?player|?entity {tag name} - 'addscoreboardtag(?player, has_eaten_apple)'
removescoreboardtag Removes a persistent scoreboard tag on the target entity ?player|?entity {tag name} - 'removescoreboardtag(?player, has_eaten_apple)'
setinvulnerable Gives the specified entity invulnerability for the provided amount of time ?player|?entity {time in ticks} - 'setinvulnerable(?player, 20)'
loop Repeatedly executes another ability with a trigger that has at least the same targeters a set number of times {ability name} {number of repeats, must be >0} - 'loop(test-ability, 2)'
nearby Executes an ability for each nearby entity within the given radius around the origin (the ?entity targeter can be used) ?player|?entity|?block {radius} {ability name} - 'nearby(?player, 10, test-ability)'
summon Summons the provided entity at the location of the targeter ?player|?entity|?block {entity type} - 'summon(?player, VILLAGER)'