API

NOTE: This API is not implemented till v1.4

The broadcast++ API

what can it do

The broadcast++ api is used to create automatic broadcasts, and send single broadcasts from different plugins.
The automatic broadcasters can be made using a file it will read from, or a messages array.
There is also the ability to change the messages that should be broadcasted in the auto broadcaster, or add a new one at the end of the line.
although, this isn't needed if you use a file to broadcast the messages.
The broadcasts will all be run through the message customizer and the prefix, suffix, etc will all be saved in the broadcast class.
It is also possible to get the customized message and values from the given message.

How to use

to send just one message as a broadcast
BcAPI.sendNewBroadcast( <message> );

where <message> will be the message that will be broadcasted. The message will get default prefix and suffix added, and it will be run through the message customizer, so you will be able to use prefix, suffix, time etc in the message.

To start a new auto broadcast, and use a file to read the messages from
BcAPI.startNewAutoBroadcast( <name>, <messageFile> );

Where <name> will be the name of the auto broadcaster, and you will need to use that name to use the other methods. and <messageFile> will be the file used to read the messages from.
This will also be run through the message customizer, and a default prefix and suffix will be added if nothing specified. also the first message can contain defaults, to be used in the whole file.
it will return true if the auto broadcaster is created successfully, and false if the name you specified is already in use

To start a new auto broadcast, and use a messages array as the broadcasted messages
BcAPI.startNewAutoBroadcast( <name>, <messages> );

Where <name> will be the name of the auto broadcast you will need to use that name to use the other methods. and <messages> is the array filled with the messages it will broadcast.
This will also be run through the message customizer, and a default prefix and suffix will be added if nothing specified. also the first message can contain defaults, to be used in the whole array.
it will return true if the auto broadcaster was created successfully, and false if the name you specified is already in use

to stop the auto broadcaster
BcAPI.stopAutoBroadcast( <name> );

where <name> will be the name specified when creating the auto broadcaster.
it will return true if the auto broadcaster was stopped successfully, and false if it was already stopped, or if it wasn't even created

to add a message to an existing broadcast
this will only be able to use when the broadcast was created with a messages array, else you can add the message to the file
BcAPI.addToBroadcast( <name>, <message> );

where <name> is the name specified when creating the auto broadcaster. and <message> is the message that should be added at the end of the other messages. it will return true when it is successfully added, else false

to change all broadcast messages
this will only be able to use when the broadcast was created with a messages array, else you can change the file
BcAPI.changeBroadcastMessages( <name>, <messages>, <continueFromLastLine> );

where <name> is the name specified when creating the auto broadcaster. and <messages> is the messages array that should replace the old messages array. and <continueFromLastLine> is either if the auto broadcaster should continue from the last broadcasted line, or if it should restart from the beginning.
it will return true if the old messages array was successfully replaced by the new one, else false.

to get the customized message
this will only be able to use when the broadcast was created with a messages array
BcAPI.getCustomizedMessage( <message> );

where <message> is the message you want the customized values from.
it will return a map containing all values, used keys are: "message", "prefix", "suffix", "time", "permission", "world", "option", if it was unable to get customized values, it will return a map containing the old message under key "message"


Comments

Posts Quoted:
Reply
Clear All Quotes