daily pastebin goal
24%
SHARE
TWEET

Untitled

a guest May 31st, 2017 63 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.  
  5. import org.apache.mina.core.future.IoFuture;
  6. import org.apache.mina.core.future.IoFutureListener;
  7. import org.apache.mina.core.session.IoSession;
  8.  
  9. import com.ares.rs2.model.World;
  10. import com.ares.rs2.net.PacketBuilder;
  11.  
  12. public class PlayerRequest {
  13.     public PlayerRequest(IoSession session, String username, String password) {
  14.         this.session = session;
  15.         this.username = username;
  16.         this.password = password;
  17.     }
  18.    
  19.     public void service() throws Exception {
  20.         File file = new File("./savedGames/" + username + ".dat");
  21.         int returnCode = 2;
  22.         if(file.exists()) {
  23.         }
  24.         PacketBuilder pb = new PacketBuilder();
  25.         pb.put((byte)returnCode);
  26.         if(returnCode == 2) {
  27.             pb.put((byte)0).put((byte)0);
  28.         }
  29.         final int code = returnCode;
  30.         session.write(pb.toPacket()).addListener(new IoFutureListener<IoFuture>() {
  31.             public void operationComplete(IoFuture arg0) {
  32.                 if(code == 2) {
  33.                     World.getInstance().register(new Player(session, username, password));
  34.                 } else {
  35.                     session.close(false);
  36.                 }
  37.             }
  38.         });
  39.     }
  40.    
  41.     private IoSession session;
  42.     private String username;
  43.     private String password;
  44. }
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