congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
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

  • Making http requests using okhttp
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • startActivity (Activity)
  • getSystemService (Context)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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