· 8 years ago · Jan 15, 2018, 07:40 PM
1queries.put("create-worlds", "CREATE TABLE IF NOT EXISTS `worlds` (`id` int unsigned AUTO_INCREMENT, `date` int unsigned, `name` varchar(32), PRIMARY KEY `name` (`name`), KEY `id` (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;");
2 queries.put("insert-world", "INSERT INTO `worlds` (`date`, `name`) VALUES (UNIX_TIMESTAMP(), ?);");
3 queries.put("select-world", "SELECT id FROM `worlds` WHERE name = ?;");
4
5 queries.put("create-players", "CREATE TABLE IF NOT EXISTS `players` (`id` int unsigned AUTO_INCREMENT, `date` int unsigned, `name` varchar(32), `last_ip` int unsigned, `last_login` int unsigned, PRIMARY KEY `name` (`name`), KEY `id` (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;");
6 queries.put("insert-player", "INSERT INTO `players` (`date`, `name`) VALUES (UNIX_TIMESTAMP(), ?);");
7 queries.put("select-player", "SELECT id FROM `players` WHERE name = ?;");
8 queries.put("update-player", "UPDATE `players` SET last_ip = INET_ATON(?), last_login = UNIX_TIMESTAMP() WHERE id = ?");
9 queries.put("select-player-byid", "SELECT name FROM `players` WHERE id = ?;");
10 queries.put("select-player-date", "SELECT date FROM `players` WHERE name = ?;");
11
12 queries.put("create-blocklogs", "CREATE TABLE IF NOT EXISTS `block_logs` (`id` int unsigned AUTO_INCREMENT, `date` int unsigned, `world_id` int unsigned, `player_id` int unsigned, `type` tinyint unsigned, `x` int, `y` smallint, `z` int, `block_id` smallint, `block_data` smallint, `hand_id` smallint, PRIMARY KEY `id` (`id`), KEY `xyz` (`world_id`, `x`, `y`, `z`), KEY `player_id` (`player_id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;");
13 queries.put("insert-blocklog", "INSERT INTO `block_logs` (`date`, `world_id`, `player_id`, `type`, `x`, `y`, `z`, `block_id`, `block_data`, `hand_id`) VALUES (UNIX_TIMESTAMP(), ?, ?, ?, ?, ?, ?, ?, ?, ?);");
14 queries.put("select-blocklog", "SELECT date, player_id, type, block_id, block_data, hand_id FROM `block_logs` WHERE world_id = ? AND x = ? AND y = ? AND z = ?;");
15 queries.put("select-blocklog-radius", "SELECT date, player_id, type, block_id, block_data, hand_id FROM `block_logs` WHERE world_id = ? AND x > ? AND x < ? AND y > ? AND y < ? AND z > ? AND z < ?;");
16 queries.put("select-blocklog-rollback", "SELECT id, date, type, x, y, z, block_id, block_data FROM `block_logs` WHERE date > UNIX_TIMESTAMP() - ? AND world_id = ? AND player_id = ? ORDER BY date DESC;");
17 queries.put("delete-blocklogs", "DELETE FROM `block_logs` WHERE id = ?;");
18
19 queries.put("create-loginlogs", "CREATE TABLE IF NOT EXISTS `login_logs` (`id` int unsigned AUTO_INCREMENT, `date` int unsigned, `world_id` int unsigned, `player_id` int unsigned, `ip` int unsigned, `type` tinyint unsigned, PRIMARY KEY `id` (`id`), KEY `player_id` (`player_id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;");
20 queries.put("insert-loginlogs", "INSERT INTO `login_logs` (`date`, `world_id`, `player_id`, `ip`, `type`) VALUES (UNIX_TIMESTAMP(), ?, ?, INET_ATON(?), ?);");
21
22 queries.put("create-chests", "CREATE TABLE IF NOT EXISTS `chests` (`id` int unsigned AUTO_INCREMENT, `date` int unsigned, `world_id` int unsigned, `player_id` int unsigned, `x` int, `y` smallint, `z` int, `last_player_id` int unsigned, PRIMARY KEY `xyz` (`world_id`, `x`, `y`, `z`), KEY `player_id` (`player_id`), KEY `id` (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;");
23 queries.put("insert-chest", "INSERT INTO `chests` (`date`, `world_id`, `player_id`, `x`, `y`, `z`, last_player_id) VALUES (UNIX_TIMESTAMP(), ?, ?, ?, ?, ?, 0);");
24 queries.put("select-chest", "SELECT id FROM `chests` WHERE world_id = ? AND x = ? AND y = ? AND z = ?;");
25 queries.put("update-chest", "UPDATE `chests` SET last_player_id = ? WHERE id = ?");
26 queries.put("delete-chest", "DELETE FROM `chests` WHERE id = ?;");
27
28 queries.put("create-chestaccesslogs", "CREATE TABLE IF NOT EXISTS `chest_access_logs` (`id` int unsigned AUTO_INCREMENT, `date` int unsigned, `player_id` int unsigned, `chest_id` int unsigned, PRIMARY KEY `id` (`id`), KEY `chest_id` (`chest_id`), KEY `player_id` (`player_id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;");
29 queries.put("insert-chestaccesslogs", "INSERT INTO `chest_access_logs` (`date`, `player_id`, `chest_id`) VALUES (UNIX_TIMESTAMP(), ?, ?);");
30 queries.put("delete-chestaccesslogs", "DELETE FROM `chest_access_logs` WHERE chest_id = ?;");
31
32 queries.put("create-chestcontents", "CREATE TABLE IF NOT EXISTS `chest_contents` (`id` bigint unsigned AUTO_INCREMENT, `chest_id` int unsigned, `slot_id` tinyint unsigned, `item_id` smallint unsigned, `item_durability` tinyint unsigned, `item_count` tinyint unsigned, PRIMARY KEY `id` (`id`), KEY `chest_id` (`chest_id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;");
33 queries.put("delete-chestcontents", "DELETE FROM `chest_contents` WHERE chest_id = ?;");
34 queries.put("insert-chestcontents", "INSERT INTO `chest_contents` (`chest_id`, `slot_id`, `item_id`, `item_durability`, `item_count`) VALUES (?, ?, ?, ?, ?);");