Other Functions

Other Functions

Multi-Server Universe Support

For MC universes that expand across multiple servers, it is possible to share one MySQL database between these severs, such that there is only one record of play time regardless of the server a player is using. This function REQUIRES the use of MySQL data storage option.

Setting this up is very simple. In the /ontime/config.yml file there is one parameter that needs to be set for each server.

from config.yml
# Set 'true' if running OnTime in a single-server MC environment, or if this is designated the 'primary' server in 
# a multi-server MC environment where servers are sharing one MySQL database.  In the multi-server environment there
# should be only ONE of the servers designated as 'primary'
primaryServer: true

The OnTime plugin must be installed on all of the servers, and the /ontime/config.yml files should be (for the most part) identical on each, but the above parameter must be set properly on each. As stated above, one of the universe's servers needs to be designated the primaryServer (set to true) and the rest of the servers not (set false). This will make sure that only one of the servers is updating the rollover to a new day, generating reports, etc.

For more standard, single server universes, this parameter should be set to true.

Data Import

It is possible to create a total OnTime data file from another plugin, database, or hand edited file. Currently OnTime supports import from a .yml file, and from the logblock plugin.

Import from .YML

There are a couple of options when importing data from a YML file.

Generic Format

The format of the data can be in a simple (player name , total OnTime) pairing as seen on the import.yml page.

The general format is a data pair of 'playername, time', where 'playername' is the players login ID, and 'time' is the total OnTime to be set for that player. 'time' can be in either units of seconds or milliseconds, and this choice is set within the .yml file.

This file can have any name but should have a .yml extension, and it must be placed in the /plugin/OnTime directory.

When imported, a player's 'last login' will be set to the time of the import. If players already exist in the OnTime data files, their total OnTime and last login will not change unless the administrator specifies 'replace' in the import command.

OnTime playerdata.yml format

The file can also be in the standard OnTime "playerdata.yml" format, so hence it can be a backup YML file, a delta backup file when using MySQL as the main storage, or a file from some other OnTime server.

Import from OnTime Reports

It is possible to import data from an old OnTime daily, weekly, monthly, or (total) Ontime report. When these files are used for import only the player names and total OnTime values are imported. The daily, weekly, or monthly data is not imported.

To use this function you must first make a copy of the report you want to import, and give the copy a file name which does not include any spaces. (The default OnTime reports file names contain spaces, which will cause problems with the command when executed at the console or in-game.) Once you have the report with an appropriate file name, the admin must then simply execute the following command:

/ontime import report <fileName> {[replace]}

The use of the "replace" keyword is optional. When this word is added to the end of the command, then any player data found in the report will replace any current total time data found in the OnTime player database.

When importing from reports it is important to note that only players that have logged time during the day/week/month of the report will be found in the report. So, for example, if I have not been on your server in the last week and you import data from last week's weekly report, you will not recover any data for me.

To pick up as many players as possible, you may want to consider importing multiple weeks or moths worth of reports. If you do this, you should start with the most recent reports and work backward in time. Doing so will insure you get the latest data for all players found in the reports.

Import from the logblock plugin.

It is also possible to import from the MYSQL database created by the'logblock' plugin. To perform this import the MYSQL database must first be enabled and defined via the ontime/config.yml.

from config.yml

# MySQL - This must be enabled and properly set up if MySQL is to be used for data storage and/or
# data import is to be done from another plugin MySQL table. (currently support for LogBlock is provided)
MySQL:

enable: true
host: localhost
port: 3306
user: root
password: password
database: minecraft


Once defined the import is simply an execution of the command:

/ontime import logblock


OnTime records will be created in memory for all players included in the MYSQL logblock 'lb-players' table, and the data imported includes both the total playtime, and time of their last login. If players already exist in the OnTime data, their total OnTime and last login will not change unless the administrator specifies 'replace' in the import command. (/ontime import logblock replace)

Remember to SAVE Imported Data!

For both the YML and logblock imports the data only resides in memory after the import is executed, therefore it is recommended that the administrator also execute the command '/ontime export [YML/MYSQL]' =OR= '/ontime save', to insure the data is also saved to disk.

Data Export

The data export function's main purpose is to allow administrators to move from one storage method to another within OnTime. It's also possible that this could be used to allow access to the OnTime data from other plugins. To make a conversion from one storage method to another the steps are as follows:

