PlayerQuitReq.java :  » Game » inequity » packets » Java Open Source

Java Open Source » Game » inequity 
inequity » packets » PlayerQuitReq.java
package packets;

import elements.Consts.Priorities;
import network.Game;
import network.Lobby;

/**
 *
 * @author Joel Garboden
 */
public class PlayerQuitReq extends Request
{
  public final String playerName;

  public PlayerQuitReq(String playerName)
  {
    this.playerName = playerName;
    this.priority = Priorities.TURN_UPDATE;
  }

  public PlayerQuitReq(int playerID)
  {
    playerName = "";
    
    this.playerID = playerID;
    this.priority = Priorities.TURN_UPDATE;
  }

  @Override
  public boolean processRequest(Game game)
  {
    game.playerQuitCmd(playerName);
    return true;
  }
  
  @Override
  public boolean lobbyRequest(Lobby lobby)
  {
    lobby.playerQuitCmd(playerName);
    return true;
  }

  @Override
  public String toString()
  {
    return "playerQuitRequest from: " + playerName;
  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.