new Broadcast()
Methods
-
static at(source, message, wrapWidth, useColor, formatternullable)
-
Parameters:
Name Type Attributes Default Description source
Broadcastable Target to send the broadcast to
message
string wrapWidth
number | boolean false width to wrap the message to or don't wrap at all
useColor
boolean true Whether to parse color tags in the message
formatter
function <nullable>
null Function to call to format the message to each target
-
static atExcept(source, message, excludes, wrapWidth, useColor, formatter)
-
Broadcast.at for all except given list of players
Parameters:
Name Type Description source
Broadcastable message
string excludes
Array.<Player> wrapWidth
number | boolean useColor
boolean formatter
function - See:
-
Broadcast#at
-
static atFormatted(source, message, formatter, wrapWidth, useColor)
-
Helper wrapper around Broadcast.at to be used when you're using a formatter
Parameters:
Name Type Description source
Broadcastable message
string formatter
function wrapWidth
number | boolean useColor
boolean - See:
-
Broadcast#at
-
static center(width, message, color, fillCharnullable) → {string}
-
Center a string in the middle of a given width
Parameters:
Name Type Attributes Default Description width
number message
string color
string fillChar
string <nullable>
Character to pad with, defaults to ' '
Returns:
string -
static indent(message, indent) → {string}
-
Indent all lines of a given string by a given amount
Parameters:
Name Type Description message
string indent
number Returns:
string -
static line(width, fillChar, colornullable) → {string}
-
Render a line of a specific width/color
Parameters:
Name Type Attributes Default Description width
number fillChar
string - color
string <nullable>
null Returns:
string -
static progress(width, percent, color, barChar, fillChar, delimiters) → {string}
-
Generate an ASCII art progress bar
Parameters:
Name Type Default Description width
number Max width
percent
number Current percent
color
string barChar
string # Character to use for the current progress
fillChar
string Character to use for the rest
delimiters
string () Characters to wrap the bar in
Returns:
string -
static prompt(player, extra, wrapWidth, useColor)
-
Render the player's prompt including any extra prompts
Parameters:
Name Type Description player
Player extra
object extra data to avail to the prompt string interpolator
wrapWidth
number useColor
boolean -
static sayAt()
-
Broadcast.at
with a newline- See:
-
Broadcast#at
-
static sayAtExcept()
-
Broadcast.atExcept
with a newline- See:
-
Broadcast#atExcept
-
static sayAtFormatted()
-
Broadcast.atFormatted
with a newline- See:
-
Broadcast#atFormatted
-
static wrap(message, widthnullable) → {string}
-
Wrap a message to a given width. Note: Evaluates color tags
Parameters:
Name Type Attributes Default Description message
string width
number <nullable>
80 Defaults to 80
Returns:
string