Skip to content

Commit

Permalink
Merge pull request #117 from StenAL/features
Browse files Browse the repository at this point in the history
Fix single player quick start, add ranking icons to player lists in lobbies
  • Loading branch information
PhilippvK authored Aug 25, 2024
2 parents 7d9af23 + a194841 commit 17cfc0a
Show file tree
Hide file tree
Showing 19 changed files with 71 additions and 150 deletions.
19 changes: 6 additions & 13 deletions client/src/main/java/com/aapeli/client/ImageTracker.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import java.applet.Applet;
import java.awt.Image;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Vector;

Expand Down Expand Up @@ -146,24 +145,18 @@ protected void removeAllImageResources() {
}
}

Enumeration<Image> var6 = this.imageTable.elements();

while (var6.hasMoreElements()) {
for (Image image: this.imageTable.values()) {
try {
var6.nextElement().flush();
} catch (Exception var5) {
}
image.flush();
} catch (Exception e) {}
}

this.imageTable.clear();
this.imageTable = null;
Enumeration<ImageResource> var7 = this.imageResourceTable.elements();

while (var7.hasMoreElements()) {
for (ImageResource imageResource: this.imageResourceTable) {
try {
var7.nextElement().method1652();
} catch (Exception var4) {
}
imageResource.method1652();
} catch (Exception e) {}
}

this.imageResourceTable.removeAllElements();
Expand Down
20 changes: 6 additions & 14 deletions client/src/main/java/com/aapeli/client/InputTextField.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import java.awt.event.FocusListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.util.Enumeration;
import java.util.Vector;

