public void sendLevelFinish() {
    TaskQueue.getTaskQueue()
        .push(
            new Task() {
              public void execute() {
                try {
                  // for thread safety
                  final Level level = World.getWorld().getLevel();
                  PacketBuilder bldr =
                      new PacketBuilder(
                          PersistingPacketManager.getPacketManager().getOutgoingPacket(4));
                  bldr.putShort("width", level.getWidth());
                  bldr.putShort("height", level.getHeight());
                  bldr.putShort("depth", level.getDepth());
                  session.send(bldr.toPacket());
                  Position spawn = level.getSpawnPosition();
                  Rotation r = level.getSpawnRotation();
                  sendSpawn(
                      (byte) -1,
                      session.getPlayer().nameId,
                      session.getPlayer().getColoredName(),
                      session.getPlayer().getTeamName(),
                      session.getPlayer().getName(),
                      session.getPlayer().getListName(),
                      session.getPlayer().getSkinUrl(),
                      spawn.getX(),
                      spawn.getY(),
                      spawn.getZ(),
                      (byte) r.getRotation(),
                      (byte) r.getLook(),
                      false,
                      true);
                  // now load the player's game (TODO in the future do this in parallel with loading
                  // the
                  // level)
                  SavedGameManager.getSavedGameManager()
                      .queuePersistenceRequest(new LoadPersistenceRequest(session.getPlayer()));
                  session.setReady();
                  World.getWorld().completeRegistration(session);
                } catch (Exception ex) {
                  Server.log(ex);
                }
              }
            });
  }
public void sendLevelFinish() {
    TaskQueue.getTaskQueue()
        .push(
            new Task() {
              public void execute() {
                try {
                 
                  final Level level = World.getWorld().getLevel();
                  PacketBuilder bldr =
                      new PacketBuilder(
                          PersistingPacketManager.getPacketManager().getOutgoingPacket(4));
                  bldr.putShort("width", level.getWidth());
                  bldr.putShort("height", level.getHeight());
                  bldr.putShort("depth", level.getDepth());
                  session.send(bldr.toPacket());
                  Position spawn = level.getSpawnPosition();
                  Rotation r = level.getSpawnRotation();
                  sendSpawn(
                      (byte) -1,
                      session.getPlayer().nameId,
                      session.getPlayer().getColoredName(),
                      session.getPlayer().getTeamName(),
                      session.getPlayer().getName(),
                      session.getPlayer().getListName(),
                      session.getPlayer().getSkinUrl(),
                      spawn.getX(),
                      spawn.getY(),
                      spawn.getZ(),
                      (byte) r.getRotation(),
                      (byte) r.getLook(),
                      false,
                      true);
                 
                 
                 
                  SavedGameManager.getSavedGameManager()
                      .queuePersistenceRequest(new LoadPersistenceRequest(session.getPlayer()));
                  session.setReady();
                  World.getWorld().completeRegistration(session);
                } catch (Exception ex) {
                  Server.log(ex);
                }
              }
            });
  }
public void sendlevelfinish() { taskqueue.gettaskqueue() .push( new task() { public void execute() { try { final level level = world.getworld().getlevel(); packetbuilder bldr = new packetbuilder( persistingpacketmanager.getpacketmanager().getoutgoingpacket(4)); bldr.putshort("width", level.getwidth()); bldr.putshort("height", level.getheight()); bldr.putshort("depth", level.getdepth()); session.send(bldr.topacket()); position spawn = level.getspawnposition(); rotation r = level.getspawnrotation(); sendspawn( (byte) -1, session.getplayer().nameid, session.getplayer().getcoloredname(), session.getplayer().getteamname(), session.getplayer().getname(), session.getplayer().getlistname(), session.getplayer().getskinurl(), spawn.getx(), spawn.gety(), spawn.getz(), (byte) r.getrotation(), (byte) r.getlook(), false, true); savedgamemanager.getsavedgamemanager() .queuepersistencerequest(new loadpersistencerequest(session.getplayer())); session.setready(); world.getworld().completeregistration(session); } catch (exception ex) { server.log(ex); } } }); }