Placeholders
Overview
Placeholders are dynamically replaced when a script is executed and depend on the sender, and the user who is executing the script.
Usage:
- The basic usage is to just put a {placeholder} in your script e.g. {player}
- For non functional placeholders you can add modifiers which change which player you are referring to:
e.g. {group:Empire92} would get the group of me rather than whoever is executing
- Functional placeholders usually have multiple modifiers you can use.
MORE INFORMATION ON SCRIPTING COMING SOON!
Common Modifiers:
Modifiers are used to alter the perspective from which a placeholder is evaluated from
Modifier | Description | Example |
---|---|---|
username | Has a placeholder evaluate as a different player | e.g. {money:Notch} |
worldname | Changes the world to evaluate with | e.g. {time:world1} |
list | A list is anything seperated by commas "," | e.g. {index:a,b,c:0} will return a |
node | A node is anything seperated by a period "." | e.g. {hasperm:essentials.build} |
*location | Sets the location to evaluate with | A location can be a player, a world or a set of coords e.g. W,X,Y,Z Where W=the world e.g {biome:world1,15,30,26} |
*Offline users will be introduced in version 0.5.0 - this means you can get the location or held item etc of an offline player.
Basic Placeholders
* indicates an optional placeholder
Player Stats | Modifiers | Explanation | ||
---|---|---|---|---|
{player} | *username | Returns the players name. | ||
{sender} | Returns the original player who called the script | |||
{display} | *username | Returns the player's nickname | ||
{money} | *username | Returns a player's money | ||
{prefix} | *username | Returns a player's prefix | ||
{suffix} | *username | Returns a player's suffix | ||
{clicks} | *integer | Returns the number of times the user has clicked the sign | ||
{group} | *username | Returns a player's group | ||
{x} | *username | Returns the x value of a user | ||
{y} | *username | Returns the y value of a user | ||
{z} | *username | Returns the z value of a user | ||
{lvl} | *username | Returns a player's XP level | ||
{exhaustion} | *username | Returns the player's exhaustion | ||
{health} | *username | Returns the player's health | ||
{exp} | *username | Returns a player's experience | ||
{hunger} | *username | Returns a player's hunger | ||
{air} | *username | Returns a player's air | ||
{grounded} | *username | Returns true if the player is on the ground | ||
{passenger} | *username | Returns the vehicle the player is in or false | ||
{maxhealth} | *username | Returns a player's max health | ||
{maxair} | *username | Returns a player's max air | ||
{gamemode} | *username | Returns the player's gamemode | ||
{direction} | *username | Returns the player's facing direction | ||
{biome} | *location | #Returns the biome at the player's location | ||
{itemname} | *username | Returns the item a player is holding | ||
{itemid} | *username | Returns the ID the player is holding | ||
{itemamount} | *username | Returns the number of items a player is holding | ||
{durability} | *username | Returns the item durability for what a player is holding | ||
{dead} | *username | Returns true/false if player is alive/dead | ||
{sleeping} | *username | Returns true if player is using a bed | ||
{whitelisted} | *username | Return true if player is whitelisted | ||
{operator} | *username | Returns true if the player is Op | ||
{sneaking} | *username | Returns true if the player is sneaking | ||
{itempickup} | *username | Returns true if a player can pick up items | ||
{flying} | *username | Returns true if the player is flying | ||
{blocking} | *username | Returns true if the player is blocking | ||
{firstjoin} | *username | Returns the timestamp (seconds) for when the player joined | ||
{age} | *username | Returns the time since the player joined in seconds. | ||
{lastplayed} | *username | Returns the time since the player last played. |
Locations | Modifiers | Explanation | |
---|---|---|---|
{player} | *username | The player's name can be used as a location | |
{sender} | The sender's name can be used as a location | ||
{bed} | *username | The location of a player's bed | |
{compass} | *username | The location a player's compass points | |
{world} | *worldname OR *username | Returns the name of the world | |
{x} | *username | Returns the x value of a user | |
{y} | *username | Returns the y value of a user | |
{z} | *username | Returns the z value of a user | |
{spawn} | *worldname OR *username | Returns the location of a world's spawn | |
{hasperm:NODE} | NODE | Returns true if a player has the permission |
Note: A location is simply W,X,Y,Z - where W is the world.
{world} | *location | Returns the name of the world | |
{worldtype} | *location | Returns the type of world at a location(e.g. FLAT, AMPLIFIED) | |
{seed} | *location | Returns the seed for a world | |
{biome} | *location | Returns the biome at the player's location | |
{weatherduration} | *location | Returns the duration in ticks of the weather | |
{environment} | *location | Returns the environment at a location(e.g. NETHER, END) | |
{storm} | *location | Returns true if there is a storm at a location | |
{thunder} | *location | Returns true if there is thunder at a location | |
{spawn} | *location | Returns the spawn location for a world | |
{online} | *location | Returns the list of online players Optional arg of worldname | |
{animals} | *location | Returns if animals are enabled for a world | |
{monsters} | *location | Returns if monsters are enabled for a world | |
{autosave} | *location | Returns true if autosaving is enabled | |
{worldticks} | *location | Returns the time in ticks for a world | |
{time} | *location | The time (24hr) in a world | |
{time12} | *location | The time (12hr) in a world |
Server stats | Modifiers | Explanation | |
---|---|---|---|
{ip} | *username | Returns the player's IP address | |
{plugins} | Returns the list of plugins | ||
{slots} | Returns the max slots on the server | ||
{port} | Returns the port the server is running on | ||
{version} | Returns the minecraft version | ||
{allowflight} | Returns true if flying is allowed | ||
{viewdistance} | Returns the server view distance | ||
{defaultgamemode} | Returns the server's default gamemode | ||
{autosave} | Returns true if autosaving is enabled | ||
{animals} | *location | Returns if animals are enabled for a world | |
{monsters} | *location | Returns if monsters are enabled for a world | |
{motd} | Returns the server MOTD | ||
{difficulty} | *location | Returns the difficulty for a world |
Time | Modifiers | Explanation | ||
---|---|---|---|---|
{firstjoin} | *username | Returns the timestamp (seconds) for when the player joined | ||
{age} | *username | Returns the time since the player joined in seconds. | ||
{lastplayed} | *username | Returns the time since the player last played. | ||
{worldticks} | *location | Returns the time in ticks for a world | ||
{time} | *location | The time (24hr) in a world | ||
{time12} | *location | The time (12hr) in a world | ||
{epoch} | Returns the seconds since the epoch | |||
{epochmilli} | Returns the milliseconds since the epoch | |||
{epochnano} | Returns the nanoseconds since the epoch |
Lists | Modifiers | Explanation | |
---|---|---|---|
{online} | Returns the list of online players | ||
{playerlist} | Returns the whole list of players | ||
{plugins} | Returns the list of plugins | ||
{worlds} | Returns the list of worlds | ||
{gamerules} | Returns the list of gamerules | ||
{banlist} | Returns the list of banned players | ||
{baniplist} | Returns the list of banned IPs | ||
{operators} | Returns the list of operators | ||
{whitelist} | Returns the whitelist | ||
{range:X} | X | Returns a list from 0 to X | |
{range:X,Y} | X, Y | Returns a list from X to Y | |
{index:LIST:INDEX} | LIST, INDEX | Returns the item at INDEX in a list | |
{split:LIST:DELIMETER} | LIST, DELIMETER | Splits a string by a specified delimeter | |
{randchoice:LIST} | LIST | Returns a random choice from a list | |
{length:LIST} | LIST | Returns the length of the list | |
{setindex:LIST:INDEX:VALUE} | LIST, INDEX, VALUE | Returns a new list with the item set at index | |
{delindex:LIST:INDEX:VALUE} | LIST, INDEX, VALUE | Returns the list with the item deleted at the index | |
{getindex:LIST:VALUE} | LIST, VALUE | Returns the index for an item in the list | |
{listhas:LIST:VALUE} | LIST, VALUE | Returns true if a list contains a value | |
{contains:STRING:VALUE} | STRING, VALUE | Returns true if a string contains a value | |
{sublist:X:Y} | X, Y | Returns a new list from index X to index Y | |
{listreplace:VALUE:VALUE2} | VALUE, VALUE2 | Returns a new list with occurrences of VALUE replaced with VALUE2 | |
{count:LIST:VALUE} | LIST, VALUE | Returns the number of times a value appears in a list |
Note: a list is just entries seperated by a comma e.g. 1,2,3
Scripting | Modifiers | Explanation | |
---|---|---|---|
{js:SCRIPT} | The javascript function is very powerful and can do anything you can do in javascript | Examples {js:(new Date()).getTime()} | |
{js:file.js} | Executes a javascript file | Examples {js:test.js} Javascript files are located in the scripts folder for the plugin | |
{elevated} | Returns true if the script is elevated | ||
{line} | Returns the current script line | ||
{rand:X} | X | Returns a random number between 0 and X | |
{matchgroup:STRING} | STRING | Returns the closest matching group (useful to getting the case right) | |
{matchplayer:STRING} | STRING | Returns the closest matching online player | |
{substring:X:Y} | X, Y | Returns part of the string from index X to index Y | |
{replace:VALUE:VALUE2} | VALUE, VALUE2 | Returns a new string with occurrences of VALUE replaced with VALUE2 | |
{config:NODE} | NODE | Returns the value from the config for the given node | |
{MSG:ID} | ID | Returns the given message from the language file |
Comments