Last active
December 27, 2015 23:39
-
-
Save mlow/7407764 to your computer and use it in GitHub Desktop.
Import LogBlock's signtext to Prism
This file contains 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
-- Assuming Logblock Database = logblock, table = lb-world, Prism Database = minecraft | |
-- For versions prior than Prism 2.0 | |
-- sign-text | |
INSERT INTO `minecraft`.`prism_actions` (action_time,action_type,player,world,x,y,z,data) | |
SELECT `logblock`.`lb-world`.date, "sign-change", `logblock`.`lb-players`.playername, "world", `logblock`.`lb-world`.x, `logblock`.`lb-world`.y, `logblock`.`lb-world`.z, | |
CONCAT('{"block_id":',`logblock`.`lb-world`.type,',"block_subid":',`logblock`.`lb-world`.data, ',"lines":["', | |
SUBSTRING_INDEX(SUBSTRING_INDEX(`logblock`.`lb-world-sign`.signtext, '\0', 1), '\0', -1), '","', -- line 1 | |
SUBSTRING_INDEX(SUBSTRING_INDEX(`logblock`.`lb-world-sign`.signtext, '\0', 2), '\0', -1), '","', -- line 2 | |
SUBSTRING_INDEX(SUBSTRING_INDEX(`logblock`.`lb-world-sign`.signtext, '\0', 3), '\0', -1), '","', -- line 3 | |
SUBSTRING_INDEX(SUBSTRING_INDEX(`logblock`.`lb-world-sign`.signtext, '\0', 4), '\0', -1), '"],', -- line 4 | |
-- ..,"facing":"NORTH"}, without this Prism fails to roll back, and I don't know a good way to get the proper format from block sub ID | |
'"signtype":"', IF (`logblock`.`lb-world`.type = 63, 'SIGN_POST', 'WALL_SIGN'), '","facing":"NORTH"}') | |
FROM `logblock`.`lb-world` | |
JOIN `logblock`.`lb-players` ON `logblock`.`lb-players`.playerid = `logblock`.`lb-world`.playerid | |
JOIN `logblock`.`lb-world-sign` ON `logblock`.`lb-world-sign`.id = `logblock`.`lb-world`.id | |
WHERE `logblock`.`lb-world`.type IN (63, 68); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment