This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE FUNCTION generate_offline_uuid( | |
username_p VARCHAR(20) | |
) RETURNS VARCHAR(36) BEGIN | |
DECLARE uuid_bytes VARCHAR(36); | |
SELECT MD5(CONCAT('OfflinePlayer:', username_p)) INTO uuid_bytes; | |
SELECT INSERT(uuid_bytes, 13, 2, HEX(CONV(SUBSTR(uuid_bytes, 13, 2), 16, 10) & 0x0f | 0x30)) INTO uuid_bytes; | |
SELECT INSERT(uuid_bytes, 17, 2, HEX(CONV(SUBSTR(uuid_bytes, 17, 2), 16, 10) & 0x3f | 0x80)) INTO uuid_bytes; | |
RETURN (SELECT LCASE(CONCAT_WS('-', | |
SUBSTR(uuid_bytes, 1, 8), | |
SUBSTR(uuid_bytes, 9, 4), |