player-info-library

last built 2 weeks ago
Build #22
By downloading this file, you agree to our license terms.
Source: github.com
License: MIT
Maintainer: Community Plugin
This plugin is maintained by the RocketMod Community.
The RocketMod team curates a dozen of community plugins and could need your support.
Consider a donation to RocketMod and sponsor your favourite plugins or contribute code to them.

Player Info Library

Adds a more advanced and detailed investigate command, and adds the ability to query stored data in other plugins. Once upon a time there was a more detailed investigate command in Unturned, this plugin bassically re-adds that and more.

 

Plugin Dev’s can also look at the source code for the plugin on git for a better idea of how the plugin works.
https://github.com/cartman-2000/PlayerInfoLib

 

Commands

  • /investigate <playername | SteamID | IP address > [page number] – Shows list of players that match search query.
  • rnint <new instance name> – Changes the instance name stored in the database that is used to tie the player info data to this server. This would be used for when you want to change the instance name on the server, you would need to run this command prior to restarting the server after the change. Console only command.
  • delint <Instance ID> – Deletes all the player info data for the given Instance ID, use with caution, and it’s recommended to make a Database backup first. This command may take some time to complete if there’s a lot of data to remove. Console only command.

Permissions

  • investigate – allows you to use the investigate command.

Configuration

  • DatabaseAddress – The address to the Mysql database server.
  • DatabaseUserName – Your username on the Mysql server.
  • DatabasePassword – Your username password on the Mysql server.
  • DatabaseName – The database you want the tables stored in.
  • DatabaseTableName – The Name of the tables you want to use for the plugin.
  • KeepaliveInterval – The length of time in minutes between each ping to the mysql server, the plugin uses a persistent connection to the Mysql server. Default 10 minutes.
  • CacheTime – Time in number of minutes that records that were retrieved by steam id should be retrieved out of the cache instead of the database. This will speed up retrieval of data from this plugin in other plugins. Default 180 minutes, or 3 hours.
  • ExpiredCheckInterval – How often to check the cache and and player data for expired data.
  • ExpiresAfter – Used to set how long to keep player info records in the database, in days. Set to 0 to disable this feature.
  • VipCheckGroupName – Use what you have set as the id for the vip group on your server(case sinsitive.), defaults to “vip.”

Plugin Api

Database Class
  • public PlayerData PlayerInfoLib.Database.QueryById(CSteamID steamId, bool cached = true) – For getting data by SteamID. First param is the CSteamID of the player you want to lookup, the second is an optional param, set to false if you want to skip the cache when looking up player data. Returns a PlayerData typed object.
  • public List<PlayerData> PlayerInfoLib.Database.QueryByName(string playerName, QueryType queryType, out uint totalRecods, bool pagination = true, uint page = 1, uint limit = 4) – For getting data by name or ip address. First param is the name of the player or the ip of a player you want to look up, the second is the query type you want to perform, there’s four possible ones you can use: SteamName, CharName, Both, IP. totalRecords returns the number of records found in the query. The next three are optional params, that are used for pagination of the output. This returns a List of PlayerData typed data.
  • These methods will try to find players that have played on the server it being queried on first before looking for the info for the last server they played on.
PlayerData Class

Properties

  • SteamID, SteamName, CharacterName, IP – The primary data for the player.
  • LastLoginGlobal – The last time They were seen on any server, in DateTime format.
  • TotalPlayTime – The total amount of time that a player has played on the server’s in seconds.
  • LastLoginLocal – The last time they’ve played on the server that this data has been queried on, in DateTime format.
  • LastServerName – The name of the last server they played on.
  • Other data:
  • LastServerID – The instance id of the last server the player played on, used in the IsLocal method in the class.
  • ServerID – The instance id of either the local server, the last server the player played on if a local record wasn’t found for the player, or 0 if no record for the last server they played on was found.
  • CacheTime – Stores the DateTime of when the data was stored in the cache.
  • CleanedBuildables and CleanedPlayerData – For future use in the wrecking ball plugin.

Methods

  • IsLocal() – Checks to see if the data in the class belongs to this server or not.
  • IsValid() – Checks to see if the data is valid, this will be false if the player data wasn’t found by a steam id search.
  • IsCacheExpired() – Used for checking to see if the data has expired or not(for Caching).
  • IsVip() – Returns if the player has Vip on the server. Searches all groups a player has to find a match to the group name set in the plugin config. For players in higher groups, it requires that these groups inherit the vip group, in the inheritence chain, for this to come back as true.

 

Change Notes

  • 1.3.0.0: This update adds two commands(check the commands secotion on their usege), and an automatic player data cleanup feature player data that is older than the time set in the config. You will need to delete and regenerate the translations file for this update, as it adds more translations lines.
  • 1.3.0.2: Updated the database to handle emoji characters and other special 4 byte UTF8 characters(required conversion of the steam/char name tables to utf8mb4.).
  • 1.3.1.0: Add an IsVip feature to the player data class. Works by searching through set and inherited groups for a group that matches what is in the config.

Default configuration


<?xml version="1.0" encoding="utf-8"?>
<PlayerInfoLibConfig xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <DatabaseAddress>localhost</DatabaseAddress>
  <DatabasePort>3306</DatabasePort>
  <DatabaseUserName>unturned</DatabaseUserName>
  <DatabasePassword>password</DatabasePassword>
  <DatabaseName>unturned</DatabaseName>
  <DatabaseTableName>playerinfo</DatabaseTableName>
  <KeepaliveInterval>10</KeepaliveInterval>
  <CacheTime>180</CacheTime>
  <ExpiredCheckInterval>30</ExpiredCheckInterval>
  <ExpiresAfter>365</ExpiresAfter>
  <VipCheckGroupName>vip</VipCheckGroupName>
</PlayerInfoLibConfig>

Default english translation


Commands and permissions


/delint <"Instance ID">

Permissions: delint

Uses the numerical Instance ID for a server to remove all player data saved for that server. !!Use with caution, can't be undone without a database backup!!


/rnint <"New instance name">

Permissions: rnint

Renames the instance name, in the record for this server, in the database


/investigate <"Player name" | SteamID> [page]

Permissions: investigate

Returns info for players matching the search quarry.


Git changelog


aa66022ccd2c76d 2019-05-13 22:01:50

Fix MySQL statement on QueryById

    e02d0bd4bc2f738 2019-05-13 21:00:24

    Fixing the weird mysql statements

      4cfbf53638a98f5 2019-05-13 20:37:22

      ..

        0460bbc5a6000e4 2018-04-30 00:06:30

        Add a IsVip feature to the player data class.

          60ada2fc0e831bc 2018-04-29 23:34:24

          libs

            0aaf58df7a1a8ba 2018-03-12 04:13:02

            Update the database schema to allow emoji characters, 4 byte UTF8 characters.

              a06ce82183dcac2 2017-01-20 18:49:33

              libs

                b7f2d4bf1f9d8eb 2016-11-04 16:48:24

                Update to Unturned 3.17.4.0

                  6aa0187ee124b51 2016-11-04 16:47:42

                  libs

                    ffcc86661b29e9e 2016-10-08 04:01:26

                    libs

                      2e1903090a8c45a 2016-06-19 00:23:31

                      Libs

                        1955eafa69eaef1 2016-06-18 22:32:31

                        Lib output script for my plugins.

                          40557f8ac0bfc7d 2016-05-31 08:30:04

                          Added house keeping commands and code, and some other misc fixes/changes.

                            f9166f78a3966aa 2016-05-18 03:08:17

                            Reworked the player component a little bit.

                              41f6c8703a8e5f6 2016-05-10 09:16:34

                              Move portion of the code that updates the player info on connect, as the ip address isn't always set fully by this time.

                                6e1777b7294006e 2016-04-29 08:26:15

                                Fixed bug with getting the cleanup list

                                  6c1c98345a3a3a6 2016-04-26 19:06:29

                                  Update to add support for the auto cleanup feature in the wrecking ball plugin.

                                    dfe05c2ce2fb72b 2016-04-19 04:37:07

                                    Rework the GetInstanceID method again.

                                      c09fde624135fd9 2016-04-17 07:33:31

                                      Fix a Mysql Reader bug in getting the instance id.

                                        4adc69a86017212 2016-04-16 07:28:51

                                        Samll bug fix, typo in the time played formatting.

                                          f5d19a8fba151e5 2016-04-16 03:46:41

                                          Added a total play time feature, that shows the total time that a player has played on the server's in this database.

                                            c98eaa9c0c0c484 2016-04-10 20:54:10

                                            Small change to the QueryByName method.

                                              0d1ce85e069d637 2016-04-10 20:11:18

                                              Fix one small bug, it total record output in the QueryByName method.

                                                7df17a9a6006234 2016-04-10 18:05:04

                                                Changed the IP column to a UInt32 type, saves space in both the data is uses and the index space.

                                                  6374f75f7594b4f 2016-04-10 10:17:10

                                                  Version 1.0.0.0

                                                    f26724a67e5c4d0 2016-04-10 09:55:40

                                                    More formatting of the investigate output, Misc.

                                                      f94683245c2ea40 2016-04-10 09:15:43

                                                      INCOMPLETE: worked on the formatting of the investigate command some more, and also added the ability to search by IP address.

                                                        b2ed9c9ade24d5e 2016-04-09 22:19:45

                                                        INCOMPLETE: Tweaked the Queries to be a little less complex while working the same way as the other one, and ordered named output by newest global time first.

                                                          f9c0a5aa2637792 2016-04-09 20:36:37

                                                          INCOMPLETE: FIxed a typo in one of the queries, done some more work in the investigate output(needs to be shortened for output to the chat ingame though.)

                                                            d9d99dbc3423cb6 2016-04-09 04:24:04

                                                            INCOMPLETE: Tweaked the queries some more, added some data checking methods to the PlayerData class.

                                                              b7ed8ca80a3f848 2016-04-09 01:24:20

                                                              INCOMPLETE: Simplify the QueryByName method a bit.

                                                                31a759c87fb6190 2016-04-08 04:54:04

                                                                INCOMPLETE: Tweaked the sql queries, Further testing needed on QueryByName.

                                                                  06c3cd117d2efa0 2016-04-08 01:26:12

                                                                  INCOMPLETE: Working save function, Mostly working info query methods(needs tweaking with the sql.), incomplete investigate command.

                                                                    a86ea4fbb5e37fe 2016-04-06 07:40:23

                                                                    1.1.0.0: Incomplete investigate command, incomplete QueryByID and QueryByName methods, Working player info saving.