public class InputTextField extends TextField implements FocusListener, KeyListener, ActionListener {
Expand Down Expand Up @@ -135,10 +134,8 @@ public void keyTyped(KeyEvent evt) {
public void actionPerformed(ActionEvent evt) {
if (evt.getSource() == this) {
synchronized (this) {
Enumeration<InputTextFieldListener> enumeration = this.listeners.elements();

while (enumeration.hasMoreElements()) {
enumeration.nextElement().enterPressed();
for (InputTextFieldListener listener: this.listeners) {
listener.enterPressed();
}
}
}
Expand Down Expand Up @@ -244,20 +241,15 @@ private synchronized void keyInput() {
this.setCaretPosition(lastCharIndex);
}

Enumeration<InputTextFieldListener> enumeration;
if (this.inputTextLength == 0 && textLen > 0) {
enumeration = this.listeners.elements();

while (enumeration.hasMoreElements()) {
enumeration.nextElement().startedTyping();
for (InputTextFieldListener listener: this.listeners) {
listener.startedTyping();
}
}

if (this.inputTextLength > 0 && textLen == 0) {
enumeration = this.listeners.elements();

while (enumeration.hasMoreElements()) {
enumeration.nextElement().clearedField();
for (InputTextFieldListener listener: this.listeners) {
listener.clearedField();
}
}

Expand Down
12 changes: 2 additions & 10 deletions client/src/main/java/com/aapeli/client/SoundManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import java.applet.AudioClip;
import java.net.URL;
import java.util.Enumeration;
import java.util.Hashtable;

public final class SoundManager implements Runnable {
Expand Down Expand Up @@ -55,21 +54,14 @@ public void run() {
boolean anySoundClipsNotDefined;
do {
anySoundClipsNotDefined = false;
Enumeration<SoundClip> soundClips = this.clientSounds.elements();

SoundClip soundClip;
while (soundClips.hasMoreElements()) {
soundClip = soundClips.nextElement();
for (SoundClip soundClip: this.clientSounds.values()) {
if (!soundClip.isDefined()) {
soundClip.defineClip();
anySoundClipsNotDefined = true;
}
}

soundClips = this.sharedSounds.elements();

while (soundClips.hasMoreElements()) {
soundClip = soundClips.nextElement();
for (SoundClip soundClip: this.sharedSounds.values()) {
if (!soundClip.isDefined()) {
soundClip.defineClip();
anySoundClipsNotDefined = true;
Expand Down
7 changes: 2 additions & 5 deletions client/src/main/java/com/aapeli/colorgui/Choicer.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import java.awt.event.ComponentListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.Enumeration;
import java.util.Vector;

public class Choicer extends IPanel implements ComponentListener, ItemListener, ItemSelectable {
Expand Down Expand Up @@ -60,10 +59,8 @@ public void itemStateChanged(ItemEvent e) {
synchronized (this.listeners) {
if (!this.listeners.isEmpty()) {
e = new ItemEvent(this, e.getID(), e.getItem(), e.getStateChange());
Enumeration<ItemListener> listenerEnumeration = this.listeners.elements();

while (listenerEnumeration.hasMoreElements()) {
listenerEnumeration.nextElement().itemStateChanged(e);
for (ItemListener listener: this.listeners) {
listener.itemStateChanged(e);
}
}
}
Expand Down
8 changes: 2 additions & 6 deletions client/src/main/java/com/aapeli/colorgui/ColorButton.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.util.Enumeration;
import java.util.Vector;

public class ColorButton extends IPanel implements MouseMotionListener, MouseListener {
Expand Down Expand Up @@ -401,12 +400,9 @@ public void processActionEvent() {
synchronized (this.aVector3280) {
if (this.aVector3280.size() != 0) {
ActionEvent var2 = new ActionEvent(this, 1001, this.aString3272);
Enumeration<ActionListener> var3 = this.aVector3280.elements();

while (var3.hasMoreElements()) {
var3.nextElement().actionPerformed(var2);
for (ActionListener listener : aVector3280) {
listener.actionPerformed(var2);
}

}
}
}
Expand Down
8 changes: 2 additions & 6 deletions client/src/main/java/com/aapeli/colorgui/ColorCheckbox.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import java.awt.event.ItemListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.Enumeration;
import java.util.Vector;

public class ColorCheckbox extends IPanel implements ItemSelectable, MouseListener {
Expand Down Expand Up @@ -329,12 +328,9 @@ private void method838() {
synchronized (this.aVector3305) {
if (this.aVector3305.size() != 0) {
ItemEvent var2 = new ItemEvent(this, 0, this, 701);
Enumeration<ItemListener> var3 = this.aVector3305.elements();

while (var3.hasMoreElements()) {
var3.nextElement().itemStateChanged(var2);
for (ItemListener listener : aVector3305) {
listener.itemStateChanged(var2);
}

}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.aapeli.colorgui;

import java.util.Enumeration;
import java.util.Vector;

public final class ColorCheckboxGroup {
Expand All @@ -22,11 +21,8 @@ protected boolean method1748(boolean var1) {
}

private void method1749() {
Enumeration<ColorCheckbox> var1 = this.aVector1553.elements();

while (var1.hasMoreElements()) {
var1.nextElement().realSetState(false);
for (ColorCheckbox colorCheckbox : aVector1553) {
colorCheckbox.realSetState(false);
}

}
}
14 changes: 4 additions & 10 deletions client/src/main/java/com/aapeli/colorgui/ColorList.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import java.awt.event.ItemListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.Enumeration;
import java.util.Vector;

public final class ColorList extends Panel implements ComponentListener, AdjustmentListener, MouseListener, ItemSelectable {
Expand Down Expand Up @@ -189,11 +188,9 @@ public void update(Graphics var1) {

private boolean method944() {
ColorListItemGroup var1 = null;
Enumeration<ColorListItem> var4 = this.aVector669.elements();

while (var4.hasMoreElements()) {
ColorListItem var3 = var4.nextElement();
ColorListItemGroup var2 = var3.getGroup();
for (ColorListItem colorListItem: this.aVector669) {
ColorListItemGroup var2 = colorListItem.getGroup();
if (var2 != null) {
if (var1 != null && var2 != var1) {
return true;
Expand Down Expand Up @@ -665,12 +662,9 @@ private String method953(String var1) {
private synchronized void method954(ColorListItem var1, int var2, int var3) {
if (this.aVector680.size() != 0) {
ItemEvent var4 = new ItemEvent(this, var2, var1, var3);
Enumeration<ItemListener> var5 = this.aVector680.elements();

while (var5.hasMoreElements()) {
var5.nextElement().itemStateChanged(var4);
for (ItemListener itemListener: this.aVector680) {
itemListener.itemStateChanged(var4);
}

}
}

Expand Down
8 changes: 2 additions & 6 deletions client/src/main/java/com/aapeli/colorgui/ColorSpinner.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.util.Enumeration;
import java.util.Vector;

public final class ColorSpinner extends IPanel implements MouseListener, MouseMotionListener, ItemSelectable {
Expand Down Expand Up @@ -402,12 +401,9 @@ protected void method846() {
String var1 = this.getSelectedItem();
if (var1 != null) {
ItemEvent var2 = new ItemEvent(this, 701, var1, ItemEvent.SELECTED);
Enumeration<ItemListener> var3 = this.aVector3318.elements();

while (var3.hasMoreElements()) {
var3.nextElement().itemStateChanged(var2);
for (ItemListener listener : aVector3318) {
listener.itemStateChanged(var2);
}

}
}

Expand Down
8 changes: 2 additions & 6 deletions client/src/main/java/com/aapeli/colorgui/MultiColorList.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import java.awt.event.ItemListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.Enumeration;
import java.util.Vector;

public class MultiColorList extends Panel implements AdjustmentListener, MouseListener, ItemSelectable {
Expand Down Expand Up @@ -714,12 +713,9 @@ private synchronized void method961(boolean var1) {
private synchronized void method962(MultiColorListItem var1, int var2, int var3) {
if (this.aVector713.size() != 0) {
ItemEvent var4 = new ItemEvent(this, var2, var1, var3);
Enumeration<ItemListener> var5 = this.aVector713.elements();

while (var5.hasMoreElements()) {
var5.nextElement().itemStateChanged(var4);
for (ItemListener listener: this.aVector713) {
listener.itemStateChanged(var4);
}

}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.aapeli.client.IPanel;

import java.util.Enumeration;
import java.util.Vector;

public final class RadioButtonGroup {
Expand Down Expand Up @@ -38,16 +37,12 @@ protected boolean method1758(boolean var1) {
}

private void method1759() {
Enumeration<IPanel> var1 = this.aVector1589.elements();

while (var1.hasMoreElements()) {
Object var2 = var1.nextElement();
for (IPanel var2: this.aVector1589) {
if (var2 instanceof RadioButton) {
((RadioButton) var2).realSetState(false);
} else {
((RoundRadioButton) var2).realSetState(false);
}
}

}
}
8 changes: 2 additions & 6 deletions client/src/main/java/com/aapeli/colorgui/RoundButton.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.util.Enumeration;
import java.util.Vector;

public class RoundButton extends IPanel implements MouseMotionListener, MouseListener {
Expand Down Expand Up @@ -263,12 +262,9 @@ public void processActionEvent() {
synchronized (this.aVector3395) {
if (this.aVector3395.size() != 0) {
ActionEvent var2 = new ActionEvent(this, 1001, this.aString3387);
Enumeration<ActionListener> var3 = this.aVector3395.elements();

while (var3.hasMoreElements()) {
var3.nextElement().actionPerformed(var2);
for (ActionListener listener : aVector3395) {
listener.actionPerformed(var2);
}

}
}
}
Expand Down
8 changes: 2 additions & 6 deletions client/src/main/java/com/aapeli/colorgui/TabBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import java.awt.event.ActionListener;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.util.Enumeration;
import java.util.Vector;

public class TabBar extends IPanel implements ComponentListener, ActionListener {
Expand Down Expand Up @@ -382,12 +381,9 @@ private void method879(int var1) {
Object var2 = this.anObject3425;
synchronized (this.anObject3425) {
if (this.aVector3424.size() != 0) {
Enumeration<TabBarListener> var3 = this.aVector3424.elements();

while (var3.hasMoreElements()) {
var3.nextElement().selectedTabChanged(var1);
for (TabBarListener tabBarListener : aVector3424) {
tabBarListener.selectedTabChanged(var1);
}

}
}
}
Expand Down
13 changes: 1 addition & 12 deletions client/src/main/java/com/aapeli/tools/QuickTimer.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.aapeli.tools;

import java.util.Enumeration;
import java.util.NoSuchElementException;
import java.util.Vector;

public class QuickTimer implements Runnable {
Expand Down Expand Up @@ -41,16 +39,7 @@ public QuickTimer(QuickTimerListener var1, int var2) {
public void run() {
Tools.sleep(this.anInt1727);
if (!this.stopped) {
Enumeration<QuickTimerListener> var1 = this.aVector1728.elements();

while (var1.hasMoreElements()) {
QuickTimerListener var2;
try {
var2 = var1.nextElement();
} catch (NoSuchElementException var4) {
return;
}

for (QuickTimerListener var2: this.aVector1728) {
if (var2 != null) {
var2.qtFinished();
}
Expand Down
Loading

0 comments on commit 17cfc0a

Please sign in to comment.