new Broadcast()
Methods
-
static at(source, message, wrapWidth, useColor, formatternullable)
-
Parameters:
Name Type Attributes Default Description sourceBroadcastable Target to send the broadcast to
messagestring wrapWidthnumber | boolean false width to wrap the message to or don't wrap at all
useColorboolean true Whether to parse color tags in the message
formatterfunction <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 sourceBroadcastable messagestring excludesArray.<Player> wrapWidthnumber | boolean useColorboolean formatterfunction - 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 sourceBroadcastable messagestring formatterfunction wrapWidthnumber | boolean useColorboolean - 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 widthnumber messagestring colorstring fillCharstring <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 messagestring indentnumber Returns:
string -
static line(width, fillChar, colornullable) → {string}
-
Render a line of a specific width/color
Parameters:
Name Type Attributes Default Description widthnumber fillCharstring - colorstring <nullable>
null Returns:
string -
static progress(width, percent, color, barChar, fillChar, delimiters) → {string}
-
Generate an ASCII art progress bar
Parameters:
Name Type Default Description widthnumber Max width
percentnumber Current percent
colorstring barCharstring # Character to use for the current progress
fillCharstring Character to use for the rest
delimitersstring () 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 playerPlayer extraobject extra data to avail to the prompt string interpolator
wrapWidthnumber useColorboolean -
static sayAt()
-
Broadcast.atwith a newline- See:
-
Broadcast#at
-
static sayAtExcept()
-
Broadcast.atExceptwith a newline- See:
-
Broadcast#atExcept
-
static sayAtFormatted()
-
Broadcast.atFormattedwith 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 messagestring widthnumber <nullable>
80 Defaults to 80
Returns:
string