.jar.conf Files
Introduction
The .jar.conf file mechanism of Multicraft is a powerful tool to adapt the console parsing of the daemon to any kind of server. The available settings are already documented extensively in the default craftbukkit.jar.conf file that comes with the Multicraft package. This section focuses on the role of the individual parse_* sections and some advanced mechanisms.The portion of the console matched by a [parse_*] section is called a block, it can be a single console line or multiple lines that belong to the same parse block. Each parse block represents a block of information or a console event.
Optional (User Selectable) Server Startup Parameters
The sections [params], [params1] to [params4] define additional command line parameters that can be enabled/disabled in the panel.Each section replaces one of the {PARAMS} variables in the command line.
Example
[start] command=java {PARAMS} -jar server.jar {PARAMS1} [params] param1 = -a info1 = Parameter A param2 = --b=Test info2 = Parameter B [params1] param1 = -cThis defines three optional parameters, two for {PARAMS} and one for {PARAMS1}. The information text is optional. These parameters can now be enabled in the panel. If none is enabled the command line will be:
java -jar server.jarIf all are enabled the command line will be:
java "-a" "--b=Test" -jar server.jar "-c"
Up to 4 additional sections can be defined, each with up to 20 parameters:
[params1] [params2] [params3] [params4]
Force Server Settings or Use Different Server Config File
By default Multicraft will edit the server.properties file before the server starts up to enforce the settings for IP, port, players and world name. This can be customized in the [force_config] section of .jar.conf files.The configuration file to edit can be changed and you can add up to 19 settings that should be overridden using a combination of search/replace entries. The default craftbukkit.jar.conf file that comes with Multicraft has this feature documented in the comments.
Available Parse Blocks
Section | Description |
---|---|
parse_startup | When this parse block matches the server is considered fully started and the server status changes to online in the panel |
parse_players | This block parses the player list and sends this information to the panel. It is also used to check if the server is still responding depending on the settings in the panel |
parse_chat | This block matches chat lines and splits the line into source, sender and message |
parse_command | This block matches attempts by players to run a server command |
parse_connect | Parses a player connect event and adapts the player list in the panel accordingly. Also runs the motd panel command for this player |
parse_disconnect | Parses a player disconnect event and adapts the player list in the panel accordingly |
parse_saveComplete | Detects a world save event and announces it to the players if this is enabled in the panel |
parse_unknown | Matches the unknown command message. This is used for servers that don't implement the list command so they can still be considered as online when known console output is used to detect the online status |
parse_hide | Console lines matched by this block are hidden from the console in the panel |
parse_log | This special block is run against each console line and splits the line into "time stamp", "type" and "line" parts. All other parse blocks (except for parse_clean) only match against the "line" part of a console line. |
parse_clean | Matching parts of a console line are removed to clean up the line |
parse_restart | If a console line matches this block then the server will be restarted. Empty by default |
parse_stop | If a console line matches this block then the server will be stopped. Empty by default |
Parse Block Settings
Each [parse_*] section can contain the following settings:Setting | Type | Default | Description |
---|---|---|---|
start | regex | If a console line matches this regex it is considered the start of the block (or the entire block depending on the other settings) | |
shortStart | regex | A short version of the "start" setting to filter out lines that cannot match "start". This is for performance reasons only. | |
isList | boolean | false | If this is set to true the matched data will be treated as a list of multiple entries. By default this list will be split at ",", this can be overridden using the listSplit setting. |
listSplit | regex | \s*,\s* | The regex used to split a list, by default 0 or more whitespaces followed by a "," followed by 0 or more whitespaces. |
listLine | regex | The regex used to parse individual entries of a list. Currently only used for the player list to mark entries as player names. | |
data | regex | This regex is used to match the lines after "start" has matched. Each matching line is considered part of the current block. Currently only used for some types of player lists. | |
skip | regex | When a line matches the "skip" regex it is not used in the active block but the block still continues. | |
end | regex | When a line matches the "end" regex the current block is considered complete. | |
echo | boolean | false | By default a matched line will not be printed to the console. If "echo" is "true" the line will still be shown. |
important | boolean | false | When the console is exceeding the allowed number of lines per second new lines will not be parsed. Blocks with the "important" setting set to "true" will still parse lines even if the console is exceeding the limit. |
maxLines | integer | 1 | The maximum number of lines this block can match, used for multiline blocks only (a log entry that always spans multiple lines). Can be overridden using regex variables (see below). |
maxDataLines | integer | -1 | The maximum number of data lines this block can match. Data lines are player names in a multi-line player listing for example. Can be overridden using regex variables (see below). |
maxTime | integer | 1000 | The maximum amount of time (in ms) a multiline block can wait for new lines. This is to prevent one block consuming all console lines when it doesn't close correctly. |
trigger | regex | Blocks with a "trigger" regex will only be active after "trigger" has matched a command sent to the server. The "triggerLines" and "triggerTime" settings control how long the block will stay active. An inactive block will never match (i.e. the "start"/"shortStart" regex will not be looked for in console lines). | |
triggerLines | integer | 5 | The number of console lines this block will stay active for when triggered. See the "trigger" setting. |
triggerTime | integer | 1000 | The amount of time in ms this block will stay active for when triggered. See the "trigger" setting. |
Alternative settings
The following settings also support multiple alternatives: start, data, skip Multiple start regex can be specified like this for example:[parse_disconnect] start=^(?P<name>.+)\slost connection:\s*(?P<reason>.*)$ start1=^CONSOLE:\s*Kicking\s(?P<name>.+)$ start2=Kicked\s(?P<name>.+) from the game\s*$
Additional Settings Using Variables
When matching a line certain parts of that line can be used to override some of the above settings. For example:start=^There are (?P<v_maxDataLines>\d+)/\d+ playersThis will set the maxDataLines setting to the number of players that are currently on the server. That way the player list is complete after the correct number of lines and any further lines will not mistakenly be treated as player names.
Available variables
Variable name | Type | Description |
---|---|---|
v_maxDataLines | integer | The number of data lines this block can match. See the example above |
v_maxLines | integer | The number of lines this block can match in total |
v_listStr | string | Sets the list string to the matched text. Useful if the list data is only a part of a line. |
v_listStr_append | string | The matched text will be appended to the current list string. Useful if the list string is multiple lines long |
Troubleshooting
In the [settings] section of the .jar.conf file you can enable several debug settings that can help troubleshoot parsing issues. All debug output will be printed to the multicraft.log file.Setting | Description |
---|---|
debugParse | Dumps all [parse_*] section settings when the server starts |
debugRawLine | Prints each line exactly the way it was received from the server without any cleanup or parsing |
debugCleanLine | Prints each line after applying the parse_clean block |
debugParseLine | Prints each line after applying the parse_log block. All other parse blocks will be applied to the console line in this state |
Default Settings
[parse_startup] start=^\s*Done important=true [parse_players] listSplit=\s*,\s* listLine=(?P<name>.*) start=^(?:Connected\s*players|Online \([\d]+[^)]*\)):\s*(?P<v_listStr_append>.*)$ start1=^There are (?P<v_maxDataLines>\d+)/\d+ players data=^(?P<v_listStr_append>.+)$ trigger=list important=true isList=true maxLines=2 maxDataLines=0 [parse_chat] start=^(?P<source>\[[^\]]+\])?\s*<(?P<sender>[^>]*)>\s*(?P<message>.*)$ [parse_command] shortStart=(?:tried|issued server) command start=^(?P<sender>.+)\s(?:tried|issued\sserver)\scommand:\s*(?P<command>.*)$ important=true [parse_connect] shortStart=logged in with entity id \d+ at start=^(?P<name>.+?)\s*\[/(?P<ip>[^\]:]*)(:?(?P<port>[0-9]+)?)\]\s*logged in start1=^(?P<name>.+)(?P<ip>\s+)logged in [parse_disconnect] shortStart=(lost connection|Kick(ing|ed)) start=^(?P<name>.+)\slost connection:\s*(?P<reason>.*)$ start1=^CONSOLE:\s*Kicking\s(?P<name>.+)$ start2=Kicked\s(?P<name>.+) from the game\s*$ [parse_saveComplete] start=^CONSOLE:\s+Save complete. [parse_unknown] start=^Unknown console command #hide from server console [parse_hide] start=^(There are |\d+ players are|Connected players) #split each line into time, type and actual log entry [parse_log] start=^(?P<time>(:?[-\d]+ )?\[?[:\d]+\]?)\s+\[?(?P<type>[^]]+)\]\:?\s+(:?\[(:?Minecraft-)?(:?Server)\]\s+)?(?P<line>.*)$ #cleanup each line before parsing, remove coloring, backspace characters, etc. [parse_clean] start=(^[>\r\s]+|\x1b\[[0-9;]*m|\b) [parse_restart] start= [parse_stop] start=
Examples
Parse Block
[parse_players] trigger=list start=^There are (?P<v_maxDataLines>\d+)/\d+ players data=^(?P<v_listStr_append>.+)$ list=true important=true listLineRe=(?P<name>.*) maxDataLines=0
Description
The maxDataLines setting is set to 0 initially for safety. Once a "list" command has been sent to the server the "start" regex will be matched against new console lines for the next 5 lines or 1000ms (see the trigger defaults above). When "start" has matched the "maxDataLines" will be set to the player count and the "data" regex will be used to match the following lines and append them to "listStr".Once "data" doesn't match anymore or we have reached "maxDataLines" number of lines the block will be completed and the list string will be split using the default "listSplit" setting.
Parse Block
[parse_players] trigger=list start=Online \([\d]+[^)]*\)):\s*(?P<v_listStr>.*)$ list=true important=true listLineRe=(?P<name>.*)
Description
The "start" regex matches the line and fills the list string directly.Parse Block
[parse_chat] start=^(?P<source>\[[^\]]+\])?\s*<(?P<sender>[^>]*)>\s*(?P<message>.*)$
Description
The "start" regex matches the line and fills in the three special variables of the chat section: source, sender and messageParse Block
[parse_players] trigger = status start = ^players\s*:\s*(?P<v_maxDataLines>\d+) skip = ^(hostname|version|udp/ip|map)\s*:\s skip1 = ^#\s+userid\s+name\s+ data = ^#\s+\d+\s+"(?P<name>.*)"\s+[\w\d_:]+\s+[\d:]+\s+\d+\s+\d+\s+\w+\s+(?P<ip>[^:]+):(?P<port>\d+)$ maxTime = 2000 maxLines = 100 triggerLines = 10
Description
This block parses the player list of a Counter-Strike: Source server. It activates after "status" has been sent to the server. The "start" regex opens the block and sets "maxDataLines". The two "skip" regex mark unused lines so they are not counted toward the number of data lines. The "data" regex then matches each individual player line and collects the name, ip and port information for each player. The "maxTime" and "maxLines" settings are there for safety so a mismatch in the console output does not block console parsing for too long.Parse Block
[parse_restart] start = ^Some restart condition