Stats: playtime and PvP statistics

This commit is contained in:
2018-10-06 03:03:07 +02:00
parent dd9828f257
commit 4f44c24ef1
5 changed files with 265 additions and 16 deletions

View File

@ -0,0 +1,8 @@
INSERT INTO `{prefix}activity`
(`uuid`, `date`, `kills`, `deaths`, `playtime`) VALUES
(?, ?, ?, ?, ?)
ON DUPLICATE KEY
UPDATE
`kills` = `kills` + VALUES(`kills`),
`deaths` = `deaths` + VALUES(`deaths`),
`playtime` = `playtime` + VALUES(`playtime`);

View File

@ -1,9 +1,19 @@
CREATE TABLE IF NOT EXISTS `{prefix}players` (
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
`id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
`uuid` binary(16) NOT NULL,
`serverNick` varchar(32) NOT NULL,
`voteCount` int UNSIGNED DEFAULT 0,
PRIMARY KEY `id` (`id`),
UNIQUE KEY `uuid` (`uuid`)
) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS `{prefix}activity` (
`id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
`uuid` binary(16) NOT NULL,
`date` DATE NOT NULL,
`kills` int DEFAULT 0,
`deaths` int UNSIGNED DEFAULT 0,
`voteCount` int UNSIGNED DEFAULT 0,
PRIMARY KEY `id` (`id`)
) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
`playtime` mediumint UNSIGNED DEFAULT 0,
PRIMARY KEY `id` (`id`),
UNIQUE KEY `date_player` (`uuid`, `date`)
) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

View File

@ -0,0 +1,7 @@
INSERT INTO `{prefix}players`
(`uuid`, `serverNick`) VALUES
(?, ?)
ON DUPLICATE KEY
UPDATE
`serverNick` = VALUES(`serverNick`),
`voteCount` = `voteCount` + VALUES(`voteCount`);