Example: moving from DAT to YML

  1. In the /ontime/config.yml file set the parameter: "dataStorage: DAT"
  2. Start the server
  3. From the console or in game execute: "/ontime export yml". This will create the file /plugins/OnTime/playerdata.yml, which holds all of the data found in several '.dat' files.
  4. In the /ontime/config.yml file set the parameter: "dataStorage: YML"
  5. Restart the server

Example: moving from DAT to MYSQL

  1. In the /ontime/config.yml file set the parameter: "dataStorage: DAT"
  2. In the /ontime/config.yml file set the parameter: "MySQL.enable: true"
  3. In the /ontime/config.yml file set the MYSQL parameters per definition of your MYSQL database.
  4. Start the server
  5. From the console or in game execute: "/ontime export mysql". This will create the ontime table and populate it with date pulled from the original .dat files.
  6. In the /ontime/config.yml file set the parameter: "dataStorage: MYSQL"
  7. Restart the server

Example: moving from YML to MYSQL

  1. In the /ontime/config.yml file set the parameter: "dataStorage: YML"
  2. In the /ontime/config.yml file set the parameter: "MySQL.enable: true"
  3. In the /ontime/config.yml file set the MYSQL parameters per definition of your MYSQL database.
  4. Start the server
  5. From the console or in game execute: "/ontime export mysql". This will create the ontime table and populate it with date pulled from the original playerdata.yml file.
  6. In the /ontime/config.yml file set the parameter: "dataStorage: MYSQL"
  7. Restart the server

Away From Keyboard

OnTime can be configured to track a player's 'Away From Keyboard or AFK' time. If a player takes no actions or makes no movement for a configured amount of time, OnTime will consider the player to be AFK. When 'AFK', the player's playtime will be rolled back to the time of their last activity or the time they last received an OnTime reward. (Rollback to the last reward will prevent a player from receiving the same reward twice.) While 'AFK' the player will not receive any rewards, if rewards are configured.

OnTime is integrated with the AfkTerminator plugin, which is an independent plugin which detects and can destroy AFK Machines players may be using to get past AFK detection algorithms. If the AfkTerminator configuration is set to "NONE" for the penalty, OnTime will still not count any of the time spent in the AFK Machine towards a player's recorded play time. In other words, the player will remain in the machine but will not get any credit. IF the AfkTerminator penalty is set to something that removes the player from the game, OnTime will remove any time spent in the AFK Machine from the player's total play time upon the player quit event.

Configurable Output

The file 'output.yml' pretty much holds all of the instructions needed to take advantage of the configurable output. This YML file defines the message that should be sent to the player for each different reward they receive. It also defines the content displayed to a player when they use the 'ontime' and 'ontime <playername>' commands. Now the administrator can change just how much OnTime information a player is exposed to.

The configurable output also lets the admin setup the header and colors used in the "Top xx" displays. And there are a few other configurable options in there.

If you like the default messages that come with the plugin there is no reason to ever have to edit this file, but if you do, remember it is a YML file and it is very context sensitive. Which means always remember to use 'spaces' and not 'TABs' in this document.

Reward Broadcast Messages

When rewards are issued to a player there is an output option to broadcast a message to all players online about the reward. This function can be enabled/disabled in the ontime/config.yml with the rewardBoradcastEnable plugin parameter.

Log File:

It is possible to enable a logging function which will save OnTime-based information in a file found at /plugin/ontime. There are three levels of logging messages defined within the plugin providing some configuration to the detail logged. The level used on your server is defined in the plugin config.yml.

The information provided This file will contain:

Level 3 (High Level)

  • Rewards Issued: player name, reward, reward time
  • 'set', 'add', and 'remove' commands executed
  • Error Messages: varies


Level 2 (Medium Level) (Will also include Level 3 messages)

  • Defined reward levels loaded at plugin startup: reward, reward time
  • Player data purged due to player inactivity on the server.
  • Player data purged due to too short of a total OnTime period


Level 1 (Low Level) (Will also include Level 2 and 3 messages)

  • Player login events: Timestamp, user name
  • 'Test' player login event: Name
  • Player quit events: Timestamp, user name, total OnTime
  • 'Test' player logout event: Name, total OnTime
  • Player kick events: Timestamp, user name, total OnTime
  • OnTime Rewards configured at server start: reward time, reward value
  • OnTime Rewards scheduled on player login: player name, reward value, reward issue time, reward delta time

Comments

Posts Quoted:
Reply
Clear All Quotes