SHARE
TWEET

Untitled

a guest May 31st, 2017 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.ares.rs2.model.player;
  2.  
  3. import java.io.File;
  4. import java.io.RandomAccessFile;
  5.  
  6. import org.apache.mina.core.future.IoFuture;
  7. import org.apache.mina.core.future.IoFutureListener;
  8. import org.apache.mina.core.session.IoSession;
  9.  
  10. import com.ares.rs2.model.World;
  11. import com.ares.rs2.net.PacketBuilder;
  12.  
  13. public class PlayerRequest {
  14.     public PlayerRequest(IoSession session, String username, String password) {
  15.         this.session = session;
  16.         this.username = username;
  17.         this.password = password;
  18.     }
  19.    
  20.     public void service(World world) throws Exception {
  21.         File file = new File("./savedGames/" + username + ".dat");
  22.         int returnCode = 2;
  23.         if(file.exists()) {
  24.         }
  25.         PacketBuilder pb = new PacketBuilder();
  26.         pb.put((byte)returnCode);
  27.         if(returnCode == 2) {
  28.             pb.put((byte)0).put((byte)0);
  29.         }
  30.         final int code = returnCode;
  31.         session.write(pb.toPacket()).addListener(new IoFutureListener<IoFuture>() {
  32.             public void operationComplete(IoFuture arg0) {
  33.                 if(code == 2) {
  34.                     World.getInstance().register(new Player(session, username, password));
  35.                 } else {
  36.                     session.close(false);
  37.                 }
  38.             }
  39.         });
  40.     }
  41.    
  42.     private IoSession session;
  43.     private String username;
  44.     private String password;
  45. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top