[SOLVED]How to code Teleportation between Dimensions?

Yeah game is null. So is player

@Inject
Game game;

@Listener
public void onChangeBlockEvent(ChangeBlockEvent.Break event) {
	if (!event.getCause().first(Player.class).isPresent()) {
		return;
	}
	Player player = event.getCause().first(Player.class).get();
	Optional<World> worldOpt = Main.getGame().getServer().getWorld("world");
	if(worldOpt.isPresent()){
		World w = worldOpt.get();
		player.setLocation(w.getSpawnLocation());
	}
}

It will “inject” an instance of that type into the field. This is called Dependency Injection, Sponge uses Google’s Guice.

As a side-note, you can now get the game instance with Sponge.getGame()

Also, I see you’ve got a field Player player;
This is also going to be null unless it’s initialized somewhere. I doubt you want to hold a single player instance in your plugin, there can be more than one player you know.
If you want to get the player that broke the block, then you need to inspect the cause like so:
Optional<Player> optPlayer = event.getCause().first(Player.class);
and if optPlayer is not present, simply return because the block was not broken by a player.