@Override protected void worldChanged(World world) { WorldConfigurationNode node = VanillaConfiguration.WORLDS.get(world); maxY = node.MAX_Y.getInt() & (~Chunk.BLOCKS.MASK); minY = node.MIN_Y.getInt() & (~Chunk.BLOCKS.MASK); stepY = node.STEP_Y.getInt() & (~Chunk.BLOCKS.MASK); lowY = maxY - stepY; highY = minY + stepY; lastY = Integer.MAX_VALUE; final DatatableComponent data = world.getComponentHolder().getData(); final Human human = player.get(Human.class); GameMode gamemode = null; Difficulty difficulty = data.get(VanillaData.DIFFICULTY); Dimension dimension = data.get(VanillaData.DIMENSION); WorldType worldType = data.get(VanillaData.WORLD_TYPE); int entityId = player.getId(); if (first) { first = false; if (human != null && human.getAttachedCount() > 1) { gamemode = human.getGameMode(); } else { gamemode = data.get(VanillaData.GAMEMODE); if (human != null) { human.setGamemode(gamemode); } } Server server = (Server) session.getEngine(); PlayerLoginRequestMessage idMsg = new PlayerLoginRequestMessage( entityId, worldType.toString(), gamemode.getId(), (byte) dimension.getId(), difficulty.getId(), (byte) server.getMaxPlayers()); player.getSession().send(false, true, idMsg); player.getSession().setState(State.GAME); } else { if (human != null) { gamemode = human.getGameMode(); } player .getSession() .send( false, new PlayerRespawnMessage( 0, difficulty.getId(), gamemode.getId(), 256, worldType.toString())); player .getSession() .send( false, new PlayerRespawnMessage( 1, difficulty.getId(), gamemode.getId(), 256, worldType.toString())); player .getSession() .send( false, new PlayerRespawnMessage( dimension.getId(), difficulty.getId(), gamemode.getId(), 256, worldType.toString())); } if (human != null) { if (first) { human.setGamemode(gamemode, false); } human.updateAbilities(); } PlayerInventory inv = player.get(PlayerInventory.class); if (inv != null) { inv.updateAll(); } Point pos = world.getSpawnPoint().getPosition(); PlayerSpawnPositionMessage SPMsg = new PlayerSpawnPositionMessage( (int) pos.getX(), (int) pos.getY(), (int) pos.getZ(), getRepositionManager()); player.getSession().send(false, SPMsg); session.send( false, new PlayerHeldItemChangeMessage( session .getPlayer() .add(PlayerInventory.class) .getQuickbar() .getSelectedSlot() .getIndex())); VanillaSky.getSky(world).updatePlayer(player); }