Updated Advanced Scripts (markdown)

BlitzGamer-88 2020-08-11 14:20:44 +03:00
parent 431400f2f4
commit b532a52f03

@ -36,6 +36,26 @@ Placeholders could also be used as arguments. Instead of using %placeholder% you
Example (assuming the identifier is called _check_):
- `%javascript_check_{vault_rank}%` would check if the player has the a specific rank and would return something based on their rank.
`PlaceholderAPI.static.setPlaceholders()` could also be used to parse placeholders inside the javascript placeholder.
Example:
```javascript
kitName = args[0];
placeholder = "essentials_has_kit_" + kitname;
hasKit = PlaceholderAPI.static.setPlaceholders(BukkitPlayer, "%" + placeholder + "%");
function hasKit(){
if(hasKit == "yes"){
return "&aTrue";
}
return "&cFalse";
}
hasKit();
```
This example will take a kit name as an argument and check if the player has access to that kit and return True or False based on the input. It also parses the placeholder(essentials_has_kit_kitname) for the BukkitPlayer which is the player that the javascript placeholder is parsed for.
## Player Information
When a placeholder script is called, the player that is passed to the Javascript-Expansion is also passed to the placeholder script. This player can be accessed with `BukkitPlayer`. After receiving, you can access all of the [player methods](https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/Player.html) included in the Spigot API.