function randomCoords(max) {
  return Math.floor(Math.random() * max);
}

function random(ary){
    return ary[Math.floor(Math.random()*ary.length)];
}

var dimensionName = ['the_bumblezone:the_bumblezone', 'undergarden:undergarden', 'javd:void', 'minecraft:the_nether', 'rats:ratlantis', 'gaiadimension:gaia_dimension', 'mythicbotany:alfheim', 'twilightforest:twilightforest', 'twilightforest:skylight_forest', 'atum:atum', 'tropicraft:tropics']

events.listen('item.right_click', event => {
	
  if (event.item.id == 'kubejs:extremely_unstable_endershard') {
	
	event.player.playSound('blue_skies:entity.alchemist.prepare_regen');
	event.player.playSound('minecraft:block.glass.break');
	event.server.runCommandSilent('effect give ' + event.player.name + ' champions:paralysis 7 0 true');
		
	event.server.schedule(5500, event.server, function (callback) {
	event.player.playSound('gateways:gate_end');
	callback.server.runCommandSilent('execute as ' + event.player.name + ' in '+random(dimensionName)+' run tp '+randomCoords(50000)+' '+randomCoords(250)+' '+randomCoords(50000));
	callback.server.tell([ text.yellow(event.entity.toString()), ' used an ', text.lightPurple('Extremely Unstable Ender Shard') ])
	  })

	  
	if (!event.player.isCreativeMode()) {
	
	event.item.setCount(event.item.getCount() - 1)
	}
	}
});