new file: README.md new file: database/schema.sql new file: paper-plugin/pom.xml new file: paper-plugin/src/main/java/de/simolzimol/mclogger/paper/PaperLoggerPlugin.java new file: paper-plugin/src/main/java/de/simolzimol/mclogger/paper/commands/MCLoggerCommand.java new file: paper-plugin/src/main/java/de/simolzimol/mclogger/paper/database/DatabaseManager.java new file: paper-plugin/src/main/java/de/simolzimol/mclogger/paper/listeners/BlockListener.java new file: paper-plugin/src/main/java/de/simolzimol/mclogger/paper/listeners/EntityListener.java new file: paper-plugin/src/main/java/de/simolzimol/mclogger/paper/listeners/InventoryListener.java new file: paper-plugin/src/main/java/de/simolzimol/mclogger/paper/listeners/LuckPermsListener.java new file: paper-plugin/src/main/java/de/simolzimol/mclogger/paper/listeners/PlayerChatCommandListener.java new file: paper-plugin/src/main/java/de/simolzimol/mclogger/paper/listeners/PlayerDeathListener.java new file: paper-plugin/src/main/java/de/simolzimol/mclogger/paper/listeners/PlayerMiscListener.java new file: paper-plugin/src/main/java/de/simolzimol/mclogger/paper/listeners/PlayerSessionListener.java new file: paper-plugin/src/main/java/de/simolzimol/mclogger/paper/listeners/WorldListener.java new file: paper-plugin/src/main/resources/config.yml new file: paper-plugin/src/main/resources/plugin.yml new file: paper-plugin/target/classes/config.yml new file: paper-plugin/target/classes/de/simolzimol/mclogger/paper/PaperLoggerPlugin.class new file: paper-plugin/target/classes/de/simolzimol/mclogger/paper/commands/MCLoggerCommand$RsConsumer.class new file: paper-plugin/target/classes/de/simolzimol/mclogger/paper/commands/MCLoggerCommand.class new file: paper-plugin/target/classes/de/simolzimol/mclogger/paper/database/DatabaseManager$ThrowingRunnable.class new file: paper-plugin/target/classes/de/simolzimol/mclogger/paper/database/DatabaseManager.class new file: paper-plugin/target/classes/de/simolzimol/mclogger/paper/listeners/BlockListener.class new file: paper-plugin/target/classes/de/simolzimol/mclogger/paper/listeners/EntityListener.class new file: paper-plugin/target/classes/de/simolzimol/mclogger/paper/listeners/InventoryListener.class new file: paper-plugin/target/classes/de/simolzimol/mclogger/paper/listeners/LuckPermsListener.class new file: paper-plugin/target/classes/de/simolzimol/mclogger/paper/listeners/PlayerChatCommandListener.class new file: paper-plugin/target/classes/de/simolzimol/mclogger/paper/listeners/PlayerDeathListener.class new file: paper-plugin/target/classes/de/simolzimol/mclogger/paper/listeners/PlayerMiscListener.class new file: paper-plugin/target/classes/de/simolzimol/mclogger/paper/listeners/PlayerSessionListener.class new file: paper-plugin/target/classes/de/simolzimol/mclogger/paper/listeners/WorldListener.class new file: paper-plugin/target/classes/plugin.yml new file: paper-plugin/target/maven-archiver/pom.properties new file: paper-plugin/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file: paper-plugin/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file: paper-plugin/target/mclogger-paper-1.0.0.jar new file: paper-plugin/target/original-mclogger-paper-1.0.0.jar new file: velocity-plugin/pom.xml new file: velocity-plugin/src/main/java/de/simolzimol/mclogger/velocity/VelocityLoggerPlugin.java new file: velocity-plugin/src/main/java/de/simolzimol/mclogger/velocity/database/VelocityDatabaseManager.java new file: velocity-plugin/src/main/java/de/simolzimol/mclogger/velocity/listeners/VelocityEventListener.java new file: velocity-plugin/src/main/resources/velocity-config.yml new file: velocity-plugin/target/classes/de/simolzimol/mclogger/velocity/VelocityLoggerPlugin.class new file: velocity-plugin/target/classes/de/simolzimol/mclogger/velocity/database/VelocityDatabaseManager$ThrowingRunnable.class new file: velocity-plugin/target/classes/de/simolzimol/mclogger/velocity/database/VelocityDatabaseManager.class new file: velocity-plugin/target/classes/de/simolzimol/mclogger/velocity/listeners/VelocityEventListener.class new file: velocity-plugin/target/classes/velocity-config.yml new file: velocity-plugin/target/classes/velocity-plugin.json new file: velocity-plugin/target/maven-archiver/pom.properties new file: velocity-plugin/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst new file: velocity-plugin/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst new file: velocity-plugin/target/mclogger-velocity-1.0.0.jar new file: velocity-plugin/target/original-mclogger-velocity-1.0.0.jar new file: web/Dockerfile new file: web/app.py new file: web/blueprints/__init__.py new file: web/blueprints/auth.py new file: web/blueprints/group_admin.py new file: web/blueprints/panel.py new file: web/blueprints/site_admin.py new file: web/config.py new file: web/crypto.py new file: web/docker-compose.yml new file: web/panel_db.py new file: web/requirements.txt new file: web/static/css/style.css new file: web/static/js/main.js new file: web/templates/_pagination.html new file: web/templates/admin/base.html new file: web/templates/admin/dashboard.html new file: web/templates/admin/group_edit.html new file: web/templates/admin/group_members.html new file: web/templates/admin/groups.html new file: web/templates/admin/user_edit.html new file: web/templates/admin/users.html new file: web/templates/auth/admin_login.html new file: web/templates/auth/login.html new file: web/templates/base.html new file: web/templates/blocks.html new file: web/templates/chat.html new file: web/templates/commands.html new file: web/templates/dashboard.html new file: web/templates/deaths.html new file: web/templates/group_admin/base.html new file: web/templates/group_admin/dashboard.html new file: web/templates/group_admin/database.html new file: web/templates/group_admin/member_edit.html new file: web/templates/group_admin/members.html new file: web/templates/login.html new file: web/templates/panel/blocks.html new file: web/templates/panel/chat.html new file: web/templates/panel/commands.html new file: web/templates/panel/dashboard.html new file: web/templates/panel/deaths.html new file: web/templates/panel/no_db.html new file: web/templates/panel/perms.html new file: web/templates/panel/player_detail.html new file: web/templates/panel/players.html new file: web/templates/panel/proxy.html new file: web/templates/panel/server_events.html new file: web/templates/panel/sessions.html new file: web/templates/perms.html new file: web/templates/player_detail.html new file: web/templates/players.html new file: web/templates/proxy.html new file: web/templates/server_events.html new file: web/templates/sessions.html
281 lines
8.0 KiB
Markdown
281 lines
8.0 KiB
Markdown
# MCLogger
|
||
|
||
**Minecraft 1.20–1.21 · Paper + Velocity · MariaDB · Flask-Admin**
|
||
Autor: **SimolZimol**
|
||
|
||
Umfassendes Logging-System für Minecraft-Netzwerke. Alle relevanten Events werden asynchron in einer MariaDB-Datenbank gespeichert und über ein modernes Flask-Webinterface auswertbar.
|
||
|
||
---
|
||
|
||
## Projektstruktur
|
||
|
||
```
|
||
Log/
|
||
├── database/
|
||
│ └── schema.sql ← MariaDB-Schema (einmalig ausführen)
|
||
│
|
||
├── paper-plugin/ ← Maven-Projekt für Paper 1.20-1.21
|
||
│ ├── pom.xml
|
||
│ └── src/main/
|
||
│ ├── java/de/simolzimol/mclogger/paper/
|
||
│ │ ├── PaperLoggerPlugin.java
|
||
│ │ ├── database/DatabaseManager.java
|
||
│ │ └── listeners/
|
||
│ │ ├── PlayerSessionListener.java
|
||
│ │ ├── PlayerChatCommandListener.java
|
||
│ │ ├── PlayerDeathListener.java
|
||
│ │ ├── PlayerMiscListener.java
|
||
│ │ ├── BlockListener.java
|
||
│ │ ├── EntityListener.java
|
||
│ │ ├── InventoryListener.java
|
||
│ │ └── WorldListener.java
|
||
│ └── resources/
|
||
│ ├── plugin.yml
|
||
│ └── config.yml
|
||
│
|
||
├── velocity-plugin/ ← Maven-Projekt für Velocity 3.x
|
||
│ ├── pom.xml
|
||
│ └── src/main/
|
||
│ ├── java/de/simolzimol/mclogger/velocity/
|
||
│ │ ├── VelocityLoggerPlugin.java
|
||
│ │ ├── database/VelocityDatabaseManager.java
|
||
│ │ └── listeners/VelocityEventListener.java
|
||
│ └── resources/
|
||
│ └── velocity-config.yml
|
||
│
|
||
└── web/ ← Python Flask Admin-Interface
|
||
├── app.py
|
||
├── config.py
|
||
├── requirements.txt
|
||
├── templates/
|
||
│ ├── base.html
|
||
│ ├── login.html
|
||
│ ├── dashboard.html
|
||
│ ├── players.html
|
||
│ ├── player_detail.html
|
||
│ ├── chat.html
|
||
│ ├── commands.html
|
||
│ ├── blocks.html
|
||
│ ├── deaths.html
|
||
│ ├── proxy.html
|
||
│ ├── sessions.html
|
||
│ ├── server_events.html
|
||
│ └── _pagination.html
|
||
└── static/
|
||
├── css/style.css
|
||
└── js/main.js
|
||
```
|
||
|
||
---
|
||
|
||
## Was wird geloggt?
|
||
|
||
### Paper-Server
|
||
| Kategorie | Events |
|
||
|-----------|--------|
|
||
| **Sessions** | Login, Logout, Kick (+ IP, Client-Version, Sprache) |
|
||
| **Chat** | Alle Chat-Nachrichten mit Welt und Server |
|
||
| **Commands** | Alle Spieler-Befehle mit Position |
|
||
| **Tode** | Ursache, Mörder, verlorene Items, XP-Level |
|
||
| **Respawn** | Bett / Ankerpunkt / Normalrespawn |
|
||
| **Teleport** | Alle Ursachen (Portal, Command, Plugin usw.) |
|
||
| **Gamemode** | Wechsel mit Ursache |
|
||
| **Level/XP** | Level-Änderungen |
|
||
| **Blöcke** | Break, Place, Ignite, Burn, Explode + Werkzeug, SilkTouch |
|
||
| **Schilder** | Alle Sign-Änderungen mit Inhalt |
|
||
| **Entities** | Spawn, Tod, Schaden (durch Spieler), Zähmen, Züchten, Explosion |
|
||
| **PvP** | Schaden zwischen Spielern |
|
||
| **Inventar** | Item aufheben/fallenlassen, Crafting, Verzauberung, Amboss, Handel |
|
||
| **Welt** | Wetter, Donner, Portal, Baum-/Pilzwachstum, Welt-Load/Unload |
|
||
| **Server** | Start, Stop, Player-Join, Player-Quit, Kick |
|
||
| **Diverses** | Bett betreten/verlassen, Hand-Item-Wechsel, Angeln, Schlafen, Entity-Interaktion, Welt-Wechsel |
|
||
|
||
### Velocity-Proxy
|
||
| Kategorie | Events |
|
||
|-----------|--------|
|
||
| **Verbindungen** | Login (+ IP, Protocol-Version, Client-Brand, Ping) |
|
||
| **Disconnect** | Grund + Sitzungsdauer |
|
||
| **Server-Wechsel** | Von → Nach-Server |
|
||
| **Chat** | Proxy-Level-Chat |
|
||
| **Commands** | Proxy-Level-Commands |
|
||
| **Proxy** | Start / Stop |
|
||
|
||
---
|
||
|
||
## Voraussetzungen
|
||
|
||
- **Java 17+**
|
||
- **Maven 3.8+**
|
||
- **MariaDB 10.6+** / MySQL 8+
|
||
- **Paper 1.20–1.21**
|
||
- **Velocity 3.x**
|
||
- **Python 3.10+**
|
||
|
||
---
|
||
|
||
## 1. Datenbank einrichten
|
||
|
||
```sql
|
||
-- Als root in MariaDB:
|
||
SOURCE /pfad/zu/database/schema.sql;
|
||
|
||
-- Benutzer anlegen:
|
||
CREATE USER 'mclogger'@'%' IDENTIFIED BY 'sicheres_passwort';
|
||
GRANT ALL PRIVILEGES ON mclogger.* TO 'mclogger'@'%';
|
||
FLUSH PRIVILEGES;
|
||
```
|
||
|
||
---
|
||
|
||
## 2. Paper-Plugin bauen & installieren
|
||
|
||
```bash
|
||
cd paper-plugin
|
||
mvn clean package -q
|
||
cp target/mclogger-paper-1.0.0.jar /dein/paper-server/plugins/
|
||
```
|
||
|
||
Konfiguration bearbeiten (`plugins/MCLogger/config.yml`):
|
||
|
||
```yaml
|
||
server:
|
||
name: "survival-01" # eindeutiger Name
|
||
|
||
database:
|
||
host: "localhost"
|
||
port: 3306
|
||
database: "mclogger"
|
||
username: "mclogger"
|
||
password: "sicheres_passwort"
|
||
```
|
||
|
||
Server neu starten.
|
||
|
||
---
|
||
|
||
## 3. Velocity-Plugin bauen & installieren
|
||
|
||
```bash
|
||
cd velocity-plugin
|
||
mvn clean package -q
|
||
cp target/mclogger-velocity-1.0.0.jar /dein/velocity-proxy/plugins/
|
||
```
|
||
|
||
Konfiguration bearbeiten (`plugins/mclogger-velocity/velocity-config.yml`):
|
||
|
||
```yaml
|
||
proxy:
|
||
name: "proxy-01"
|
||
|
||
database:
|
||
host: "localhost"
|
||
port: 3306
|
||
database: "mclogger"
|
||
username: "mclogger"
|
||
password: "sicheres_passwort"
|
||
```
|
||
|
||
Proxy neu starten.
|
||
|
||
---
|
||
|
||
## 4. Flask-Webinterface starten
|
||
|
||
```bash
|
||
cd web
|
||
|
||
# Python-Umgebung (empfohlen)
|
||
python -m venv venv
|
||
venv\Scripts\activate # Windows
|
||
source venv/bin/activate # Linux/Mac
|
||
|
||
pip install -r requirements.txt
|
||
|
||
# Umgebungsvariablen setzen (oder config.py direkt bearbeiten)
|
||
set MCLOGGER_DB_HOST=localhost
|
||
set MCLOGGER_DB_PASSWORD=sicheres_passwort
|
||
set MCLOGGER_ADMIN_PASSWORD=admin_passwort
|
||
set MCLOGGER_SECRET_KEY=zufaelliger_32_zeichen_schluessel
|
||
|
||
python app.py
|
||
```
|
||
|
||
Webinterface öffnen: **http://localhost:5000**
|
||
|
||
### Für Produktion (Linux mit Gunicorn)
|
||
|
||
```bash
|
||
pip install gunicorn
|
||
gunicorn -w 4 -b 0.0.0.0:5000 app:app
|
||
```
|
||
|
||
Oder als systemd-Service:
|
||
|
||
```ini
|
||
[Unit]
|
||
Description=MCLogger Web
|
||
|
||
[Service]
|
||
WorkingDirectory=/opt/mclogger/web
|
||
Environment=MCLOGGER_DB_HOST=localhost
|
||
Environment=MCLOGGER_DB_PASSWORD=sicheres_passwort
|
||
Environment=MCLOGGER_ADMIN_PASSWORD=admin_passwort
|
||
Environment=MCLOGGER_SECRET_KEY=...
|
||
ExecStart=/opt/mclogger/web/venv/bin/gunicorn -w 2 -b 127.0.0.1:5000 app:app
|
||
Restart=always
|
||
|
||
[Install]
|
||
WantedBy=multi-user.target
|
||
```
|
||
|
||
---
|
||
|
||
## Webinterface-Features
|
||
|
||
| Seite | Beschreibung |
|
||
|-------|-------------|
|
||
| **Dashboard** | Live-Statistiken, Online-Spieler, Aktivitäts-Charts, Top-Playtime |
|
||
| **Spieler** | Suchbare Spielerliste mit Profil-Details |
|
||
| **Spielerprofil** | Sessions, Chat, Commands, Tode, Teleports, Stats, Proxy-Events in Tabs |
|
||
| **Sessions** | Alle Login-/Logout-Sitzungen mit Filterfunktion |
|
||
| **Chat** | Volltext-Suche in allen Chat-Nachrichten |
|
||
| **Commands** | Alle ausgeführten Befehle |
|
||
| **Block-Events** | Break/Place/Ignite usw. mit Positions-Info |
|
||
| **Tode** | Tode mit Ursache, Mörder und Todes-Meldung |
|
||
| **Proxy-Events** | Login, Disconnect, Server-Wechsel usw. |
|
||
| **Server-Events** | Start/Stop und reine Server-Ereignisse |
|
||
|
||
---
|
||
|
||
## Konfigurationsvariablen (Umgebungsvariablen)
|
||
|
||
| Variable | Standard | Beschreibung |
|
||
|----------|----------|-------------|
|
||
| `MCLOGGER_DB_HOST` | `localhost` | MariaDB-Host |
|
||
| `MCLOGGER_DB_PORT` | `3306` | MariaDB-Port |
|
||
| `MCLOGGER_DB_USER` | `mclogger` | DB-Benutzer |
|
||
| `MCLOGGER_DB_PASSWORD` | *(leer)* | DB-Passwort |
|
||
| `MCLOGGER_DB_NAME` | `mclogger` | Datenbankname |
|
||
| `MCLOGGER_HOST` | `0.0.0.0` | Webserver-Bind |
|
||
| `MCLOGGER_PORT` | `5000` | Webserver-Port |
|
||
| `MCLOGGER_ADMIN_USER` | `admin` | Admin-Login |
|
||
| `MCLOGGER_ADMIN_PASSWORD` | *(leer)* | Admin-Passwort |
|
||
| `MCLOGGER_SECRET_KEY` | *(unsicher)* | Flask Session-Key |
|
||
|
||
---
|
||
|
||
## Performance-Hinweise
|
||
|
||
- Alle Datenbank-Writes erfolgen **asynchron** → kein Tick-Lag
|
||
- HikariCP Connection-Pool voreingestellt auf 10 (Paper) / 5 (Velocity)
|
||
- Entity-Spawn-Logging ist standardmäßig **deaktiviert** (sehr viele Events)
|
||
- Block-Events können bei Farms sehr viele Einträge erzeugen → ggf. `blocks-break-only: true`
|
||
- Ein regelmäßiges DB-Backup empfiehlt sich (Events wachsen schnell)
|
||
- MariaDB: Index-Tuning für `timestamp`-Spalten ist bereits im Schema enthalten
|
||
|
||
---
|
||
|
||
## Lizenz
|
||
|
||
MIT – Frei verwendbar, SimolZimol als Autor nennen.
|