Turret Language is an alternative to YAML (YAML Ain't Markup Language or Yet Another Markup Language) with several differences that should help the plugin developers to create more user-friendly configuration files. Please note that TurretLang is not a plugin itself, but just a Bukkit-related API.
TurretLang is designed to read plugin configuration files. Unlike YAML, it supports all Unicode chars (except those restricted (see "Restricted characters")) and holds all the data String-wise.
Currently the language supports String, byte, short, int, long, float, double, char, File, Object, String[] and Map<String, String> objects and use of special characters directly in the file (e.g. a variable can include a space char in its name). However, there is currently no support for configuration sections. As well there exists no way to change the configuration without modifying the sourcefile, but this possibility is in the todo list.
There are quick methods to reload the configuration, as a it is attached to its sourcefile.
All TurretLang files have a very simple structure:
This is a line:with a variable" will be considered a variable named "This is a line" with value "with a variable".
Apart from all that, in variable declarations special syntax can be used to mark arrays (String[]), maps (Map<String, String>) and even Objects. In this language, any map is an array with specially encoded values.
An example array:item0;item1;item2" will be considered an array {"item0", "item1", "item2"}. If no semicolon appears the "normal" value is considered to be the only element of an array.
Map:first key@a value;second key@a value with an @ sign;third key with an empty value@" will be considered the following map:
"first key" -> "a value" "second key" -> "a value with an @ sign" "third key with an empty value" -> ""
Object, data is separated by asterisks (*). Any Object declaration begins with the complete name of the class that is followed by the arguments to pass while instantiating. When var.getValueAsObject() is used, a public constructor savedClass(String[] arguments) is called and the resulting Object is returned. Note that even if the Object does not require any arguments the rules above must be followed. So YourClass with several arguments may be stored as "com.yourPackage.YourClass*Argument 1*Argument 2" while AnotherClass that does not require any arguments is represented as "com.yourPackage.AnotherClass*" (unlike in arrays and maps, an asterisk is required even if there are no arguments to pass).
Note: these characters are not actually restricted but will cause an unexpected behavior when loaded.
wrong;syntax" will be red as {"wrong", "syntax"}). However, this does not influence String value as it is always provided as in declaration.
wrong@key declaration@value" will be red as "wrong" -> "key declaration@value").
\n) cannot be used anywhere as it will split declarations.
If the usage of any of these characters is unavoidable, plugins should use combinations manually: var.getValue().replaceAll(" The option to replace combinations by restricted characters at low-level processing is in todo list.\\n", "\n")
No bugs are currently discovered.
Please note that there has not been suffcient testing yet; if you find any glitch please me about it.
Are you running any plugin using TurretLang configurations? Here's a Newcomer's Guide to The Turret Language Configuration Files:
Q: How to change a setting?
\plugins\%pluginName%\config.tlc) with any text editor tool (like Notepad++ or Wordpad)
Q: The plugin's complaining about the configuration! What's wrong?!
Q: This plugin crashes when the server launches!
The downloadable .jar file is not a Bukkit plugin; it is not supposed to be in \plugins\ folder.
Willing to develop a plugin with TurretLang configurations? The downloadable jar contains all the necessary data including the source, the documentation and an example configuration with explanations. Include it in your build and it will work!
Q: What the hell is NullableBoolean?!
It is a "wrap" for the primitive boolean type. It is returned by var.getValueAsTrueBoolean() only and has three states: true, false and null. Null signifies that such value is not a boolean.
Q: How should I name the variables?
As TurretLang supports almost all the Unicode characters in the variables' names and is actually designed to make configuration as friendly as possible, it is preferred to write names as Normal sentances. E.g. "maxPlayers: 30" in YAML may be written as "The maximum amount of players:30" in TurretLang, so that it is as self-descriptive as possible.
Finally don't forget to tell me if you wish to use Turret Language in your plugin :)