Docs » API reference » Messages

Messages

Telling players things: notices by the watch, large banners, floating labels in the world and sounds.

VoxelMon has no text chat, so this is how a plugin speaks to players. Text can use English letters, numbers and common punctuation, and anything else shows as ?. A notice is short and fades. A banner is large and brief, like a dungeon's name when a player enters it. A label stays where it is put.

You get one from server.messages(), and the same calls on a Player.

Methods

MethodDescription
fn notice(&self, player: Player, text: &str) -> Result<()>void notice(Player player, String text)A short notice by their watch, with a soft sound (at most 80 letters).
fn notice_all(&self, text: &str) -> Result<()>void noticeAll(String text)A notice to every player.
fn banner(&self, player: Player, banner: Banner) -> Result<()>void banner(Player player, Banner banner)A banner before them.
fn banner_all(&self, banner: Banner) -> Result<()>void bannerAll(Banner banner)A banner before every player.
fn label(&self, place: Place, lines: Vec<String>) -> Result<Label>Label label(Place place, List<String> lines)Text floating in the world, turned to each viewer (at most 4 lines of 32 letters).
fn play_sound(&self, place: Place, sound: Sound) -> Result<()>void playSound(Place place, Sound sound)A sound heard by players near it, from there.

Label

Floating text a plugin placed.

A handle to something in the game. Once that thing is gone, its calls fail with Gone.

MethodDescription
fn set_lines(&self, lines: Vec<String>) -> Result<()>void setLines(List<String> lines)Changes its text.
fn move_to(&self, place: Place) -> Result<()>void moveTo(Place place)Moves it.
fn set_reach(&self, blocks: f64) -> Result<()>void setReach(double blocks)How far off it can be read, in blocks (8 to 48, 16 until set; it fades out over 4 blocks beyond).
fn remove(&self) -> Result<()>void remove()Takes it away.

A large title and a smaller line, shown for a few seconds.

Plain data, copied between the server and the plugin.

FieldDescription
title: StringString title()The large line (at most 32 letters).
subtitle: StringString subtitle()The smaller line under it (at most 48 letters).
colour: ColourColour colour()The title's colour.
seconds: f64double seconds()How long it shows, 1 to 10.

Sound

One of the game's sounds, by name, with a volume and a pitch.

Plain data, copied between the server and the plugin.

FieldDescription
name: StringString name()The sound's name; the list is in the server's sounds command.
volume: f64double volume()0 to 1.
pitch: f64double pitch()0.5 to 2; 1 as recorded.