Advertisement
Guest User

Untitled

a guest
May 20th, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.96 KB | None | 0 0
  1. package exipe.server.game.player;
  2.  
  3. import exipe.server.game.Game;
  4. import exipe.server.game.PlayerHandler;
  5. import exipe.server.net.client.Client;
  6.  
  7. public final class Player {
  8.  
  9.     private final Client client;
  10.     private final Game game;
  11.    
  12.     private final Output out =
  13.             new Output(this);
  14.    
  15.     private final Updating updating =
  16.             new Updating(this);
  17.    
  18.     private VisiblePlayers visibles =
  19.             new VisiblePlayers(this);
  20.    
  21.     private final String username, password;
  22.     private int staffRights, posX, posY, height;
  23.    
  24.     public Player(Client client, String username, String password, Game game) {
  25.         this.client = client;
  26.         this.username = username;
  27.         this.password = password;
  28.         this.game = game;
  29.     }
  30.    
  31.     public void login() {
  32.         PlayerHandler ph = game.players();
  33.         if(ph.getByName(username) != null) {
  34.             out.sendLoginResponse(5);
  35.             client.disconnect();
  36.             return;
  37.         }
  38.        
  39.         game.players().put(client.key(), this);
  40.        
  41.         out.sendLoginResponse(2);
  42.         out.sendMessage("Welcome to Evito RSPS.");
  43.         int[] interfaces = {2423, 3917, 638, 3213, 1644, 5608, 1151, -1, 5065, 5715, 2449, 4445, 147, -1};
  44.         int counter=0;
  45.         for(int i : interfaces) {
  46.             out.sendSidebarInterface(counter, i);
  47.             counter++;
  48.         }
  49.         out.sendRegion();
  50.     }
  51.    
  52.     public void process() {
  53.         out.sendUpdating();
  54.     }
  55.    
  56.     public void moveTo(int x, int y, int height) {
  57.         posX = x;
  58.         posY = y;
  59.         this.height = height;
  60.     }
  61.    
  62.     public void logout() {
  63.         game.players().remove(client.key());
  64.         visibles.removeSelf();
  65.     }
  66.    
  67.     public Client client() {
  68.         return client;
  69.     }
  70.    
  71.     public Output out() {
  72.         return out;
  73.     }
  74.    
  75.     public Updating updating() {
  76.         return updating;
  77.     }
  78.    
  79.     public VisiblePlayers visibles() {
  80.         return visibles;
  81.     }
  82.    
  83.     public String username() {
  84.         return username;
  85.     }
  86.    
  87.     public String password() {
  88.         return password;
  89.     }
  90.    
  91.     public int staffRights() { return staffRights; }
  92.     public int x() { return posX; }
  93.     public int y() { return posY; }
  94.     public int height() { return height; }
  95.    
  96. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement