Bungee Support - CodedRed-Spigot/PlayTimes GitHub Wiki

Bungee & SQL Support

We are excited to announce that as of February 20, 2024, our plugin now supports multi-server setups through Bungee with MySQL integration. While MySQL is recommended and fully tested, generic SQL support is available but has not been extensively verified.

Setting Up Multi-Server Support

Follow these steps to enable multi-server support for your plugin:

  1. Navigate to the database.yml configuration file within your plugin's directory.
  2. Locate the database-settings section and change enabled to true to activate database integration.
  3. Fill in your database information:
    • Type: Use "mysql" for MySQL databases. You can switch to "sqlite" if you prefer SQLite, although this is primarily designed for MySQL.
    • Database: Specify the name of your database, e.g., "playtimes".
    • Host: The database host, typically "localhost".
    • Port: The port your database uses, usually 3306 for MySQL.
    • User & Password: Your database login credentials.
    • useSSL: Set to false unless your database connection requires SSL.
  4. Assign a unique serverId for each server. This identifier is crucial for differentiating playtime data across servers. Ensure that each server setup has a distinct serverId.

Thank you for your patience and support as we continue to improve and expand our plugin's capabilities!

Configuration Details (database.yml)

The database.yml file is structured as follows:

database-settings:
  enabled: false  # Enable or disable database use
  type: "mysql"   # Database type ('mysql' or 'sqlite')
  database: "playtimes"  # Database name
  host: "localhost"  # Database host
  port: 3306  # Database port
  user: "root"  # Database username
  password: "password"  # Database password
  useSSL: false  # SSL connection toggle
  serverId: "survival"  # Unique server identifier

purge-database:
  enabled: false  # Enable or disable data purging
  months: 12  # Age in months after which data is purged
  • IMPORTANT: Each server running PlayTimes must have a unique serverId. This ID not only segregates data but is also utilized in placeholders for displaying server-specific statistics.

Placeholders

Placeholders allow the integration of playtime data into your server's plugins and interfaces:

  • Plugin Use:

    • %rawtime_serverId% - The total time spent on the server.
    • %afktime_serverId% - The time spent AFK (Away From Keyboard) on the server.
    • %playtime_serverId% - The active playtime on the server (rawtime minus afktime, if afk is enabled).
    • %global_playtime% - The total playtime from all servers.
    • %global_rawtime% - The total rawtime from all servers.
    • %global_afktime% - The total afktime from all servers.
  • For PlaceholderAPI (PAPI) Integration:

    • %PlayTimes_rawtime_serverId%
    • %PlayTimes_afktime_serverId%
    • %PlayTimes_playtime_serverId%
    • %PlayTimes_global_playtime%
    • %PlayTimes_global_rawtime%
    • %PlayTimes_global_afktime%

Remember to replace serverId with your actual server ID (e.g., %playtime_survival%) to retrieve the correct data for each server. Global placeholders grab the time for all servers in database.