Launcher/compat/auth/uuid/uuidgen_offline.sql

12 lines
373 B
MySQL
Raw Normal View History

2018-09-17 10:07:32 +03:00
-- WARNING! Usage of this generation method is NOT recommended
DELIMITER //
CREATE TRIGGER setUUID BEFORE INSERT ON users
FOR EACH ROW BEGIN
IF NEW.uuid IS NULL THEN
SET @md5 = MD5(CONCAT("OfflinePlayer:", NEW.username));
SET NEW.uuid = CONCAT_WS('-', LEFT(@md5, 8), MID(@md5, 9, 4), MID(@md5, 13, 4), MID(@md5, 17, 4), RIGHT(@md5, 12));
END IF;
END; //
DELIMITER ;