Skip to content

Commit d65db9c

Browse files
tool4EvErtool4EvEr
authored andcommitted
Clean up
1 parent ed4f847 commit d65db9c

5 files changed

Lines changed: 12 additions & 30 deletions

File tree

forge-gui-desktop/src/main/java/forge/screens/home/VLobby.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ public void update(final boolean fullUpdate) {
343343

344344
final boolean allowNetworking = lobby.isAllowNetworking();
345345

346-
ImmutableList<VariantCheckBox> vntBoxes = null;
346+
ImmutableList<VariantCheckBox> vntBoxes;
347347
if (allowNetworking) {
348348
vntBoxes = vntBoxesNetwork;
349349
} else {
@@ -1209,10 +1209,6 @@ public void onDraftAutoPicked(int seatIndex, PaperCard card, int packNumber, int
12091209
controller.onDraftAutoPicked(seatIndex, card, packNumber, pickInPack);
12101210
}
12111211

1212-
public void cancelActiveDraft() {
1213-
controller.cancelActiveDraft();
1214-
}
1215-
12161212
@Override
12171213
public void onReceiveEventPool(String eventId, Deck pool) {
12181214
controller.onReceiveEventPool(eventId, pool);

forge-gui-desktop/src/main/java/forge/screens/home/online/VSubmenuOnlineLobby.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ public boolean onClosing(final FScreen screen) {
238238
if (SOptionPane.showConfirmDialog(Localizer.getInstance().getMessage("lblLeaveLobbyDescription"), Localizer.getInstance().getMessage("lblLeave"))) {
239239
server.stopServer();
240240
FNetOverlay.SINGLETON_INSTANCE.reset();
241-
if (lobby != null) lobby.cancelActiveDraft();
241+
if (lobby != null) lobby.getController().cancelActiveDraft();
242242
return true;
243243
}
244244
} else if (client == null || SOptionPane.showConfirmDialog(Localizer.getInstance().getMessage("lblLeaveLobbyConfirm"), Localizer.getInstance().getMessage("lblLeave"))) {
@@ -247,7 +247,7 @@ public boolean onClosing(final FScreen screen) {
247247
client = null;
248248
}
249249
FNetOverlay.SINGLETON_INSTANCE.reset();
250-
if (lobby != null) lobby.cancelActiveDraft();
250+
if (lobby != null) lobby.getController().cancelActiveDraft();
251251
return true;
252252
}
253253
return false;

forge-gui/src/main/java/forge/gamemodes/net/NetConnectUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ private static abstract class DraftForwardingLobbyListener implements ILobbyList
4242
}
4343

4444
@Override
45-
public void draftPackArrived(int seatIndex, java.util.List<forge.item.PaperCard> pack,
45+
public void draftPackArrived(int seatIndex, List<forge.item.PaperCard> pack,
4646
int packNumber, int pickNumber, int timerDurationSeconds) {
4747
view.onDraftPackArrived(seatIndex, pack, packNumber, pickNumber, timerDurationSeconds);
4848
}

forge-gui/src/main/java/forge/gamemodes/net/draft/BoosterDraftHost.java

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,13 @@ public void start() {
120120
*/
121121
public synchronized void shutdown() {
122122
finished = true;
123-
cancelAllSeatTimers();
124-
cancelAllGraceTimers();
123+
for (Integer seatIndex : new ArrayList<>(seatTimers.keySet())) {
124+
cancelSeatTimer(seatIndex);
125+
}
126+
for (ScheduledFuture<?> f : graceTimers.values()) {
127+
if (f != null) f.cancel(false);
128+
}
129+
graceTimers.clear();
125130
timerExecutor.shutdown();
126131
}
127132

@@ -322,10 +327,7 @@ private int[] computeQueueDepths() {
322327
* the monitor; the actual network dispatch happens after release.
323328
*/
324329
private void addFinishDraft(List<Runnable> dispatches) {
325-
finished = true;
326-
cancelAllSeatTimers();
327-
cancelAllGraceTimers();
328-
timerExecutor.shutdown();
330+
shutdown();
329331
draft.postDraftActions();
330332
netLog.info("Draft complete — distributing pools");
331333

@@ -361,12 +363,6 @@ private void cancelSeatTimer(int seatIndex) {
361363
if (f != null) f.cancel(false);
362364
}
363365

364-
private void cancelAllSeatTimers() {
365-
for (Integer seatIndex : new ArrayList<>(seatTimers.keySet())) {
366-
cancelSeatTimer(seatIndex);
367-
}
368-
}
369-
370366
// --- Disconnect / reconnect handling ---
371367

372368
/**
@@ -464,13 +460,6 @@ private void cancelGraceTimer(int seatIndex) {
464460
if (f != null) f.cancel(false);
465461
}
466462

467-
private void cancelAllGraceTimers() {
468-
for (ScheduledFuture<?> f : graceTimers.values()) {
469-
if (f != null) f.cancel(false);
470-
}
471-
graceTimers.clear();
472-
}
473-
474463
private void addBroadcastDisconnect(List<Runnable> dispatches, int seatIndex) {
475464
EventParticipant participant = EventParticipant.findBySeat(participants, seatIndex);
476465
if (participant == null) return;

forge-gui/src/main/java/forge/gamemodes/net/server/ServerGameLobby.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,6 @@ public synchronized void clearCurrentEvent() {
215215
*/
216216
public synchronized void populateParticipants() {
217217
NetworkEvent event = getCurrentEvent();
218-
if (event == null) return;
219218
if (event.getPhase() != EventPhase.LOBBY_GATHER) {
220219
throw new IllegalStateException("populateParticipants only valid in LOBBY_GATHER, not " + event.getPhase());
221220
}
@@ -239,7 +238,6 @@ public synchronized void populateParticipants() {
239238
*/
240239
public synchronized void fillRemainingWithAI(int targetSize) {
241240
NetworkEvent event = getCurrentEvent();
242-
if (event == null) return;
243241
int currentSize = event.getParticipants().size();
244242
for (int i = currentSize; i < targetSize; i++) {
245243
String aiName = "Seat " + (i + 1);
@@ -253,7 +251,6 @@ public synchronized void fillRemainingWithAI(int targetSize) {
253251
*/
254252
public synchronized void shuffleSeatPositions() {
255253
NetworkEvent event = getCurrentEvent();
256-
if (event == null) return;
257254
List<EventParticipant> participants = event.getParticipants();
258255
List<Integer> seats = new ArrayList<>();
259256
for (EventParticipant p : participants) {

0 commit comments

Comments
 (0)