misticos
Connection database for developers

Supported Games
GameServerKingsGameServerKings

Connection DB provides other plugins with specific details about players, like a timestamp of when a player last connected.

Note: If you need help, please provide details from the connectiondb.debuginfo console command.

Commands

  • connectiondb.wipe -- Clear plugin's database. (NOT OTHER PLUGINS' INFO)
  • connectiondb.debuginfo -- Print debug info.

Configuration

Default Configuration

{
  "Debug": true,
  "Time Between Self-Deletion and Last Connection (sec)": 259200
}

For Developers

Player API

List<string> API_GetNames(ulong id) // Returns null if player wasn't found
string API_GetFirstName(ulong id) // Returns null if player wasn't found
string API_GetLastName(ulong id) // Returns null if player wasn't found
List<string> API_GetIPs(ulong id) // Returns null if player wasn't found
string API_GetFirstIP(ulong id) // Returns null if player wasn't found
string API_GetLastIP(ulong id) // Returns null if player wasn't found
List<uint> API_GetTimeStamps(ulong id) // Returns null if player wasn't found
uint API_GetFirstTimeStamp(ulong id) // Returns 0 if player wasn't found
uint API_GetLastTimeStamp(ulong id) // Returns 0 if player wasn't found
uint API_GetSecondsPlayed(ulong id) // Returns 0 if player wasn't found

General API

bool ConnectionDataExists(ulong steamid) // Returns true or false
int ConnectionsCount() // Returns total amount of data entries

Custom API

private void API_SetValue(string key, object value) // Saves a file named "key" in /data/ConnectionDB with data "value"
private object API_GetValue(string key) // Reads a file named "key" and returns a deserialized object if was found.
private object API_GetValueRaw(string key) // Reads a file named "key" and returns raw json string.

Example Usage

Prints first player's IP to console

[PluginReference]
Plugin ConnectionDB;

private void OnPlayerConnected(BasePlayer player)
{
    Puts(ConnectionDB.Call<string>("API_GetFirstIP", player.userID));
}

MIT License


Copyright (c) 2018 misticos


Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:


The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.


THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.