JavaScript Expansion Scripts - Historical

Applied By NathanG: Mar 8, 2018 at 5:04 PM

JavaScript Expansion Scripts
JavaScript Expansion Scripts
The JavaScript Expansion for PlaceholderAPI allows for expansions that wouldn't really need an entire expansion otherwise. For example, a random number or letter generator, or an expansion that sends out a random motivational message. On this page, you can find some scripts made by the community.

How to Use
  1. Install the JavaScript expansion using /papi ecloud download JavaScript
  2. Add the downloaded script file to /plugins/PlaceholderAPI/javascripts/ folder.
  3. Copy the config file code to /plugins/PlaceholderAPI/javascript_placeholders.yml

How to Contribute

  1. Make a javascript expansion!
  2. Edit this page and add your expansion using this template.
  3. (Optional) Include a download link and/or source code link.

Random Letter(top)

Author: NathanG
Description: Prints a random letter from A to Z.
Usage: %javascript_randomletter%

Code (Javascript):

function randomLetter() {
   var start = "A".charCodeAt(0);
   var random = Math.random() * 26;

   return String.fromCharCode(start + Math.floor(random));

Code (YAML):

: 'file: random_letter.js'
: 'string'

Source & Download (Right click > Save Link As...)