FrogAnnounce

miscellaneousExplanations

This page gives special instructions to do things with FrogAnnounce. There are several things that you may not know a lot about Java or YAML, so I've created this page to explain these things.

Escape Sequences (Using ", ', and more in YAML configuration files)

Almost every plugin for Bukkit uses the YAML configuration system, a system written by the nice people at SnakeYAML (not by Bukkit - but implemented into it by the Bukkit developers). This system is nice and all; however, there are some flaws. It's a sequential access file (SAF) where values are stored in your server's memory once the values in the configuration is read. This means that if you have tons of extra data, such as a tree that the plugin you're using doesn't use, you'll use more RAM than intended! This is a SnakeYAML flaw, and is unpreventable.

Now, if you've ever tried putting quotation marks or an apostrophe into FrogAnnounce, or perhaps a backslash (\), then chances are, you received an exception from it. That's because in Java, the language that those values are parsed into, all of these characters (and more) are used for functions within the language (such as literal constants (Strings, like String s = "Moofrogs";) and such).

The solution to this is simple: use what we call an escape sequences. Below is a table of all Java escape sequences and a description of what they do.

Escape SequenceDescription
\\Inserts a backslash ( \ ) at this point.
\"Inserts a quotation mark ( " ) at this point.
\'Inserts an apostrophe ( ' ) at this point.
\tInsert a tab in the text at this point.
\bInsert a backspace at this point.
\nInsert a newline at this point.
\rInsert a carriage return at this point.
\fInsert a line feed at this point.

Now, the explanation of how to use them...

An example of escape sequence usage is this:

Text: 'This is an \"announcement,\" carried out by \'FrogAnnounce.\' '

Putting that line of YAML into the FrogAnnounce root configuration section would cause the announcer to output:

This is an "announcement," carried out by 'FrogAnnounce.'

As shown above, entering an escape sequence will just make the plugin replace \" with " and \' with '. Using this method, anything you want can be output to your players - besides graphics, of course!

You must login to post a comment. Don't have an account? Register to get one!

Facts

Date created
Feb 14, 2013
Last updated
Dec 09, 2013

Author