├── settings.gradle.kts ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── src └── main │ ├── resources │ └── config.yml │ └── java │ └── me │ └── tech │ └── packetlogger │ ├── Constants.java │ ├── PacketLoggerPlugin.java │ ├── BatchedPacketsService.java │ └── BukkitMetrics.java ├── .gitignore ├── LICENSE ├── README.md ├── gradlew.bat ├── scripts └── graph.py └── gradlew /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | rootProject.name = "packet-logger" 2 | 3 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DebitCardz/packet-logger/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /src/main/resources/config.yml: -------------------------------------------------------------------------------- 1 | # Amount of time until all queued packets are flushed to DB 2 | flush-seconds: 5 3 | 4 | # How often to purge the logs 5 | purge-days: 14 -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sun Nov 24 11:05:09 EST 2024 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip 5 | zipStoreBase=GRADLE_USER_HOME 6 | zipStorePath=wrapper/dists 7 | -------------------------------------------------------------------------------- /src/main/java/me/tech/packetlogger/Constants.java: -------------------------------------------------------------------------------- 1 | package me.tech.packetlogger; 2 | 3 | import java.time.Instant; 4 | import java.time.ZoneId; 5 | import java.time.format.DateTimeFormatter; 6 | 7 | public final class Constants { 8 | /** The time the plugin started. */ 9 | public static final Instant NOW = Instant.now(); 10 | 11 | /** The format for the folder the SQLite DB is contained in. */ 12 | public static final String DB_FOLDER_NAME = DateTimeFormatter.ofPattern("yyyy-MM-dd") 13 | .withZone(ZoneId.systemDefault()) 14 | .format(NOW); 15 | 16 | /** The format for the SQLite file name. */ 17 | public static final String SQLITE_FILE_NAME = "packets_%s.sqlite".formatted(NOW.toEpochMilli()); 18 | } 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | build/ 3 | !gradle/wrapper/gradle-wrapper.jar 4 | !**/src/main/**/build/ 5 | !**/src/test/**/build/ 6 | 7 | ### IntelliJ IDEA ### 8 | .idea/modules.xml 9 | .idea/jarRepositories.xml 10 | .idea/compiler.xml 11 | .idea/libraries/ 12 | *.iws 13 | *.iml 14 | *.ipr 15 | out/ 16 | !**/src/main/**/out/ 17 | !**/src/test/**/out/ 18 | 19 | ### Eclipse ### 20 | .apt_generated 21 | .classpath 22 | .factorypath 23 | .project 24 | .settings 25 | .springBeans 26 | .sts4-cache 27 | bin/ 28 | !**/src/main/**/bin/ 29 | !**/src/test/**/bin/ 30 | 31 | ### NetBeans ### 32 | /nbproject/private/ 33 | /nbbuild/ 34 | /dist/ 35 | /nbdist/ 36 | /.nb-gradle/ 37 | 38 | ### VS Code ### 39 | .vscode/ 40 | 41 | ### Mac OS ### 42 | .DS_Store 43 | 44 | ### Other ### 45 | .idea/ -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2024-2024 Tech 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # packet-logger 2 | 3 | packet-logger is a plugin that simply tracks the packets coming and going from your server and 4 | displays it in a digestible and easy graph. 5 | 6 | --- 7 | 8 | ### 🛠 How Does It Work? 9 | packet-logger collects anonymous packet data from your server and the clients connected to your server 10 | which is then saved into a SQLite file every 5 seconds by default. 11 | 12 | You can then simply download the SQLite file and parse it using the provided Python script 13 | to analyze the amount of packets and size of those packets. 14 | 15 | --- 16 | 17 | ### 🐍 Analyze Using the Python Script 18 | > [!NOTE] 19 | > This script was tested with Python 3.11.4 and Plotly 5.24.1 20 | 21 | To analyze your data simply use the [Python Script](https://raw.githubusercontent.com/DebitCardz/packet-logger/refs/heads/main/scripts/graph.py) 22 | to parse your SQLite file. And use `pip install plotly` so we can create the graphs. 23 | 24 | Execute your Python Script by using `python