title: Get a Player from a Iterator Bukkit 1.16.5
body: <p>I have a problem that today is wearing me down deeply, I created a plugin that adds player to an arraylist  when clicking in an inventory (I did so unfortunately because I'm not very good), the game is only one and contains 2 player, I can't make sure that if a player exits, through a method, he can give victory to the other Player, I tried a lot of methods, this is the last one (In this code below I try to put a method where if I remotely understood it should send a victory message to the player, which obviously it does not and then execute LobbyJoin, which is a method that takes you to the lobby):</p>
  <pre><code>private void makeWinSupport(Player winner, Player loser) {
      if (playerInGame.contains(winner) &amp;&amp; playerInGame.contains(loser)) {
          winner.sendMessage(plugin.cc(&quot;&amp;6(!) Hai vinto!&quot;));
          LobbyJoin(loser);
          LobbyJoin(winner);
          playerInGame.remove(winner);
          playerInGame.remove(loser);
      }
  }
  
  public void makePlayerWin(Player loser) {
      Iterator&lt;Player&gt; i = playerInGame.iterator();
          System.out.println(1);
          if(i.hasNext() &amp;&amp; i == loser) {
              makeWinSupport(i.next(), loser);
  
          } else {
              makeWinSupport(playerInGame.get(0), loser);
          }
  
      @EventHandler
  public void onQuit(PlayerQuitEvent e) {
      e.setQuitMessage(&quot;&quot;);
      Player p = e.getPlayer();
      if(playerInGame.contains(p)) {
          makePlayerWin(p);
          }
      }
  }
  </code></pre>