Files
MClogger/database/schema.sql
SimolZimol b918dadb0c new file: .gitignore
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
2026-04-01 01:36:01 +02:00

361 lines
14 KiB
SQL

-- ============================================================
-- MCLogger - MariaDB Schema
-- Author: SimolZimol
-- Minecraft 1.20-1.21 | Paper + Velocity
-- ============================================================
CREATE DATABASE IF NOT EXISTS mclogger CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
USE mclogger;
-- -------------------------------------------------------
-- Tabelle: servers
-- Registriert alle bekannten Server-Instanzen
-- -------------------------------------------------------
CREATE TABLE IF NOT EXISTS servers (
id INT AUTO_INCREMENT PRIMARY KEY,
server_name VARCHAR(100) NOT NULL,
server_type ENUM('paper', 'velocity') NOT NULL DEFAULT 'paper',
ip_address VARCHAR(45),
mc_version VARCHAR(20),
first_seen TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP(3),
last_seen TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3),
UNIQUE KEY uq_server_name (server_name)
) ENGINE=InnoDB;
-- -------------------------------------------------------
-- Tabelle: players
-- Bekannte Spieler mit Basisdaten
-- -------------------------------------------------------
CREATE TABLE IF NOT EXISTS players (
uuid VARCHAR(36) PRIMARY KEY,
username VARCHAR(16) NOT NULL,
display_name VARCHAR(64),
ip_address VARCHAR(45),
locale VARCHAR(20),
first_seen TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP(3),
last_seen TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3),
total_playtime_sec BIGINT DEFAULT 0,
is_op TINYINT(1) DEFAULT 0,
INDEX idx_username (username)
) ENGINE=InnoDB;
-- -------------------------------------------------------
-- Tabelle: player_sessions
-- Login-/Logout-Sitzungen
-- -------------------------------------------------------
CREATE TABLE IF NOT EXISTS player_sessions (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
player_uuid VARCHAR(36) NOT NULL,
player_name VARCHAR(16) NOT NULL,
server_name VARCHAR(100),
login_time TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP(3),
logout_time TIMESTAMP(3),
duration_sec INT,
ip_address VARCHAR(45),
client_version VARCHAR(20),
INDEX idx_ps_uuid (player_uuid),
INDEX idx_ps_server (server_name),
INDEX idx_ps_login (login_time)
) ENGINE=InnoDB;
-- -------------------------------------------------------
-- Tabelle: player_chat
-- Alle Chat-Nachrichten
-- -------------------------------------------------------
CREATE TABLE IF NOT EXISTS player_chat (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
timestamp TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP(3),
player_uuid VARCHAR(36),
player_name VARCHAR(16),
server_name VARCHAR(100),
world VARCHAR(100),
message TEXT NOT NULL,
channel VARCHAR(50) DEFAULT 'global',
INDEX idx_chat_uuid (player_uuid),
INDEX idx_chat_timestamp (timestamp),
INDEX idx_chat_server (server_name),
FULLTEXT INDEX ft_message (message)
) ENGINE=InnoDB;
-- -------------------------------------------------------
-- Tabelle: player_commands
-- Alle ausgeführten Befehle
-- -------------------------------------------------------
CREATE TABLE IF NOT EXISTS player_commands (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
timestamp TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP(3),
player_uuid VARCHAR(36),
player_name VARCHAR(16),
server_name VARCHAR(100),
world VARCHAR(100),
command TEXT NOT NULL,
x DOUBLE,
y DOUBLE,
z DOUBLE,
INDEX idx_cmd_uuid (player_uuid),
INDEX idx_cmd_timestamp (timestamp),
INDEX idx_cmd_server (server_name)
) ENGINE=InnoDB;
-- -------------------------------------------------------
-- Tabelle: block_events
-- Block-Break / Block-Place und weitere Block-Aktionen
-- -------------------------------------------------------
CREATE TABLE IF NOT EXISTS block_events (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
timestamp TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP(3),
event_type ENUM('break','place','ignite','burn','explode','fade','grow','dispense') NOT NULL,
player_uuid VARCHAR(36),
player_name VARCHAR(16),
server_name VARCHAR(100),
world VARCHAR(100) NOT NULL,
x INT NOT NULL,
y INT NOT NULL,
z INT NOT NULL,
block_type VARCHAR(100) NOT NULL,
block_data VARCHAR(255),
tool VARCHAR(100),
is_silk TINYINT(1) DEFAULT 0,
INDEX idx_be_player (player_uuid),
INDEX idx_be_timestamp (timestamp),
INDEX idx_be_world (world),
INDEX idx_be_type (event_type),
INDEX idx_be_server (server_name)
) ENGINE=InnoDB;
-- -------------------------------------------------------
-- Tabelle: player_deaths
-- Tode mit vollem Kontext
-- -------------------------------------------------------
CREATE TABLE IF NOT EXISTS player_deaths (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
timestamp TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP(3),
player_uuid VARCHAR(36) NOT NULL,
player_name VARCHAR(16) NOT NULL,
server_name VARCHAR(100),
world VARCHAR(100),
x DOUBLE,
y DOUBLE,
z DOUBLE,
death_message TEXT,
cause VARCHAR(100),
killer_uuid VARCHAR(36),
killer_name VARCHAR(100),
killer_type VARCHAR(100),
exp_level INT,
items_lost JSON,
INDEX idx_deaths_uuid (player_uuid),
INDEX idx_deaths_timestamp (timestamp)
) ENGINE=InnoDB;
-- -------------------------------------------------------
-- Tabelle: entity_events
-- Entity-Spawns, -Tode, Schaden usw.
-- -------------------------------------------------------
CREATE TABLE IF NOT EXISTS entity_events (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
timestamp TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP(3),
event_type ENUM('spawn','death','damage','tame','breed','transform','explode') NOT NULL,
server_name VARCHAR(100),
world VARCHAR(100),
x DOUBLE,
y DOUBLE,
z DOUBLE,
entity_type VARCHAR(100) NOT NULL,
entity_uuid VARCHAR(36),
entity_name VARCHAR(100),
player_uuid VARCHAR(36),
player_name VARCHAR(16),
cause VARCHAR(100),
damage DOUBLE,
details JSON,
INDEX idx_ee_timestamp (timestamp),
INDEX idx_ee_type (event_type),
INDEX idx_ee_entity (entity_type),
INDEX idx_ee_player (player_uuid),
INDEX idx_ee_server (server_name)
) ENGINE=InnoDB;
-- -------------------------------------------------------
-- Tabelle: player_teleports
-- Alle Teleportationen (Commands, Death, etc.)
-- -------------------------------------------------------
CREATE TABLE IF NOT EXISTS player_teleports (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
timestamp TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP(3),
player_uuid VARCHAR(36) NOT NULL,
player_name VARCHAR(16) NOT NULL,
server_name VARCHAR(100),
from_world VARCHAR(100),
from_x DOUBLE,
from_y DOUBLE,
from_z DOUBLE,
to_world VARCHAR(100),
to_x DOUBLE,
to_y DOUBLE,
to_z DOUBLE,
cause VARCHAR(100),
INDEX idx_tp_uuid (player_uuid),
INDEX idx_tp_timestamp (timestamp)
) ENGINE=InnoDB;
-- -------------------------------------------------------
-- Tabelle: inventory_events
-- Item-Picks, Drops, Inventory-Klicks
-- -------------------------------------------------------
CREATE TABLE IF NOT EXISTS inventory_events (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
timestamp TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP(3),
event_type ENUM('pickup','drop','click','craft','enchant','anvil','trade') NOT NULL,
player_uuid VARCHAR(36) NOT NULL,
player_name VARCHAR(16) NOT NULL,
server_name VARCHAR(100),
world VARCHAR(100),
x DOUBLE,
y DOUBLE,
z DOUBLE,
item_type VARCHAR(100),
item_amount INT,
item_meta JSON,
slot INT,
inventory_type VARCHAR(100),
INDEX idx_inv_uuid (player_uuid),
INDEX idx_inv_timestamp (timestamp),
INDEX idx_inv_type (event_type)
) ENGINE=InnoDB;
-- -------------------------------------------------------
-- Tabelle: player_stats
-- Gamemode-Wechsel, Level-Änderungen, OP-Status usw.
-- -------------------------------------------------------
CREATE TABLE IF NOT EXISTS player_stats (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
timestamp TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP(3),
event_type VARCHAR(100) NOT NULL,
player_uuid VARCHAR(36) NOT NULL,
player_name VARCHAR(16) NOT NULL,
server_name VARCHAR(100),
old_value VARCHAR(255),
new_value VARCHAR(255),
details JSON,
INDEX idx_pst_uuid (player_uuid),
INDEX idx_pst_timestamp (timestamp),
INDEX idx_pst_type (event_type)
) ENGINE=InnoDB;
-- -------------------------------------------------------
-- Tabelle: world_events
-- Wetter, Zeit, Explosionen, Portale usw.
-- -------------------------------------------------------
CREATE TABLE IF NOT EXISTS world_events (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
timestamp TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP(3),
event_type VARCHAR(100) NOT NULL,
server_name VARCHAR(100),
world VARCHAR(100),
x DOUBLE,
y DOUBLE,
z DOUBLE,
details JSON,
INDEX idx_we_timestamp (timestamp),
INDEX idx_we_world (world),
INDEX idx_we_type (event_type)
) ENGINE=InnoDB;
-- -------------------------------------------------------
-- Tabelle: server_events
-- Server-Start, -Stop, Plugin-Events, Konsolen-Commands
-- -------------------------------------------------------
CREATE TABLE IF NOT EXISTS server_events (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
timestamp TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP(3),
event_type VARCHAR(100) NOT NULL,
server_name VARCHAR(100),
message TEXT,
details JSON,
INDEX idx_se_timestamp (timestamp),
INDEX idx_se_type (event_type),
INDEX idx_se_server (server_name)
) ENGINE=InnoDB;
-- -------------------------------------------------------
-- Tabelle: proxy_events
-- Velocity: Login, Disconnect, Server-Wechsel
-- -------------------------------------------------------
CREATE TABLE IF NOT EXISTS proxy_events (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
timestamp TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP(3),
event_type ENUM('login','disconnect','server_switch','command','chat','kick','proxy_start','proxy_stop') NOT NULL,
player_uuid VARCHAR(36),
player_name VARCHAR(16),
proxy_name VARCHAR(100),
from_server VARCHAR(100),
to_server VARCHAR(100),
ip_address VARCHAR(45),
details JSON,
INDEX idx_pe_uuid (player_uuid),
INDEX idx_pe_timestamp (timestamp),
INDEX idx_pe_type (event_type),
INDEX idx_pe_proxy (proxy_name)
) ENGINE=InnoDB;
-- -------------------------------------------------------
-- Tabelle: sign_edits
-- SignChangeEvents
-- -------------------------------------------------------
CREATE TABLE IF NOT EXISTS sign_edits (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
timestamp TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP(3),
player_uuid VARCHAR(36),
player_name VARCHAR(16),
server_name VARCHAR(100),
world VARCHAR(100),
x INT,
y INT,
z INT,
line1 VARCHAR(255),
line2 VARCHAR(255),
line3 VARCHAR(255),
line4 VARCHAR(255),
INDEX idx_sign_uuid (player_uuid),
INDEX idx_sign_timestamp (timestamp)
) ENGINE=InnoDB;
-- -------------------------------------------------------
-- Tabelle: plugin_events
-- LuckPerms Berechtigungsänderungen und andere Plugin-Events
-- -------------------------------------------------------
CREATE TABLE IF NOT EXISTS plugin_events (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
timestamp TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP(3),
event_type VARCHAR(100) NOT NULL,
plugin_name VARCHAR(100),
server_name VARCHAR(100),
player_uuid VARCHAR(36),
player_name VARCHAR(16),
actor_uuid VARCHAR(36),
actor_name VARCHAR(64),
target_type VARCHAR(50),
target_id VARCHAR(100),
action VARCHAR(255),
details JSON,
INDEX idx_plev_uuid (player_uuid),
INDEX idx_plev_timestamp (timestamp),
INDEX idx_plev_type (event_type),
INDEX idx_plev_plugin (plugin_name),
INDEX idx_plev_actor (actor_uuid)
) ENGINE=InnoDB;
-- -------------------------------------------------------
-- View: v_recent_activity - Letzte 24h kompakt
-- -------------------------------------------------------
CREATE OR REPLACE VIEW v_recent_activity AS
SELECT 'chat' AS source, timestamp, player_name, server_name, message AS detail FROM player_chat WHERE timestamp >= NOW() - INTERVAL 24 HOUR
UNION ALL
SELECT 'command' AS source, timestamp, player_name, server_name, command AS detail FROM player_commands WHERE timestamp >= NOW() - INTERVAL 24 HOUR
UNION ALL
SELECT 'block' AS source, timestamp, player_name, server_name, CONCAT(event_type,' ',block_type,' at ',world,' ',x,',',y,',',z) AS detail FROM block_events WHERE timestamp >= NOW() - INTERVAL 24 HOUR
UNION ALL
SELECT 'death' AS source, timestamp, player_name, server_name, death_message AS detail FROM player_deaths WHERE timestamp >= NOW() - INTERVAL 24 HOUR
ORDER BY timestamp DESC;