congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
Player.leave
Code IndexAdd Tabnine to your IDE (free)

How to use
leave
method
in
mage.players.Player

Best Java code snippets using mage.players.Player.leave (Showing top 4 results out of 315)

origin: magefree/mage

if (game.getStartTime() == null) {
  player.leave();
} else {
origin: magefree/mage

public void quitMatch(UUID userId) {
  UUID playerId = getPlayerId(userId);
  if (playerId != null) {
    if (allJoined()) {
      GameSessionPlayer gameSessionPlayer = gameSessions.get(playerId);
      if (gameSessionPlayer != null) {
        gameSessionPlayer.quitGame();
      }
    } else {
      // The player did never join the game but the game controller was started because the player was still connected as the
      // game was started. But the Client never called the join action. So now after the user is expired, the
      // quit match is called and has to end the game, because the player never joined the game.
      Player player = game.getPlayer(playerId);
      if (player != null) {
        player.leave();
        checkStart(); // => So the game starts and gets an result or multiplayer game starts with active players
      }
    }
  }
}
origin: magefree/mage

private void sendInfoAboutPlayersNotJoinedYet() {
  for (Player player : game.getPlayers().values()) {
    if (!player.hasLeft() && player.isHuman()) {
      Optional<User> requestedUser = getUserByPlayerId(player.getId());
      if (requestedUser.isPresent()) {
        User user = requestedUser.get();
        if (!user.isConnected()) {
          if (gameSessions.get(player.getId()) == null) {
            // join the game because player has not joined are was removed because of disconnect
            user.removeConstructing(player.getId());
            GameManager.instance.joinGame(game.getId(), user.getId());
            logger.debug("Player " + player.getName() + " (disconnected) has joined gameId: " + game.getId());
          }
          ChatManager.instance.broadcast(chatId, player.getName(), user.getPingInfo() + " is pending to join the game", MessageColor.BLUE, true, ChatMessage.MessageType.STATUS, null);
          if (user.getSecondsDisconnected() > 240) {
            // Cancel player join possibility lately after 4 minutes
            logger.debug("Player " + player.getName() + " - canceled game (after 240 seconds) gameId: " + game.getId());
            player.leave();
          }
        }
      } else if (!player.hasLeft()) {
        logger.debug("Player " + player.getName() + " canceled game (no user) gameId: " + game.getId());
        player.leave();
      }
    }
  }
  checkStart();
}
origin: magefree/mage

player.leave();
if (checkIfGameIsOver()) {
mage.playersPlayerleave

Popular methods of Player

  • getId
  • getHand
  • getName
  • getLife
  • getLibrary
  • hasLeft
  • hasWon
  • getCounters
  • hasLost
  • copy
  • damage
  • declareAttacker
  • damage,
  • declareAttacker,
  • getGraveyard,
  • getPlayersUnderYourControl,
  • activateAbility,
  • canLose,
  • choose,
  • declareBlocker,
  • gainLife,
  • getAttachments

Popular in Java

  • Creating JSON documents from java classes using gson
  • requestLocationUpdates (LocationManager)
  • getSupportFragmentManager (FragmentActivity)
  • notifyDataSetChanged (ArrayAdapter)
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • JTable (javax.swing)
  • Top 17 PhpStorm Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now