Files
2026-06-19 23:09:49 +02:00

669 lines
50 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE HTML>
<html lang="it">
<head>
<!-- Generated by javadoc (25) on Fri Jun 19 23:05:23 CEST 2026 -->
<title>GameEventProcessor</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="dc.created" content="2026-06-19">
<meta name="description" content="declaration: module: it.polimi.ingsw.gc14, package: it.polimi.ingsw.gc14, class: GameEventProcessor">
<meta name="generator" content="javadoc/ClassWriter">
<link rel="stylesheet" type="text/css" href="../../../../../resource-files/jquery-ui.min.css">
<link rel="stylesheet" type="text/css" href="../../../../../resource-files/stylesheet.css">
<script type="text/javascript" src="../../../../../script-files/script.js"></script>
<script type="text/javascript" src="../../../../../script-files/jquery-3.7.1.min.js"></script>
<script type="text/javascript" src="../../../../../script-files/jquery-ui.min.js"></script>
</head>
<body class="class-declaration-page">
<script type="text/javascript">const pathtoroot = "../../../../../";
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<header role="banner">
<nav role="navigation">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="top-nav" id="navbar-top">
<div class="nav-content">
<div class="nav-menu-button"><button id="navbar-toggle-button" aria-controls="navbar-top" aria-expanded="false" aria-label="Toggle navigation links"><span class="nav-bar-toggle-icon">&nbsp;</span><span class="nav-bar-toggle-icon">&nbsp;</span><span class="nav-bar-toggle-icon">&nbsp;</span></button></div>
<div class="skip-nav"><a href="#skip-navbar-top" title="Skip navigation links">Skip navigation links</a></div>
<ul id="navbar-top-firstrow" class="nav-list" title="Navigation">
<li><a href="../../../../module-summary.html">Module</a></li>
<li class="nav-bar-cell1-rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../index-files/index-1.html">Index</a></li>
<li><a href="../../../../../search.html">Search</a></li>
<li><a href="../../../../../help-doc.html#class">Help</a></li>
</ul>
</div>
</div>
<div class="sub-nav">
<div class="nav-content">
<ol class="sub-nav-list">
<li><a href="../../../../module-summary.html">it.polimi.ingsw.gc14</a></li>
<li><a href="package-summary.html">it.polimi.ingsw.gc14</a></li>
<li><a href="GameEventProcessor.html" class="current-selection">GameEventProcessor</a></li>
</ol>
<div class="nav-list-search"><input type="text" id="search-input" disabled placeholder="Search documentation (type /)" aria-label="Search in documentation" autocomplete="off" spellcheck="false"><input type="reset" id="reset-search" disabled value="Reset"></div>
</div>
</div>
<!-- ========= END OF TOP NAVBAR ========= -->
<span class="skip-nav" id="skip-navbar-top"></span></nav>
</header>
<div class="main-grid">
<nav role="navigation" class="toc" aria-label="Table of contents">
<div class="toc-header">Contents&nbsp;<input type="text" class="filter-input" disabled placeholder="Filter contents (type .)" aria-label="Filter table of contents" autocomplete="off" spellcheck="false"><input type="reset" class="reset-filter" disabled tabindex="-1" value="Reset"></div>
<ol class="toc-list" tabindex="-1">
<li><a href="#" tabindex="0">Description</a></li>
<li><a href="#field-summary" tabindex="0">Field Summary</a></li>
<li><a href="#constructor-summary" tabindex="0">Constructor Summary</a></li>
<li><a href="#method-summary" tabindex="0">Method Summary</a></li>
<li><a href="#field-detail" tabindex="0">Field Details</a>
<ol class="toc-list">
<li><a href="#actionQueue" tabindex="0">actionQueue</a></li>
<li><a href="#gameController" tabindex="0">gameController</a></li>
<li><a href="#playerList" tabindex="0">playerList</a></li>
<li><a href="#broadcaster" tabindex="0">broadcaster</a></li>
<li><a href="#saveManager" tabindex="0">saveManager</a></li>
<li><a href="#timerExecutor" tabindex="0">timerExecutor</a></li>
<li><a href="#disconnectionTimer" tabindex="0">disconnectionTimer</a></li>
</ol>
</li>
<li><a href="#constructor-detail" tabindex="0">Constructor Details</a>
<ol class="toc-list">
<li><a href="#%3Cinit%3E(java.util.concurrent.BlockingQueue,it.polimi.ingsw.gc14.Controller.GameController,it.polimi.ingsw.gc14.LimitedMap,it.polimi.ingsw.gc14.Network.CompositeClientBroadcaster,it.polimi.ingsw.gc14.SaveManager)" tabindex="0">GameEventProcessor(BlockingQueue, GameController, LimitedMap, CompositeClientBroadcaster, SaveManager)</a></li>
</ol>
</li>
<li><a href="#method-detail" tabindex="0">Method Details</a>
<ol class="toc-list">
<li><a href="#doFirstEvent()" tabindex="0">doFirstEvent()</a></li>
<li><a href="#isGameActive()" tabindex="0">isGameActive()</a></li>
<li><a href="#isSuspended()" tabindex="0">isSuspended()</a></li>
<li><a href="#handleInactiveGame(it.polimi.ingsw.gc14.Network.NetworkEvent)" tabindex="0">handleInactiveGame(NetworkEvent)</a></li>
<li><a href="#handleSuspendedGame(it.polimi.ingsw.gc14.Network.NetworkEvent)" tabindex="0">handleSuspendedGame(NetworkEvent)</a></li>
<li><a href="#abortGame()" tabindex="0">abortGame()</a></li>
<li><a href="#rejectEvent(it.polimi.ingsw.gc14.Network.NetworkEvent)" tabindex="0">rejectEvent(NetworkEvent)</a></li>
<li><a href="#applyAndBroadcast(it.polimi.ingsw.gc14.Network.NetworkEvent)" tabindex="0">applyAndBroadcast(NetworkEvent)</a></li>
<li><a href="#cancelForfeitTimerIfReconnect(it.polimi.ingsw.gc14.Network.NetworkEvent)" tabindex="0">cancelForfeitTimerIfReconnect(NetworkEvent)</a></li>
<li><a href="#enrichEvent(it.polimi.ingsw.gc14.Network.NetworkEvent,it.polimi.ingsw.gc14.Model.Game)" tabindex="0">enrichEvent(NetworkEvent, Game)</a></li>
<li><a href="#startForfeitTimerIfNeeded(it.polimi.ingsw.gc14.Network.NetworkEvent,it.polimi.ingsw.gc14.Model.Game)" tabindex="0">startForfeitTimerIfNeeded(NetworkEvent, Game)</a></li>
<li><a href="#endGameForfeit(it.polimi.ingsw.gc14.Model.Game)" tabindex="0">endGameForfeit(Game)</a></li>
<li><a href="#broadcastResult(it.polimi.ingsw.gc14.Network.NetworkEvent,it.polimi.ingsw.gc14.Model.Game,int)" tabindex="0">broadcastResult(NetworkEvent, Game, int)</a></li>
<li><a href="#onlinePlayerCount()" tabindex="0">onlinePlayerCount()</a></li>
<li><a href="#buildDisconnectedList(it.polimi.ingsw.gc14.Model.Game)" tabindex="0">buildDisconnectedList(Game)</a></li>
<li><a href="#removeOfflinePlayers()" tabindex="0">removeOfflinePlayers()</a></li>
</ol>
</li>
</ol>
<button class="hide-sidebar"><span>Hide sidebar&nbsp;</span><img src="../../../../../resource-files/left.svg" alt="Hide sidebar"></button><button class="show-sidebar"><img src="../../../../../resource-files/right.svg" alt="Show sidebar"><span>&nbsp;Show sidebar</span></button></nav>
<main role="main">
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<h1 title="Class GameEventProcessor" class="title">Class GameEventProcessor</h1>
</div>
<div class="inheritance" title="Inheritance Tree"><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">java.lang.Object</a>
<div class="inheritance">it.polimi.ingsw.gc14.GameEventProcessor</div>
</div>
<section class="class-description" id="class-description">
<hr>
<div class="horizontal-scroll">
<div class="type-signature"><span class="modifiers">public class </span><span class="element-name type-name-label">GameEventProcessor</span>
<span class="extends-implements">extends <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></span></div>
<div class="block">Processes game events from the action queue and routes each one
based on the current game state.
<p>The three top-level states that determine routing are:
<ul>
<li><b>Inactive</b> no game model is present, or the game has ended.
Only disconnection cleanup is performed.</li>
<li><b>Suspended</b> a forfeit timer is running because exactly one
player remains online. Only reconnection events are accepted.</li>
<li><b>Active</b> normal gameplay; every event is applied, saved,
and broadcast.</li>
</ul>
<p>This class is not thread-safe by itself: it relies on the caller
(the game loop in <code>ServerLauncher</code>) to drive it from a single
thread via <a href="#doFirstEvent()"><code>doFirstEvent()</code></a>.</div>
</div>
</section>
<section class="summary">
<ul class="summary-list">
<!-- =========== FIELD SUMMARY =========== -->
<li>
<section class="field-summary" id="field-summary">
<h2>Field Summary</h2>
<div class="caption"><span>Fields</span></div>
<div class="summary-table three-column-summary">
<div class="table-header col-first">Modifier and Type</div>
<div class="table-header col-second">Field</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color"><code>private final <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/BlockingQueue.html" title="class or interface in java.util.concurrent" class="external-link">BlockingQueue</a><wbr>&lt;<a href="Network/NetworkEvent.html" title="class in it.polimi.ingsw.gc14.Network">NetworkEvent</a>&gt;</code></div>
<div class="col-second even-row-color"><code><a href="#actionQueue" class="member-name-link">actionQueue</a></code></div>
<div class="col-last even-row-color">
<div class="block">Queue from which incoming client events are consumed one at a time.</div>
</div>
<div class="col-first odd-row-color"><code>private final <a href="Network/CompositeClientBroadcaster.html" title="class in it.polimi.ingsw.gc14.Network">CompositeClientBroadcaster</a></code></div>
<div class="col-second odd-row-color"><code><a href="#broadcaster" class="member-name-link">broadcaster</a></code></div>
<div class="col-last odd-row-color">
<div class="block">Broadcaster used to push events and model snapshots to all connected clients.</div>
</div>
<div class="col-first even-row-color"><code>private <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/ScheduledFuture.html" title="class or interface in java.util.concurrent" class="external-link">ScheduledFuture</a><wbr>&lt;?&gt;</code></div>
<div class="col-second even-row-color"><code><a href="#disconnectionTimer" class="member-name-link">disconnectionTimer</a></code></div>
<div class="col-last even-row-color">
<div class="block">Handle to the running forfeit timer, or <code>null</code> when no timer is active.</div>
</div>
<div class="col-first odd-row-color"><code>private final <a href="Controller/GameController.html" title="class in it.polimi.ingsw.gc14.Controller">GameController</a></code></div>
<div class="col-second odd-row-color"><code><a href="#gameController" class="member-name-link">gameController</a></code></div>
<div class="col-last odd-row-color">
<div class="block">Server-side game controller; all model mutations go through this.</div>
</div>
<div class="col-first even-row-color"><code>private final <a href="LimitedMap.html" title="class in it.polimi.ingsw.gc14">LimitedMap</a><wbr>&lt;<a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>,<wbr><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Boolean.html" title="class or interface in java.lang" class="external-link">Boolean</a>&gt;</code></div>
<div class="col-second even-row-color"><code><a href="#playerList" class="member-name-link">playerList</a></code></div>
<div class="col-last even-row-color">
<div class="block">Shared map tracking each player's online status (<code>true</code> = online).</div>
</div>
<div class="col-first odd-row-color"><code>private final <a href="SaveManager.html" title="class in it.polimi.ingsw.gc14">SaveManager</a></code></div>
<div class="col-second odd-row-color"><code><a href="#saveManager" class="member-name-link">saveManager</a></code></div>
<div class="col-last odd-row-color">
<div class="block">Persists and deletes game save files.</div>
</div>
<div class="col-first even-row-color"><code>private final <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/ScheduledExecutorService.html" title="class or interface in java.util.concurrent" class="external-link">ScheduledExecutorService</a></code></div>
<div class="col-second even-row-color"><code><a href="#timerExecutor" class="member-name-link">timerExecutor</a></code></div>
<div class="col-last even-row-color">
<div class="block">Single-thread executor used exclusively for the forfeit timer.</div>
</div>
</div>
</section>
</li>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<li>
<section class="constructor-summary" id="constructor-summary">
<h2>Constructor Summary</h2>
<div class="caption"><span>Constructors</span></div>
<div class="summary-table two-column-summary">
<div class="table-header col-first">Constructor</div>
<div class="table-header col-last">Description</div>
<div class="col-constructor-name even-row-color"><code><a href="#%3Cinit%3E(java.util.concurrent.BlockingQueue,it.polimi.ingsw.gc14.Controller.GameController,it.polimi.ingsw.gc14.LimitedMap,it.polimi.ingsw.gc14.Network.CompositeClientBroadcaster,it.polimi.ingsw.gc14.SaveManager)" class="member-name-link">GameEventProcessor</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/BlockingQueue.html" title="class or interface in java.util.concurrent" class="external-link">BlockingQueue</a>&lt;<a href="Network/NetworkEvent.html" title="class in it.polimi.ingsw.gc14.Network">NetworkEvent</a>&gt;&nbsp;actionQueue,
<a href="Controller/GameController.html" title="class in it.polimi.ingsw.gc14.Controller">GameController</a>&nbsp;gameController,
<a href="LimitedMap.html" title="class in it.polimi.ingsw.gc14">LimitedMap</a>&lt;<a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>,<wbr><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Boolean.html" title="class or interface in java.lang" class="external-link">Boolean</a>&gt;&nbsp;playerList,
<a href="Network/CompositeClientBroadcaster.html" title="class in it.polimi.ingsw.gc14.Network">CompositeClientBroadcaster</a>&nbsp;broadcaster,
<a href="SaveManager.html" title="class in it.polimi.ingsw.gc14">SaveManager</a>&nbsp;saveManager)</code></div>
<div class="col-last even-row-color">
<div class="block">Constructs a <code>GameEventProcessor</code> with all required dependencies.</div>
</div>
</div>
</section>
</li>
<!-- ========== METHOD SUMMARY =========== -->
<li>
<section class="method-summary" id="method-summary">
<h2>Method Summary</h2>
<div id="method-summary-table">
<div class="table-tabs" role="tablist" aria-orientation="horizontal"><button id="method-summary-table-tab0" role="tab" aria-selected="true" aria-controls="method-summary-table.tabpanel" tabindex="0" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table', 3)" class="active-table-tab">All Methods</button><button id="method-summary-table-tab2" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab2', 3)" class="table-tab">Instance Methods</button><button id="method-summary-table-tab4" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab4', 3)" class="table-tab">Concrete Methods</button></div>
<div id="method-summary-table.tabpanel" role="tabpanel" aria-labelledby="method-summary-table-tab0">
<div class="summary-table three-column-summary">
<div class="table-header col-first">Modifier and Type</div>
<div class="table-header col-second">Method</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>private void</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#abortGame()" class="member-name-link">abortGame</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Cancels the forfeit timer, clears the player list, and resets the model.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>private void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#applyAndBroadcast(it.polimi.ingsw.gc14.Network.NetworkEvent)" class="member-name-link">applyAndBroadcast</a><wbr>(<a href="Network/NetworkEvent.html" title="class in it.polimi.ingsw.gc14.Network">NetworkEvent</a>&nbsp;event)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Applies the event to the game controller, saves the updated state,
and broadcasts the result to connected clients.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>private void</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#broadcastResult(it.polimi.ingsw.gc14.Network.NetworkEvent,it.polimi.ingsw.gc14.Model.Game,int)" class="member-name-link">broadcastResult</a><wbr>(<a href="Network/NetworkEvent.html" title="class in it.polimi.ingsw.gc14.Network">NetworkEvent</a>&nbsp;event,
<a href="Model/Game.html" title="class in it.polimi.ingsw.gc14.Model">Game</a>&nbsp;game,
int&nbsp;roundBefore)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Determines what to broadcast after a successful event application:
If the round advanced, an <a href="Network/NetworkEvents/ApplyNextRound.html" title="class in it.polimi.ingsw.gc14.Network.NetworkEvents"><code>ApplyNextRound</code></a> event (with updated
card lists) replaces the original event.
If the game has ended, an <a href="Network/NetworkEvents/EndedGame.html" title="class in it.polimi.ingsw.gc14.Network.NetworkEvents"><code>EndedGame</code></a> event is sent and the
save file is deleted.
Otherwise the original event is broadcast as-is.
</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>private <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/ArrayList.html" title="class or interface in java.util" class="external-link">ArrayList</a><wbr>&lt;<a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&gt;</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#buildDisconnectedList(it.polimi.ingsw.gc14.Model.Game)" class="member-name-link">buildDisconnectedList</a><wbr>(<a href="Model/Game.html" title="class in it.polimi.ingsw.gc14.Model">Game</a>&nbsp;game)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Builds the list of usernames of players currently marked as disconnected
in the game model.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>private void</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#cancelForfeitTimerIfReconnect(it.polimi.ingsw.gc14.Network.NetworkEvent)" class="member-name-link">cancelForfeitTimerIfReconnect</a><wbr>(<a href="Network/NetworkEvent.html" title="class in it.polimi.ingsw.gc14.Network">NetworkEvent</a>&nbsp;event)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Cancels the forfeit timer if the event is a successful reconnection.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#doFirstEvent()" class="member-name-link">doFirstEvent</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Blocks until one event is available in the queue, then routes it to the
appropriate handler based on the current game state.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>private void</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#endGameForfeit(it.polimi.ingsw.gc14.Model.Game)" class="member-name-link">endGameForfeit</a><wbr>(<a href="Model/Game.html" title="class in it.polimi.ingsw.gc14.Model">Game</a>&nbsp;game)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Ends the game by forfeit when the timer expires without a reconnection.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>private void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#enrichEvent(it.polimi.ingsw.gc14.Network.NetworkEvent,it.polimi.ingsw.gc14.Model.Game)" class="member-name-link">enrichEvent</a><wbr>(<a href="Network/NetworkEvent.html" title="class in it.polimi.ingsw.gc14.Network">NetworkEvent</a>&nbsp;event,
<a href="Model/Game.html" title="class in it.polimi.ingsw.gc14.Model">Game</a>&nbsp;game)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Populates the event with the current game state so that clients can
update their mini-model after receiving it.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>private void</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#handleInactiveGame(it.polimi.ingsw.gc14.Network.NetworkEvent)" class="member-name-link">handleInactiveGame</a><wbr>(<a href="Network/NetworkEvent.html" title="class in it.polimi.ingsw.gc14.Network">NetworkEvent</a>&nbsp;event)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Handles events that arrive when no active game exists (not yet started,
or already ended).</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>private void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#handleSuspendedGame(it.polimi.ingsw.gc14.Network.NetworkEvent)" class="member-name-link">handleSuspendedGame</a><wbr>(<a href="Network/NetworkEvent.html" title="class in it.polimi.ingsw.gc14.Network">NetworkEvent</a>&nbsp;event)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Routes events while the game is suspended waiting for a reconnection.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>private boolean</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#isGameActive()" class="member-name-link">isGameActive</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns <code>true</code> when there is an ongoing game that has not yet ended.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>private boolean</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#isSuspended()" class="member-name-link">isSuspended</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns <code>true</code> when the forfeit timer is running, meaning only one
player is currently online and the game is waiting for a reconnection.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>private long</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#onlinePlayerCount()" class="member-name-link">onlinePlayerCount</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Returns the number of players currently marked as online in the player list.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>private void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#rejectEvent(it.polimi.ingsw.gc14.Network.NetworkEvent)" class="member-name-link">rejectEvent</a><wbr>(<a href="Network/NetworkEvent.html" title="class in it.polimi.ingsw.gc14.Network">NetworkEvent</a>&nbsp;event)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Marks the event as an error and broadcasts it back to the requesting
player.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>private void</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#removeOfflinePlayers()" class="member-name-link">removeOfflinePlayers</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Removes all offline entries (value <code>false</code>) from the player list.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>private void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#startForfeitTimerIfNeeded(it.polimi.ingsw.gc14.Network.NetworkEvent,it.polimi.ingsw.gc14.Model.Game)" class="member-name-link">startForfeitTimerIfNeeded</a><wbr>(<a href="Network/NetworkEvent.html" title="class in it.polimi.ingsw.gc14.Network">NetworkEvent</a>&nbsp;event,
<a href="Model/Game.html" title="class in it.polimi.ingsw.gc14.Model">Game</a>&nbsp;game)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">
<div class="block">Schedules the 60-second forfeit timer if a disconnection has left
exactly one player online.</div>
</div>
</div>
</div>
</div>
<div class="inherited-list">
<h3 id="methods-inherited-from-class-java.lang.Object">Methods inherited from class&nbsp;<a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#method-summary" title="class or interface in java.lang" class="external-link">Object</a></h3>
<code><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#clone()" title="class or interface in java.lang" class="external-link">clone</a>, <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#equals(java.lang.Object)" title="class or interface in java.lang" class="external-link">equals</a>, <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#finalize()" title="class or interface in java.lang" class="external-link">finalize</a>, <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#getClass()" title="class or interface in java.lang" class="external-link">getClass</a>, <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#hashCode()" title="class or interface in java.lang" class="external-link">hashCode</a>, <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#notify()" title="class or interface in java.lang" class="external-link">notify</a>, <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#notifyAll()" title="class or interface in java.lang" class="external-link">notifyAll</a>, <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#toString()" title="class or interface in java.lang" class="external-link">toString</a>, <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait()" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait(long)" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Object.html#wait(long,int)" title="class or interface in java.lang" class="external-link">wait</a></code></div>
</section>
</li>
</ul>
</section>
<section class="details">
<ul class="details-list">
<!-- ============ FIELD DETAIL =========== -->
<li>
<section class="field-details" id="field-detail">
<h2>Field Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="actionQueue">
<h3>actionQueue</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">private final</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/BlockingQueue.html" title="class or interface in java.util.concurrent" class="external-link">BlockingQueue</a>&lt;<a href="Network/NetworkEvent.html" title="class in it.polimi.ingsw.gc14.Network">NetworkEvent</a>&gt;</span>&nbsp;<span class="element-name">actionQueue</span></div>
<div class="block">Queue from which incoming client events are consumed one at a time.</div>
</div>
</section>
</li>
<li>
<section class="detail" id="gameController">
<h3>gameController</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">private final</span>&nbsp;<span class="return-type"><a href="Controller/GameController.html" title="class in it.polimi.ingsw.gc14.Controller">GameController</a></span>&nbsp;<span class="element-name">gameController</span></div>
<div class="block">Server-side game controller; all model mutations go through this.</div>
</div>
</section>
</li>
<li>
<section class="detail" id="playerList">
<h3>playerList</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">private final</span>&nbsp;<span class="return-type"><a href="LimitedMap.html" title="class in it.polimi.ingsw.gc14">LimitedMap</a>&lt;<a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>,<wbr><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Boolean.html" title="class or interface in java.lang" class="external-link">Boolean</a>&gt;</span>&nbsp;<span class="element-name">playerList</span></div>
<div class="block">Shared map tracking each player's online status (<code>true</code> = online).</div>
</div>
</section>
</li>
<li>
<section class="detail" id="broadcaster">
<h3>broadcaster</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">private final</span>&nbsp;<span class="return-type"><a href="Network/CompositeClientBroadcaster.html" title="class in it.polimi.ingsw.gc14.Network">CompositeClientBroadcaster</a></span>&nbsp;<span class="element-name">broadcaster</span></div>
<div class="block">Broadcaster used to push events and model snapshots to all connected clients.</div>
</div>
</section>
</li>
<li>
<section class="detail" id="saveManager">
<h3>saveManager</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">private final</span>&nbsp;<span class="return-type"><a href="SaveManager.html" title="class in it.polimi.ingsw.gc14">SaveManager</a></span>&nbsp;<span class="element-name">saveManager</span></div>
<div class="block">Persists and deletes game save files.</div>
</div>
</section>
</li>
<li>
<section class="detail" id="timerExecutor">
<h3>timerExecutor</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">private final</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/ScheduledExecutorService.html" title="class or interface in java.util.concurrent" class="external-link">ScheduledExecutorService</a></span>&nbsp;<span class="element-name">timerExecutor</span></div>
<div class="block">Single-thread executor used exclusively for the forfeit timer. Daemon so it does not block JVM shutdown.</div>
</div>
</section>
</li>
<li>
<section class="detail" id="disconnectionTimer">
<h3>disconnectionTimer</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/ScheduledFuture.html" title="class or interface in java.util.concurrent" class="external-link">ScheduledFuture</a>&lt;?&gt;</span>&nbsp;<span class="element-name">disconnectionTimer</span></div>
<div class="block">Handle to the running forfeit timer, or <code>null</code> when no timer is active.
A non-null value signals that the game is in the suspended state.</div>
</div>
</section>
</li>
</ul>
</section>
</li>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<li>
<section class="constructor-details" id="constructor-detail">
<h2>Constructor Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="&lt;init&gt;(java.util.concurrent.BlockingQueue,it.polimi.ingsw.gc14.Controller.GameController,it.polimi.ingsw.gc14.LimitedMap,it.polimi.ingsw.gc14.Network.CompositeClientBroadcaster,it.polimi.ingsw.gc14.SaveManager)">
<h3>GameEventProcessor</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="element-name">GameEventProcessor</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/concurrent/BlockingQueue.html" title="class or interface in java.util.concurrent" class="external-link">BlockingQueue</a>&lt;<a href="Network/NetworkEvent.html" title="class in it.polimi.ingsw.gc14.Network">NetworkEvent</a>&gt;&nbsp;actionQueue,
<a href="Controller/GameController.html" title="class in it.polimi.ingsw.gc14.Controller">GameController</a>&nbsp;gameController,
<a href="LimitedMap.html" title="class in it.polimi.ingsw.gc14">LimitedMap</a>&lt;<a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>,<wbr><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/Boolean.html" title="class or interface in java.lang" class="external-link">Boolean</a>&gt;&nbsp;playerList,
<a href="Network/CompositeClientBroadcaster.html" title="class in it.polimi.ingsw.gc14.Network">CompositeClientBroadcaster</a>&nbsp;broadcaster,
<a href="SaveManager.html" title="class in it.polimi.ingsw.gc14">SaveManager</a>&nbsp;saveManager)</span></div>
<div class="block">Constructs a <code>GameEventProcessor</code> with all required dependencies.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>actionQueue</code> - the queue from which incoming events are consumed.</dd>
<dd><code>gameController</code> - the server-side game controller.</dd>
<dd><code>playerList</code> - the shared map tracking each player's online status.</dd>
<dd><code>broadcaster</code> - the broadcaster used to notify all connected clients.</dd>
<dd><code>saveManager</code> - the save manager used to persist the game state.</dd>
</dl>
</div>
</section>
</li>
</ul>
</section>
</li>
<!-- ============ METHOD DETAIL ========== -->
<li>
<section class="method-details" id="method-detail">
<h2>Method Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="doFirstEvent()">
<h3>doFirstEvent</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">doFirstEvent</span>()
throws <span class="exceptions"><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/InterruptedException.html" title="class or interface in java.lang" class="external-link">InterruptedException</a></span></div>
<div class="block">Blocks until one event is available in the queue, then routes it to the
appropriate handler based on the current game state.</div>
<dl class="notes">
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/InterruptedException.html" title="class or interface in java.lang" class="external-link">InterruptedException</a></code> - if the thread is interrupted while waiting
for the next event.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="isGameActive()">
<h3>isGameActive</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="element-name">isGameActive</span>()</div>
<div class="block">Returns <code>true</code> when there is an ongoing game that has not yet ended.</div>
</div>
</section>
</li>
<li>
<section class="detail" id="isSuspended()">
<h3>isSuspended</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="element-name">isSuspended</span>()</div>
<div class="block">Returns <code>true</code> when the forfeit timer is running, meaning only one
player is currently online and the game is waiting for a reconnection.</div>
</div>
</section>
</li>
<li>
<section class="detail" id="handleInactiveGame(it.polimi.ingsw.gc14.Network.NetworkEvent)">
<h3>handleInactiveGame</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">handleInactiveGame</span><wbr><span class="parameters">(<a href="Network/NetworkEvent.html" title="class in it.polimi.ingsw.gc14.Network">NetworkEvent</a>&nbsp;event)</span></div>
<div class="block">Handles events that arrive when no active game exists (not yet started,
or already ended). Only disconnection cleanup is relevant here.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>event</code> - the incoming event.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="handleSuspendedGame(it.polimi.ingsw.gc14.Network.NetworkEvent)">
<h3>handleSuspendedGame</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">handleSuspendedGame</span><wbr><span class="parameters">(<a href="Network/NetworkEvent.html" title="class in it.polimi.ingsw.gc14.Network">NetworkEvent</a>&nbsp;event)</span></div>
<div class="block">Routes events while the game is suspended waiting for a reconnection.
<ul>
<li>A second disconnection while suspended means no player remains
online: the game is aborted entirely.</li>
<li>Any non-reconnection event is rejected with an error.</li>
<li>A reconnection event is allowed through to <a href="#applyAndBroadcast(it.polimi.ingsw.gc14.Network.NetworkEvent)"><code>applyAndBroadcast(NetworkEvent)</code></a>.</li>
</ul></div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>event</code> - the incoming event.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="abortGame()">
<h3>abortGame</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">abortGame</span>()</div>
<div class="block">Cancels the forfeit timer, clears the player list, and resets the model.
Called when the last remaining player disconnects while the game is suspended.</div>
</div>
</section>
</li>
<li>
<section class="detail" id="rejectEvent(it.polimi.ingsw.gc14.Network.NetworkEvent)">
<h3>rejectEvent</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">rejectEvent</span><wbr><span class="parameters">(<a href="Network/NetworkEvent.html" title="class in it.polimi.ingsw.gc14.Network">NetworkEvent</a>&nbsp;event)</span></div>
<div class="block">Marks the event as an error and broadcasts it back to the requesting
player. Used to reject actions that are not permitted in the current state.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>event</code> - the event to reject.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="applyAndBroadcast(it.polimi.ingsw.gc14.Network.NetworkEvent)">
<h3>applyAndBroadcast</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">applyAndBroadcast</span><wbr><span class="parameters">(<a href="Network/NetworkEvent.html" title="class in it.polimi.ingsw.gc14.Network">NetworkEvent</a>&nbsp;event)</span></div>
<div class="block">Applies the event to the game controller, saves the updated state,
and broadcasts the result to connected clients.
<p>The entire method body is synchronized on <code>gameController</code> to
prevent concurrent modification of the game model by the network threads.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>event</code> - the event to apply.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="cancelForfeitTimerIfReconnect(it.polimi.ingsw.gc14.Network.NetworkEvent)">
<h3>cancelForfeitTimerIfReconnect</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">cancelForfeitTimerIfReconnect</span><wbr><span class="parameters">(<a href="Network/NetworkEvent.html" title="class in it.polimi.ingsw.gc14.Network">NetworkEvent</a>&nbsp;event)</span></div>
<div class="block">Cancels the forfeit timer if the event is a successful reconnection.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>event</code> - the event that was just successfully applied.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="enrichEvent(it.polimi.ingsw.gc14.Network.NetworkEvent,it.polimi.ingsw.gc14.Model.Game)">
<h3>enrichEvent</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">enrichEvent</span><wbr><span class="parameters">(<a href="Network/NetworkEvent.html" title="class in it.polimi.ingsw.gc14.Network">NetworkEvent</a>&nbsp;event,
<a href="Model/Game.html" title="class in it.polimi.ingsw.gc14.Model">Game</a>&nbsp;game)</span></div>
<div class="block">Populates the event with the current game state so that clients can
update their mini-model after receiving it.
<p>Each event subclass overrides <a href="Network/NetworkEvent.html#enrichWithGameState(it.polimi.ingsw.gc14.Model.Game,java.util.ArrayList)"><code>NetworkEvent.enrichWithGameState(Game, ArrayList)</code></a>
to append any type-specific extra fields (available totems, etc.).</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>event</code> - the event to enrich.</dd>
<dd><code>game</code> - the current game model.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="startForfeitTimerIfNeeded(it.polimi.ingsw.gc14.Network.NetworkEvent,it.polimi.ingsw.gc14.Model.Game)">
<h3>startForfeitTimerIfNeeded</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">startForfeitTimerIfNeeded</span><wbr><span class="parameters">(<a href="Network/NetworkEvent.html" title="class in it.polimi.ingsw.gc14.Network">NetworkEvent</a>&nbsp;event,
<a href="Model/Game.html" title="class in it.polimi.ingsw.gc14.Model">Game</a>&nbsp;game)</span></div>
<div class="block">Schedules the 60-second forfeit timer if a disconnection has left
exactly one player online.
<p>If a previous timer is still pending it is canceled first to avoid
duplicate timers.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>event</code> - the event that was just applied.</dd>
<dd><code>game</code> - the current game model.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="endGameForfeit(it.polimi.ingsw.gc14.Model.Game)">
<h3>endGameForfeit</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">endGameForfeit</span><wbr><span class="parameters">(<a href="Model/Game.html" title="class in it.polimi.ingsw.gc14.Model">Game</a>&nbsp;game)</span></div>
<div class="block">Ends the game by forfeit when the timer expires without a reconnection.
Broadcasts an <a href="Network/NetworkEvents/EndedGame.html" title="class in it.polimi.ingsw.gc14.Network.NetworkEvents"><code>EndedGame</code></a> event, deletes the save, and resets state.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>game</code> - the game model captured when the timer was scheduled.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="broadcastResult(it.polimi.ingsw.gc14.Network.NetworkEvent,it.polimi.ingsw.gc14.Model.Game,int)">
<h3>broadcastResult</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">broadcastResult</span><wbr><span class="parameters">(<a href="Network/NetworkEvent.html" title="class in it.polimi.ingsw.gc14.Network">NetworkEvent</a>&nbsp;event,
<a href="Model/Game.html" title="class in it.polimi.ingsw.gc14.Model">Game</a>&nbsp;game,
int&nbsp;roundBefore)</span></div>
<div class="block">Determines what to broadcast after a successful event application:
<ul>
<li>If the round advanced, an <a href="Network/NetworkEvents/ApplyNextRound.html" title="class in it.polimi.ingsw.gc14.Network.NetworkEvents"><code>ApplyNextRound</code></a> event (with updated
card lists) replaces the original event.</li>
<li>If the game has ended, an <a href="Network/NetworkEvents/EndedGame.html" title="class in it.polimi.ingsw.gc14.Network.NetworkEvents"><code>EndedGame</code></a> event is sent and the
save file is deleted.</li>
<li>Otherwise the original event is broadcast as-is.</li>
</ul></div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>event</code> - the event that was applied.</dd>
<dd><code>game</code> - the current game model (post-apply).</dd>
<dd><code>roundBefore</code> - the round number before the event was applied.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="onlinePlayerCount()">
<h3>onlinePlayerCount</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type">long</span>&nbsp;<span class="element-name">onlinePlayerCount</span>()</div>
<div class="block">Returns the number of players currently marked as online in the player list.</div>
</div>
</section>
</li>
<li>
<section class="detail" id="buildDisconnectedList(it.polimi.ingsw.gc14.Model.Game)">
<h3>buildDisconnectedList</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/ArrayList.html" title="class or interface in java.util" class="external-link">ArrayList</a>&lt;<a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&gt;</span>&nbsp;<span class="element-name">buildDisconnectedList</span><wbr><span class="parameters">(<a href="Model/Game.html" title="class in it.polimi.ingsw.gc14.Model">Game</a>&nbsp;game)</span></div>
<div class="block">Builds the list of usernames of players currently marked as disconnected
in the game model.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>game</code> - the current game model.</dd>
<dt>Returns:</dt>
<dd>a new <a href="https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/ArrayList.html" title="class or interface in java.util" class="external-link"><code>ArrayList</code></a> of disconnected usernames.</dd>
</dl>
</div>
</section>
</li>
<li>
<section class="detail" id="removeOfflinePlayers()">
<h3>removeOfflinePlayers</h3>
<div class="horizontal-scroll">
<div class="member-signature"><span class="modifiers">private</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">removeOfflinePlayers</span>()</div>
<div class="block">Removes all offline entries (value <code>false</code>) from the player list.
Online players remain until they disconnect naturally.</div>
</div>
</section>
</li>
</ul>
</section>
</li>
</ul>
</section>
<!-- ========= END OF CLASS DATA ========= -->
</main>
</div>
</body>
</html>