Skip to content

Instantly share code, notes, and snippets.

@sergeycherepanov
Created October 20, 2014 06:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sergeycherepanov/d36d52d0a47f60709ccd to your computer and use it in GitHub Desktop.
Save sergeycherepanov/d36d52d0a47f60709ccd to your computer and use it in GitHub Desktop.
Minecraft - Convert cuboids data from WorldGuard to PreciousStones
INSERT INTO
`minecraft_ps`.pstone_cuboids (
`parent`,
`x` ,
`y`,
`z`,
`world`,
`minx`,
`maxx`,
`miny`,
`maxy`,
`minz`,
`maxz`,
`velocity`,
`type_id`,
`data`,
`owner`,
`name`,
`packed_allowed`,
`last_used`,
`flags` )
select 0 as `parent`, c.min_x as x, c.min_y as y, c.min_z as z, w.name as world, c.min_x, c.max_x, c.min_y, c.max_y, c.min_z, c.max_z,
0 as velocity,
193 as type_id,
0 as data,
o.name as `owner`,
c.`region_id` as name,
GROUP_CONCAT(u.name SEPARATOR "|") as packed_allowed,
0 as last_used,
'{"disabledFlags":["prevent-teleport","prevent-portal-enter","prevent-portal-destination","prevent-vehicle-enter","prevent-vehicle-exit"]}' as flags
from minecraft_worldguard.region_cuboid as c
left join minecraft_worldguard.world as w on c.`world_id` = w.`id`
left join minecraft_worldguard.region_players as cp on c.`region_id` = cp.`region_id` and cp.owner = 0
left join minecraft_worldguard.user as u on u.`id` = cp.`user_id` and u.name != '[[forestry]]' and u.name != '[forestry]'
left join minecraft_worldguard.region_players as co on c.`region_id` = co.`region_id` and co.owner = 1
left join minecraft_worldguard.user as o on o.`id` = co.`user_id`
where w.name not in ('worlds/hard-live', 'capital', 'hardcode', 'zombieapocalypse')
group by c.`region_id`;
insert into minecraft_ps.`pstone_players` (player_name, flags) select distinct username, '{"density":8}' as flags from `minecraft_authme`.`authme`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment