This commit is contained in:
Rsl1122 2017-05-08 13:28:24 +03:00
commit 7eb7be53e8
4 changed files with 213 additions and 2 deletions

View File

@ -16,6 +16,11 @@ Originally the plugin only displayed data of other plugins, but now it gathers i
- Analysis
- Visualization
- Guides
- Configuration
- Localization
- [Configuration](documentation/Configuration.md)
- [Localization](documentation/Localization.md)
- [Html Customization](documentation/HtmlCustomization.md)
- Manage Command Guide
- Used libraries
- [Chart.js](http://www.chartjs.org/docs/) | [Licence](http://www.chartjs.org/docs/#notes-license)
- [Plotly.js](https://plot.ly/javascript/) | [Licence](https://github.com/plotly/plotly.js/blob/master/LICENSE)
- [Font Awesome Icons](http://fontawesome.io/icons/) | [Licence](https://opensource.org/licenses/mit-license.html)

View File

@ -0,0 +1,75 @@
![Player Analytics](https://puu.sh/t8vin.png)
# Configuration
- [Default Config](https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/resources/config.yml)
- [Settings Enum](https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/java/com/djrapitops/plan/Settings.java)
This page is an in depth documentation on what each Setting does in the config.
# Settings
## Basic settings
Config.Point | Version introduced | Type | Default | Description
--- | ---- | ------ | --- | ---------------------------------
Debug | 3.0.0 | boolean | false | Enables debug messages on console.
Locale | 2.5.0 | String | default | Two letter Locale combination. Can be set to one of the Available locales. If a faulty combination is used, default locale will be used. [Available locales](https://github.com/Rsl1122/Plan-PlayerAnalytics/tree/master/Plan/localization)
UseTextUI | 3.0.0 | boolean | false | Redirects */plan inspect* and */plan analyze* commands to display same messages as */plan qinspect* & */plan qanalyze*
Data.GatherLocations | 2.2.0 | boolean | true | Enables [PlanPlayerMoveEventListener](https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/java/com/djrapitops/plan/data/listeners/PlanPlayerMoveListener.java)
## Analysis settings
Config.Point | Version introduced | Type | Default | Description
--- | ---- | ------ | --- | ---------------------------------
LogProgressOnConsole | 2.4.0 | boolean | false | More detailed analysis progress to console.
NotifyWhenFinished | 3.0.0 | boolean | true | Enables ["Analysis Complete"-message](https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/java/com/djrapitops/plan/Phrase.java#L73) will be shown on the console after analysis is complete.
MinutesPlayedUntilConsidiredActive | 2.0.0 | Integer | 10 | This setting affects how the Analysis treats player's activity. Whether or not a player is active is determined with 3 values: Last Login, Playtime and Login Times. If the player has logged in in the last 2 weeks, has playtime higher than in the config, and has logged in 3 times, the player is considered active. Otherwise the player is counted as inactive.
## Cache settings
Config.Point | Version introduced | Type | Default | Description
--- | ---- | ------ | --- | ---------------------------------
Processing.GetLimit | 2.8.0 | Integer | 2000 | Changes the queue size for database get actions. If queue runs out notification is given on console.
Processing.SaveLimit | 2.8.0 | Integer | 1000 | Changes the queue size for database save actions. If queue runs out notification is given on console.
Processing.ClearLimit | 2.8.0 | Integer | 1000 | Changes the queue size for clearing datacache. If queue runs out notification is given on console.
AnalysisCache.RefreshAnalysisCacheOnEnable | 2.?.0 | boolean | true | Enables Analysis refresh 30 seconds after boot/reload
AnalysisCache.RefreshEveryXMinutes | 2.4.0 | Integer | -1 | Enables periodic Analysis refresh, -1 to disable
DataCache.SaveEveryXMinutes | 2.0.0 | Integer | 2 | Determines how often cache is saved to the Database.
DataCache.ClearCacheEveryXSaves | 2.0.0 | Integer | 5 | Determines how often cache clear attempt is made. This is done in case some data is left lingering even after the player has been gone for a long time.
## WebServer settings
Config.Point | Version introduced | Type | Default | Description
--- | ---- | ------ | --- | ---------------------------------
Enabled | 2.1.0 | boolean | true | Enables the Webserver
Port | 2.0.0 | Integer | 8804 | Port of the Webserver
InternalIP | 3.0.0 | String | 0.0.0.0 | Internal InetAddress to start the WebSocketServer on. [Code enabling the socket server](https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/java/com/djrapitops/plan/ui/webserver/WebSocketServer.java#L56)
ShowAlternativeServerIP | 2.0.0 | boolean | false | Enables the use of the link below in the inspect and analyze commands.
AlternativeIP | 2.0.0 | String | `your.ip.here:%port%` | Address to use as link in inspect and analyze commands if setting above is enabled. %port% will be replaced with the Port automatically. If you have port-forwarded an alternate address to the webserver port, %port% is not required.
Security.DisplayIPsAndUUIDs | 2.5.0 | boolean | true | Toggles visibility of UUIDs and IPs on player Inspect page.
Security.AddressSecurityCode | 2.5.0 | String | bAkEd | This string is added to the url so that outsiders can not access the `/server` and `/player/<playername>` pages just by knowing your IP and that your server uses Plan. Example: bAkEd -> `localhost:8804/bAkEd/server`
## Customization settings
Config.Point | Version introduced | Type | Default | Description
--- | ---- | ------ | --- | ---------------------------------
Colors.Commands | 2.1.0 | String | | Color codes used with the */plan* commands.
Colors.HTML | 2.1.0 | String |  | These HTML Color codes are used when generating the graphs and piecharts. Use without the # (hashtag)
DemographicsTriggers.Trigger | 2.1.0 | String | | An attempt to gather info is only made if message contains one of these words.
DemographicsTriggers.IgnoreWhen | 2.1.0 | String | | If an attempt is made and message contains one of these words, the info is disregarded.
## Database settings
Config.Point | Version introduced | Type | Default | Description
--- | ---- | ------ | --- | ---------------------------------
database.type | 2.0.0 | String | sqlite | Determines the type of database the plugin will use. **sqLite** - sqLite database file will be created. **MySQL** - MySQL settings are used.
mysql.host | 2.0.0 | String | localhost | IP of the MySQL-database
mysql.port | 2.0.0 | Integer | 3306 | Port of the MySQL-database
mysql.user | 2.0.0 | String | root | MySQL user
mysql.password | 2.0.0 | String | minecraft | User's password
mysql.database | 2.0.0 | String | Plan | Name of the database that has already been created. Please note, that you have to create this database in your mysql solution (eg. MariaDB)!
## End
If you don't see explanation for a config point or need help setting up the plugin, don't hesitate to ask for help! :)
- [Ask for help with an issue](https://github.com/Rsl1122/Plan-PlayerAnalytics/issues)
- [Ask for help in the spigot thread](https://www.spigotmc.org/threads/plan-player-analytics.197391/)

View File

@ -0,0 +1,98 @@
![Player Analytics](https://puu.sh/t8vin.png)
# Html Customization
The html web pages of the plugin can be completely customized.
The plugin uses two .html files: `analysis.html` and `player.html`
If the `/plugins/Plan/` folder contains either of the files, they will be used instead of the ones found inside the .jar.
This means you can copy the html files from the jar to the folder and edit them.
## Placeholders
The plugin uses placeholders to place the values into the html. Here I will go through each placeholder.
- [PlaceholderUtils.java](https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/java/com/djrapitops/plan/utilities/PlaceholderUtils.java)
## Inspect placeholders
Placeholder | Description | Example
---------- | ------------------------------------- | -----
%uuid% | Players UUID or 'Hidden' if config setting for UUID visibility is disabled. | 88493cd1-567a-49aa-acaa-84197b5de595
%lastseen% | A formatted version of the last Epoch second the user was seen. | Feb 02 18:03:12
%logintimes% | How many times the user has logged in | 34
%geoloc% | Demographics geolocation of the user. | United States
%active% | 'Player is Active' or 'Player is Inactive' depending on [isActive](https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/java/com/djrapitops/plan/utilities/AnalysisUtils.java#L27)- method. |
%age% | 'Not Known' if age is not known (-1) or the users age. | 14
%gender% | 'Unknown', 'Male' or 'Female' |
%gm0% | A formatted version of milliseconds spent in SURVIVAL. | 1h 30m 4s
%gm1% | A formatted version of milliseconds spent in CREATIVE. | 1h 30m 4s
%gm2% | A formatted version of milliseconds spent in ADVENTURE. | 1h 30m 4s
%gm3% | A formatted version of milliseconds spent in SPECTATOR. | 1h 30m 4s
%gmdata% | Number array of seconds spent in each gamemode, used by piechart. | [32423, 5436, 432543, 23]
%gmlables% | Array of labels used by piechart. | ["Survival", "Creative", "Adventure", "Spectator"]
%gmcolors% | List of html color codes that depend on config values. | "#ffffff","#eeeeee","#000000","#213123"
%gmtotal% | A formatted version of milliseconds spent in All gamemodes. | 1h 30m 4s
%ips& | An array of users ip addresses or 'Hidden'. | [127.0.0.1/]
%nicknames% | Formatted Array of Users nicknames, with `<span class="color_#"></span>` wrapped to represent §#-color tags. | [Steve, `<span class="color_4">Steve</span>`]
%name% | User's username | Steve
%registered% | A formatted version of the Epoch second the user registered. | Feb 02 18:03:12
%timeskicked% | Number how many times the user was kicked. | 5
%playtime% | A formatted version of milliseconds spent on the server. | 1h 30m 4s
%banned% | `<span class="color_4">Banned</span>` or nothing. |
%op% | ', Operator (Op)' or nothing |
%isonline& | `| <span class="color_2">Online</span>` or `| <span class="color_4">Offline</span>`
%deaths% | Number of deaths. | 24
%playerkills% | Number of Player kills the user has (Size of KillData list) | 14
%sessionstable% | Table containing up to 10 of the most recent online sessions. Example contains one line. | `<table class="sortable table"><thead><tr><th>Session Started</th><th>Session Ended</th><th>Session Length</th></tr></thead><tbody><tr><td sorttable_customkey="32674576">FORMATTED_TIME</td><td sorttable_customkey="432525345">FORMATTED_TIME</td><td sorttable_customkey="32213">FORMATTED_TIME</td></tr></tbody></table>`
%sessionaverage% | A formatted version of the average length of all of the sessions. | 10m 23s
%killstable% | Table containing up to 10 of the most recent player kills. Example contains one line. | `<table class="sortable table"><thead><tr><th>Date</th><th>Killed</th><th>With</th></tr></thead><tbody><tr><td sorttable_customkey="324123421">FORMATTED_TIME</td><td>Rsl1122</td><td>DIAMOND_SWORD</td></tr></tbody></table>`
%version% | Version of the plugin | 3.2.5
%planlite% | Replaced with an empty string. Old feature. |
%dataweek% | Array containing users online numbers for last 7 days, used by the graph. | [0, 0, 1, 1, 1, 0, 0, 1, 0, 0]
%labelsweek% | Array containing formatted time labels corresponding the data array. | ["Feb 02 18:03:12", "Feb 02 18:06:32"]
%playersgraphcolor% | Color code for the online graph in the config. | ffffff
%playersgraphfill% | Color code for fill of the online graph in the config. | 000000
%gm0col% | Color of the SURVIVAL box in the config | ffffff
%gm1col% | Color of the CREATIVE box in the config | 000000
%gm2col% | Color of the ADVENTURE box in the config | ffffff
%gm3col% | Color of the SPECTATOR box in the config | 000000
%inaccuratedatawarning% | Replaced with a warning if the player has registered 3 minutes ago | `<div class="warn">Data might be inaccurate, player has just registered.</div>`
## Additional Inspect placeholders
Additionally some placeholders will be replaced with plugin data, these can be found here:
[HookHandler # getAdditionalInspectReplaceRules](https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/java/com/djrapitops/plan/data/additional/HookHandler.java#L145)
These might change in **3.1.0** so I will not put them here yet.
## Analysis placeholders
Placeholder | Description | Example
---------- | ------------------------------------- | -----
%gm0% | Total percentage all players have spent in SURVIVAL | 66%
%gm1% | Total percentage all players have spent in CREATIVE | 19%
%gm2% | Total percentage all players have spent in ADVENTURE | 10%
%gm3% | Total percentage all players have spent in SPECTATOR | 5%
%active% | Number of [Active](https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/java/com/djrapitops/plan/utilities/AnalysisUtils.java#L27) players | 4
%inactive% | Number of Inactive players. | 43
%banned% | Number of Banned players. | 5
%joinleaver% | Number of players who have only joined once | 100
%activitytotal% | Total number of players in the database. | 152
%npday% | Number of new players who have joined in the last 24h | 5
%npweek% | Number of new players who have joined in the last 7d | 13
%npmonth% | Number of new players who have joined in the last 30d | 53
%commanduse% | Table format lines for commands & times used, sorted to descending order. | `<tr><td><b>/spawn</b></td><td>42</td></tr><tr><td><b>/plan</b></td><td>4</td></tr>`
%totalcommands% | Number of unique commands used | 2
%avgage% | 'Not Known' or an average of known user ages. | 14.5
%avgplaytime% | Formatted average playtime of all players. | 1h 30m 4s
%totalplaytime% | Formatted total playtime of all players. | 4d 2h 43m 5s
%op% | Amount of Operators on the server | 1
%refresh% | Formatted time since Epoch second of the last refresh. | 4m 5s
%totallogins% | Total number of logins of all players | 342
%top20mostactive% | Not in use, old feature. | Error: Replace rule was not set
%recentlogins% | Buttons with links to the inspect pages of most recent players | `<p><a class="button" href="http://localhost:8804/bAkEd/player/Rsl1122">Rsl1122</a> </p>`
**Unfinished**
## Additional Analysis placeholders
Additionally some placeholders will be replaced with plugin data, these can be found here:
[HookHandler # getAdditionalAnalysisReplaceRules](https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/java/com/djrapitops/plan/data/additional/HookHandler.java#L127)
These might change in **3.1.0** so I will not put them here yet.

View File

@ -0,0 +1,33 @@
![Player Analytics](https://puu.sh/t8vin.png)
# Localization
This article will tell you how you can change the messages seen in the plugin.
(Introduced in version 2.5.0)
By Default Plan uses internal Locale found inside Phrase.java & Html.java (Config setting: default)
- [Phrase](https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/java/com/djrapitops/plan/Phrase.java)
- [Html](https://github.com/Rsl1122/Plan-PlayerAnalytics/blob/master/Plan/src/main/java/com/djrapitops/plan/ui/Html.java)
## Config setting
In the config, there is a setting for Locale.
Setting this to, for example EN, will attempt to fetch locale from Github to be used with the plugin.
Unfortunately when this setting is used, the Color customization setting for commands is not used. This can be circumvented by copying the existing locale from Github to `/plugins/Plan/locale.txt` and changing the colors in the file.
If you want to use your own locale, just copy contents of this file on github to `/plugins/Plan/locale.txt`
Now you can customize all in game messages!
Some messages in the html pages are not loaded from the text file, and need to be changed seperately.
This can be done by copying the html files from the .jar to the plugin folder and editing them.
- [Available Locales](https://github.com/Rsl1122/Plan-PlayerAnalytics/tree/master/Plan/localization)
## Known caveats:
- The 'äåö'-letters etc do not work on the webpage, this will hopefully be fixed in a future update.
## End
If you want to help me out with localizing the plugin to your language, you can translate the locale file to your language and send the contents to me in one way:
- Do a pull request
- [Open an issue](https://github.com/Rsl1122/Plan-PlayerAnalytics/issues)
- [Send me private message on spigot](https://www.spigotmc.org/members/rsl1122.122894/)