From 36eb73655f05344619724c2a6eeb0c13e9d7bcbc Mon Sep 17 00:00:00 2001 From: Sten Laane <21343173+StenAL@users.noreply.github.com> Date: Tue, 28 May 2024 11:07:17 +0300 Subject: [PATCH 1/6] Client: Remove uses of deprecated boxed number constructors These are deprecated are are logging warnings. See https://stackoverflow.com/questions/47095474/the-constructors-integerint-doubledouble-longlong-and-so-on-are-deprecat --- client/src/main/java/com/aapeli/client/IPanel.java | 2 +- client/src/main/java/com/aapeli/client/SoundManager.java | 4 ++-- client/src/main/java/com/aapeli/colorgui/MultiColorList.java | 2 +- client/src/main/java/com/aapeli/multiuser/ChatTextArea.java | 2 +- client/src/main/java/com/aapeli/multiuser/UserList.java | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/client/src/main/java/com/aapeli/client/IPanel.java b/client/src/main/java/com/aapeli/client/IPanel.java index aba26f7d..238c1e31 100644 --- a/client/src/main/java/com/aapeli/client/IPanel.java +++ b/client/src/main/java/com/aapeli/client/IPanel.java @@ -117,7 +117,7 @@ public void recursiveRepaint() { public Object[] getBackgroundAndLocation(int var1, int var2) { if (this.backgroundImage != null) { - return new Object[]{this.backgroundImage, new Integer(this.backgroundImageXOffset + var1), new Integer(this.backgroundImageYOffset + var2)}; + return new Object[]{this.backgroundImage, this.backgroundImageXOffset + var1, this.backgroundImageYOffset + var2}; } else { Container var3 = this.getParent(); if (var3 == null) { diff --git a/client/src/main/java/com/aapeli/client/SoundManager.java b/client/src/main/java/com/aapeli/client/SoundManager.java index 1e60f723..a2085158 100644 --- a/client/src/main/java/com/aapeli/client/SoundManager.java +++ b/client/src/main/java/com/aapeli/client/SoundManager.java @@ -219,7 +219,7 @@ private void loadClientSounds() { } private void defineSoundClip(int id, URL soundDir, String clipName) { - this.clientSounds.put(new Integer(id), new SoundClip(this.applet, soundDir, clipName + ".au", this.debug)); + this.clientSounds.put(id, new SoundClip(this.applet, soundDir, clipName + ".au", this.debug)); } private synchronized void loadAllSoundClips() { @@ -232,7 +232,7 @@ private synchronized void loadAllSoundClips() { } private void playAudioClip(int id) { - SoundClip soundClip = this.clientSounds.get(new Integer(id)); + SoundClip soundClip = this.clientSounds.get(id); if (soundClip != null && this.audioChoicerIndex != 1) { AudioClip audioClip = soundClip.getAudioClip(); if (audioClip != null) { diff --git a/client/src/main/java/com/aapeli/colorgui/MultiColorList.java b/client/src/main/java/com/aapeli/colorgui/MultiColorList.java index 5a321c02..f9bbdf77 100644 --- a/client/src/main/java/com/aapeli/colorgui/MultiColorList.java +++ b/client/src/main/java/com/aapeli/colorgui/MultiColorList.java @@ -637,7 +637,7 @@ private double method958(String var1, int var2) { } else if (var1.equals("-")) { return -1.7976931348623157E308D; } else { - return (new Double(var1)).doubleValue(); + return Double.parseDouble(var1); } } } diff --git a/client/src/main/java/com/aapeli/multiuser/ChatTextArea.java b/client/src/main/java/com/aapeli/multiuser/ChatTextArea.java index 97485e6b..82726d45 100644 --- a/client/src/main/java/com/aapeli/multiuser/ChatTextArea.java +++ b/client/src/main/java/com/aapeli/multiuser/ChatTextArea.java @@ -109,7 +109,7 @@ public void addPrivateMessageUserLeftMessage(String var1) { } public void setUserColor(String var1, int var2) { - this.aHashtable4730.put(var1, new Integer(var2)); + this.aHashtable4730.put(var1, var2); } public void removeUserColor(String var1) { diff --git a/client/src/main/java/com/aapeli/multiuser/UserList.java b/client/src/main/java/com/aapeli/multiuser/UserList.java index c9ee6c7f..5abd8b7c 100644 --- a/client/src/main/java/com/aapeli/multiuser/UserList.java +++ b/client/src/main/java/com/aapeli/multiuser/UserList.java @@ -471,7 +471,7 @@ public void addUser(UserListItem var1) { } int var5 = var1.getLanguage(); - Integer var6 = new Integer(var5); + Integer var6 = var5; ColorListItemGroup var7 = (ColorListItemGroup) ((ColorListItemGroup) this.aHashtable3504.get(var6)); if (var7 == null) { int var8 = var5; From d5b85291f2ce66a1ba281111360136fcb2ce58dd Mon Sep 17 00:00:00 2001 From: Sten Laane <21343173+StenAL@users.noreply.github.com> Date: Tue, 28 May 2024 11:42:32 +0300 Subject: [PATCH 2/6] Client: Fix most warnings about unchecked collection usage Maven and IntelliJ were complaining about missing generics so I added them everywhere. --- .../src/main/java/agolf/TrackCollection.java | 4 +-- .../src/main/java/agolf/game/HackedShot.java | 12 +++---- .../main/java/com/aapeli/applet/AdCanvas.java | 8 ++--- .../main/java/com/aapeli/client/Class79.java | 10 +++--- .../main/java/com/aapeli/client/HtmlText.java | 14 ++++---- .../java/com/aapeli/client/ImageTracker.java | 26 +++++++-------- .../com/aapeli/client/InputTextField.java | 4 +-- .../java/com/aapeli/client/TextManager.java | 4 +-- .../java/com/aapeli/colorgui/ColorButton.java | 14 ++++---- .../com/aapeli/colorgui/ColorCheckbox.java | 16 ++++------ .../aapeli/colorgui/ColorCheckboxGroup.java | 6 ++-- .../java/com/aapeli/colorgui/ColorList.java | 26 +++++++-------- .../com/aapeli/colorgui/ColorSpinner.java | 32 +++++++++---------- .../com/aapeli/colorgui/ColorTextArea.java | 14 ++++---- .../com/aapeli/colorgui/MultiColorList.java | 14 ++++---- .../com/aapeli/colorgui/RadioButtonGroup.java | 13 ++++---- .../java/com/aapeli/colorgui/RoundButton.java | 15 ++++----- .../main/java/com/aapeli/colorgui/TabBar.java | 14 ++++---- .../aapeli/connection/GamePacketQueue.java | 6 ++-- .../java/com/aapeli/connection/GameQueue.java | 4 +-- .../com/aapeli/multiuser/ChatTextArea.java | 6 ++-- .../java/com/aapeli/multiuser/UserList.java | 14 ++++---- .../java/com/aapeli/tools/QuickTimer.java | 8 ++--- .../src/main/java/com/aapeli/tools/Tools.java | 2 +- .../main/java/com/aapeli/tools/XmlUnit.java | 16 +++++----- .../moparforia/client/trackdump/Class98.java | 4 +-- .../client/trackdump/Connection.java | 6 ++-- .../client/trackdump/GamePacketQueue.java | 6 ++-- .../editor/TrackPropertiesDialog.java | 6 ++-- 29 files changed, 160 insertions(+), 164 deletions(-) diff --git a/client/src/main/java/agolf/TrackCollection.java b/client/src/main/java/agolf/TrackCollection.java index 6beaf2a0..58deb105 100644 --- a/client/src/main/java/agolf/TrackCollection.java +++ b/client/src/main/java/agolf/TrackCollection.java @@ -4,7 +4,7 @@ public class TrackCollection { - private Hashtable tracks = new Hashtable(); + private Hashtable tracks = new Hashtable<>(); public void addTrack(String author, String name, String data) { @@ -15,6 +15,6 @@ public void addTrack(String author, String name, String data) { public String getTrack(String author, String name) { System.out.println("--------------- GET TRACK"); String key = author + "\t" + name; - return (String) this.tracks.get(key); + return this.tracks.get(key); } } diff --git a/client/src/main/java/agolf/game/HackedShot.java b/client/src/main/java/agolf/game/HackedShot.java index 3342fd70..25733b2e 100644 --- a/client/src/main/java/agolf/game/HackedShot.java +++ b/client/src/main/java/agolf/game/HackedShot.java @@ -28,8 +28,8 @@ public class HackedShot implements Runnable { private double aDouble2820; private double[] aDoubleArray2821; private double[] aDoubleArray2822; - private Vector[] aVectorArray2823; - private Vector[] aVectorArray2824; + private Vector[] aVectorArray2823; + private Vector[] aVectorArray2824; private short[][][] aShortArrayArrayArray2825; private double[] playerX; private double[] playerY; @@ -60,8 +60,8 @@ public HackedShot(int anInt2809, double aDouble2820, double[] aDoubleArray2821, double[] aDoubleArray2822, - Vector[] aVectorArray2823, - Vector[] aVectorArray2824, + Vector[] aVectorArray2823, + Vector[] aVectorArray2824, short[][][] aShortArrayArrayArray2825, double[] playerX, double[] playerY, @@ -515,7 +515,7 @@ private void method154(int var1, int var2, int var3, int var4) { do { var10 = var7 - 1; var8 = this.aSeed_2836.next() % (var10 + 1); - var11 = (double[]) this.aVectorArray2823[var1].elementAt(var8); + var11 = this.aVectorArray2823[var1].elementAt(var8); if (Math.abs(var11[0] - (double) var3) >= 15.0D || Math.abs(var11[1] - (double) var4) >= 15.0D) { this.playerX[var2] = var11[0]; this.playerY[var2] = var11[1]; @@ -549,7 +549,7 @@ private void method154(int var1, int var2, int var3, int var4) { var8 = this.aSeed_2836.next() % (var12 + 1); } - var11 = (double[]) this.aVectorArray2824[var13].elementAt(var8); + var11 = this.aVectorArray2824[var13].elementAt(var8); this.playerX[var2] = var11[0]; this.playerY[var2] = var11[1]; } diff --git a/client/src/main/java/com/aapeli/applet/AdCanvas.java b/client/src/main/java/com/aapeli/applet/AdCanvas.java index 8b383e3c..7badd493 100644 --- a/client/src/main/java/com/aapeli/applet/AdCanvas.java +++ b/client/src/main/java/com/aapeli/applet/AdCanvas.java @@ -15,7 +15,7 @@ class AdCanvas extends Canvas implements MouseListener { private AApplet gameApplet; private LoadingPanel loadingPanel; private URL anURL117; - private Vector aVector118; + private Vector aVector118; private URL anURL119; private String aString120; private int anInt121; @@ -26,7 +26,7 @@ class AdCanvas extends Canvas implements MouseListener { private long aLong126; - private AdCanvas(AApplet var1, URL var2, Vector var3, URL var4, String var5, int var6) { + private AdCanvas(AApplet var1, URL var2, Vector var3, URL var4, String var5, int var6) { this.gameApplet = var1; this.anURL117 = var2; this.aVector118 = var3; @@ -58,7 +58,7 @@ public void update(Graphics var1) { int var5 = this.aVector118.size(); for (int var6 = 0; var6 < var5; ++var6) { - AdCanvasText var4 = (AdCanvasText) ((AdCanvasText) this.aVector118.elementAt(var6)); + AdCanvasText var4 = this.aVector118.elementAt(var6); var4.method1548(var1); } } else { @@ -93,7 +93,7 @@ protected static AdCanvas create(AApplet applet, Parameters parameters) { try { String var2 = parameters.getParameter("ad_image"); URL var3 = new URL(applet.getCodeBase(), var2); - Vector var4 = new Vector(); + Vector var4 = new Vector<>(); String var6; for (int var5 = 1; (var6 = parameters.getParameter("ad_text-" + var5)) != null; ++var5) { diff --git a/client/src/main/java/com/aapeli/client/Class79.java b/client/src/main/java/com/aapeli/client/Class79.java index e15d1a42..05e46e2a 100644 --- a/client/src/main/java/com/aapeli/client/Class79.java +++ b/client/src/main/java/com/aapeli/client/Class79.java @@ -11,7 +11,7 @@ class Class79 { private int anInt1366; private boolean aBoolean1367; - private Vector aVector1368; + private Vector aVector1368; private int anInt1369; private int anInt1370; private final HtmlText aHtmlText1371; @@ -21,7 +21,7 @@ protected Class79(HtmlText var1, Graphics var2, int var3, boolean var4) { this.aHtmlText1371 = var1; this.anInt1366 = var3; this.aBoolean1367 = var4; - this.aVector1368 = new Vector(); + this.aVector1368 = new Vector<>(); this.anInt1369 = 0; this.anInt1370 = var2.getFont().getSize(); } @@ -31,7 +31,7 @@ public String toString() { String var2 = "[HtmlLine: words.size=" + var1 + "\n"; for (int var3 = 0; var3 < var1; ++var3) { - var2 = var2 + " " + ((Class80) ((Class80) this.aVector1368.elementAt(var3))).toString() + "\n"; + var2 = var2 + " " + this.aVector1368.elementAt(var3).toString() + "\n"; } var2 = var2 + "\'relatx\'=" + this.anInt1369 + " \'height\'=" + this.anInt1370 + "]"; @@ -71,7 +71,7 @@ protected void method1608(Graphics var1, int var2, int var3) { var6 = 0; for (int var7 = 0; var7 < var4; ++var7) { - var5 = (Class80) ((Class80) this.aVector1368.elementAt(var7)); + var5 = this.aVector1368.elementAt(var7); var6 += var5.method1609(); } @@ -79,7 +79,7 @@ protected void method1608(Graphics var1, int var2, int var3) { } for (var6 = 0; var6 < var4; ++var6) { - var5 = (Class80) ((Class80) this.aVector1368.elementAt(var6)); + var5 = this.aVector1368.elementAt(var6); var5.method1610(var1, var2, var3); } diff --git a/client/src/main/java/com/aapeli/client/HtmlText.java b/client/src/main/java/com/aapeli/client/HtmlText.java index f0170d56..7725a70a 100644 --- a/client/src/main/java/com/aapeli/client/HtmlText.java +++ b/client/src/main/java/com/aapeli/client/HtmlText.java @@ -8,7 +8,7 @@ public class HtmlText { - private Vector aVector1348; + private Vector aVector1348; public HtmlText(Graphics var1, int var2, String var3) { this.aVector1348 = this.method1589(var1, var2, var3); } @@ -18,7 +18,7 @@ public String toString() { String var2 = "[HtmlText: lines.size=" + var1 + "\n"; for (int var3 = 0; var3 < var1; ++var3) { - var2 = var2 + " " + ((Class79) ((Class79) this.aVector1348.elementAt(var3))).toString() + "\n"; + var2 = var2 + " " + this.aVector1348.elementAt(var3).toString() + "\n"; } var2 = var2 + "]"; @@ -30,7 +30,7 @@ public int print(Graphics var1, int var2, int var3) { int var5 = 0; for (int var7 = 0; var7 < var4; ++var7) { - Class79 var6 = (Class79) ((Class79) this.aVector1348.elementAt(var7)); + Class79 var6 = this.aVector1348.elementAt(var7); var5 = var6.method1607() + 5; if (var7 > 0) { var3 += var5; @@ -42,9 +42,9 @@ public int print(Graphics var1, int var2, int var3) { return var3 + var5; } - private Vector method1589(Graphics var1, int var2, String var3) { + private Vector method1589(Graphics var1, int var2, String var3) { Class81 var4 = new Class81(this, var3, var1); - Vector var5 = new Vector(); + Vector var5 = new Vector<>(); boolean var6 = false; Class79 var7 = new Class79(this, var1, var2, var6); @@ -74,12 +74,12 @@ private Vector method1589(Graphics var1, int var2, String var3) { return var5; } - private Class79 method1590(Class79 var1, Vector var2, Graphics var3, int var4, boolean var5) { + private Class79 method1590(Class79 var1, Vector var2, Graphics var3, int var4, boolean var5) { this.method1591(var1, var2); return new Class79(this, var3, var4, var5); } - private void method1591(Class79 var1, Vector var2) { + private void method1591(Class79 var1, Vector var2) { if (!var1.method1606()) { var2.addElement(var1); } diff --git a/client/src/main/java/com/aapeli/client/ImageTracker.java b/client/src/main/java/com/aapeli/client/ImageTracker.java index 051bcd06..eeb6c763 100644 --- a/client/src/main/java/com/aapeli/client/ImageTracker.java +++ b/client/src/main/java/com/aapeli/client/ImageTracker.java @@ -17,8 +17,8 @@ class ImageTracker implements Runnable { private Applet anApplet1396; private boolean aBoolean1397; - private Vector imageResourceTable; - private Hashtable imageTable; + private Vector imageResourceTable; + private Hashtable imageTable; private AApplet anAApplet1400; private Thread aThread1401; private boolean aBoolean1402; @@ -26,8 +26,8 @@ class ImageTracker implements Runnable { protected ImageTracker(Applet var1, boolean var2) { this.anApplet1396 = var1; this.aBoolean1397 = var2; - this.imageResourceTable = new Vector(); - this.imageTable = new Hashtable(); + this.imageResourceTable = new Vector<>(); + this.imageTable = new Hashtable<>(); this.anAApplet1400 = null; this.aBoolean1402 = false; } @@ -146,11 +146,11 @@ protected void removeAllImageResources() { } } - Enumeration var6 = this.imageTable.elements(); + Enumeration var6 = this.imageTable.elements(); while (var6.hasMoreElements()) { try { - ((Image) ((Image) var6.nextElement())).flush(); + var6.nextElement().flush(); } catch (Exception var5) { ; } @@ -158,11 +158,11 @@ protected void removeAllImageResources() { this.imageTable.clear(); this.imageTable = null; - Enumeration var7 = this.imageResourceTable.elements(); + Enumeration var7 = this.imageResourceTable.elements(); while (var7.hasMoreElements()) { try { - ((ImageResource) ((ImageResource) var7.nextElement())).method1652(); + var7.nextElement().method1652(); } catch (Exception var4) { ; } @@ -198,7 +198,7 @@ private Image getImage(String var1, boolean var2) { } else { do { Tools.sleep(100L); - var3 = (Image) ((Image) this.imageTable.get(var1)); + var3 = this.imageTable.get(var1); } while (var3 == null); return var3; @@ -206,7 +206,7 @@ private Image getImage(String var1, boolean var2) { } private Image getImageFromTable(String key) { - Image image = (Image) this.imageTable.get(key); + Image image = this.imageTable.get(key); if (image != null) { return image; } else { @@ -223,7 +223,7 @@ private synchronized ImageResource getImageResource(String var1) { int var2 = this.imageResourceTable.size(); for (int var3 = 0; var3 < var2; ++var3) { - ImageResource var4 = (ImageResource) ((ImageResource) this.imageResourceTable.elementAt(var3)); + ImageResource var4 = this.imageResourceTable.elementAt(var3); if (var4.method1648().equals(var1)) { return var4; } @@ -239,7 +239,7 @@ private boolean method1645() { return false; } - var1 = (ImageResource) ((ImageResource) this.imageResourceTable.elementAt(0)); + var1 = this.imageResourceTable.elementAt(0); } String imageAlias = var1.method1648(); @@ -285,7 +285,7 @@ private synchronized ImageResource method1646(String var1) { int var2 = this.imageResourceTable.size(); for (int var3 = 0; var3 < var2; ++var3) { - ImageResource var4 = (ImageResource) ((ImageResource) this.imageResourceTable.elementAt(var3)); + ImageResource var4 = this.imageResourceTable.elementAt(var3); if (var4.method1648().equals(var1)) { this.imageResourceTable.removeElementAt(var3); return var4; diff --git a/client/src/main/java/com/aapeli/client/InputTextField.java b/client/src/main/java/com/aapeli/client/InputTextField.java index 4b5f7df7..bc9d27ff 100644 --- a/client/src/main/java/com/aapeli/client/InputTextField.java +++ b/client/src/main/java/com/aapeli/client/InputTextField.java @@ -23,7 +23,7 @@ public class InputTextField extends TextField implements FocusListener, KeyListe private int anInt722; private boolean aBoolean723; private boolean enabled; - private Vector userInputz; + private Vector userInputz; private int userInputzCount; private int anInt727; private String finalInput; @@ -53,7 +53,7 @@ public InputTextField(String defaultText, int maxLen, boolean enabled) { this.aBoolean723 = false; this.enabled = enabled; if (enabled) { - this.userInputz = new Vector(); + this.userInputz = new Vector<>(); this.userInputzCount = this.anInt727 = 0; } diff --git a/client/src/main/java/com/aapeli/client/TextManager.java b/client/src/main/java/com/aapeli/client/TextManager.java index a60ab9a2..fa7503f2 100644 --- a/client/src/main/java/com/aapeli/client/TextManager.java +++ b/client/src/main/java/com/aapeli/client/TextManager.java @@ -585,8 +585,8 @@ private void loadLocaleFiles(Applet applet) { this.sharedTable = this.loadLocalizationTable(codeBase); } - private Hashtable loadLocalizationTable(URL baseUrl) { - Hashtable localizationTable = new Hashtable(); + private Hashtable loadLocalizationTable(URL baseUrl) { + Hashtable localizationTable = new Hashtable<>(); BufferedReader reader = null; String languageFileName = this.language + ".loc"; diff --git a/client/src/main/java/com/aapeli/colorgui/ColorButton.java b/client/src/main/java/com/aapeli/colorgui/ColorButton.java index f9530e92..900d308f 100644 --- a/client/src/main/java/com/aapeli/colorgui/ColorButton.java +++ b/client/src/main/java/com/aapeli/colorgui/ColorButton.java @@ -50,7 +50,7 @@ public class ColorButton extends IPanel implements MouseMotionListener, MouseLis private boolean aBoolean3277; private boolean aBoolean3278; private int anInt3279; - private Vector aVector3280; + private Vector aVector3280; private Image anImage3281; private Graphics aGraphics3282; private int anInt3283; @@ -73,7 +73,7 @@ public ColorButton(String var1) { this.aBoolean3276 = true; this.aBoolean3277 = this.aBoolean3278 = false; this.anInt3279 = 1; - this.aVector3280 = new Vector(); + this.aVector3280 = new Vector<>(); this.aClass90_3285 = null; this.aBoolean3286 = false; this.addMouseMotionListener(this); @@ -349,14 +349,14 @@ public Dimension getPreferredSize() { } public void addActionListener(ActionListener var1) { - Vector var2 = this.aVector3280; + Vector var2 = this.aVector3280; synchronized (this.aVector3280) { this.aVector3280.addElement(var1); } } public void removeActionListener(ActionListener var1) { - Vector var2 = this.aVector3280; + Vector var2 = this.aVector3280; synchronized (this.aVector3280) { this.aVector3280.removeElement(var1); } @@ -400,14 +400,14 @@ public boolean isNormalState() { } public void processActionEvent() { - Vector var1 = this.aVector3280; + Vector var1 = this.aVector3280; synchronized (this.aVector3280) { if (this.aVector3280.size() != 0) { ActionEvent var2 = new ActionEvent(this, 1001, this.aString3272); - Enumeration var3 = this.aVector3280.elements(); + Enumeration var3 = this.aVector3280.elements(); while (var3.hasMoreElements()) { - ((ActionListener) ((ActionListener) var3.nextElement())).actionPerformed(var2); + var3.nextElement().actionPerformed(var2); } } diff --git a/client/src/main/java/com/aapeli/colorgui/ColorCheckbox.java b/client/src/main/java/com/aapeli/colorgui/ColorCheckbox.java index 0c4bc41c..5a94206a 100644 --- a/client/src/main/java/com/aapeli/colorgui/ColorCheckbox.java +++ b/client/src/main/java/com/aapeli/colorgui/ColorCheckbox.java @@ -1,8 +1,6 @@ package com.aapeli.colorgui; import com.aapeli.client.IPanel; -import com.aapeli.colorgui.Class94; -import com.aapeli.colorgui.ColorCheckboxGroup; import java.awt.Color; import java.awt.Dimension; @@ -38,7 +36,7 @@ public class ColorCheckbox extends IPanel implements ItemSelectable, MouseListen private boolean aBoolean3302; private boolean aBoolean3303; private ColorCheckboxGroup aColorCheckboxGroup3304; - private Vector aVector3305; + private Vector aVector3305; private Image anImage3306; private Graphics aGraphics3307; private int anInt3308; @@ -60,7 +58,7 @@ public ColorCheckbox(String var1) { public ColorCheckbox(String var1, boolean var2) { this.aString3300 = var1; this.aBoolean3302 = var2; - this.aVector3305 = new Vector(); + this.aVector3305 = new Vector<>(); this.anInt3301 = -1; this.aBoolean3303 = false; this.setFont(Class94.aFont1575); @@ -168,14 +166,14 @@ public void mouseReleased(MouseEvent var1) { } public void addItemListener(ItemListener var1) { - Vector var2 = this.aVector3305; + Vector var2 = this.aVector3305; synchronized (this.aVector3305) { this.aVector3305.addElement(var1); } } public void removeItemListener(ItemListener var1) { - Vector var2 = this.aVector3305; + Vector var2 = this.aVector3305; synchronized (this.aVector3305) { this.aVector3305.removeElement(var1); } @@ -327,14 +325,14 @@ private Font method837(Font var1, String var2, int var3) { } private void method838() { - Vector var1 = this.aVector3305; + Vector var1 = this.aVector3305; synchronized (this.aVector3305) { if (this.aVector3305.size() != 0) { ItemEvent var2 = new ItemEvent(this, 0, this, 701); - Enumeration var3 = this.aVector3305.elements(); + Enumeration var3 = this.aVector3305.elements(); while (var3.hasMoreElements()) { - ((ItemListener) ((ItemListener) var3.nextElement())).itemStateChanged(var2); + var3.nextElement().itemStateChanged(var2); } } diff --git a/client/src/main/java/com/aapeli/colorgui/ColorCheckboxGroup.java b/client/src/main/java/com/aapeli/colorgui/ColorCheckboxGroup.java index ae302e0d..db2814b1 100644 --- a/client/src/main/java/com/aapeli/colorgui/ColorCheckboxGroup.java +++ b/client/src/main/java/com/aapeli/colorgui/ColorCheckboxGroup.java @@ -7,7 +7,7 @@ public final class ColorCheckboxGroup { - private Vector aVector1553 = new Vector(); + private Vector aVector1553 = new Vector<>(); protected void method1747(ColorCheckbox var1) { @@ -24,10 +24,10 @@ protected boolean method1748(boolean var1) { } private void method1749() { - Enumeration var1 = this.aVector1553.elements(); + Enumeration var1 = this.aVector1553.elements(); while (var1.hasMoreElements()) { - ((ColorCheckbox) ((ColorCheckbox) var1.nextElement())).realSetState(false); + var1.nextElement().realSetState(false); } } diff --git a/client/src/main/java/com/aapeli/colorgui/ColorList.java b/client/src/main/java/com/aapeli/colorgui/ColorList.java index 844aeb90..ea89a931 100644 --- a/client/src/main/java/com/aapeli/colorgui/ColorList.java +++ b/client/src/main/java/com/aapeli/colorgui/ColorList.java @@ -57,8 +57,8 @@ public final class ColorList extends Panel implements ComponentListener, Adjustm private int anInt666; private String aString667; private Color aColor668; - private Vector aVector669; - private Vector aVector670; + private Vector aVector669; + private Vector aVector670; private int anInt671; private int anInt672; private int anInt673; @@ -68,7 +68,7 @@ public final class ColorList extends Panel implements ComponentListener, Adjustm private Graphics aGraphics677; private int anInt678; private int anInt679; - private Vector aVector680; + private Vector aVector680; public ColorList(int var1, int var2) { @@ -91,7 +91,7 @@ public ColorList(int var1, int var2, Font var3, int var4, int var5) { int var6 = var3.getSize(); this.aFont659 = new Font(var3.getName(), 1, var6); this.anInt660 = var4; - this.aVector669 = new Vector(); + this.aVector669 = new Vector<>(); this.anInt665 = 0; this.anInt666 = 0; this.anInt663 = (var6 > var5 ? var6 : var5) + 4; @@ -107,7 +107,7 @@ public ColorList(int var1, int var2, Font var3, int var4, int var5) { this.aBoolean654 = false; this.addComponentListener(this); this.addMouseListener(this); - this.aVector680 = new Vector(); + this.aVector680 = new Vector<>(); } public void addNotify() { @@ -136,7 +136,7 @@ public void update(Graphics var1) { ColorListItemGroup var3 = null; synchronized (this) { - this.aVector670 = new Vector(); + this.aVector670 = new Vector<>(); int var6 = 0; Class91 var2; if (this.aString667 != null) { @@ -195,10 +195,10 @@ public void update(Graphics var1) { private boolean method944() { ColorListItemGroup var1 = null; - Enumeration var4 = this.aVector669.elements(); + Enumeration var4 = this.aVector669.elements(); while (var4.hasMoreElements()) { - ColorListItem var3 = (ColorListItem) ((ColorListItem) var4.nextElement()); + ColorListItem var3 = var4.nextElement(); ColorListItemGroup var2 = var3.getGroup(); if (var2 != null) { if (var1 != null && var2 != var1) { @@ -409,7 +409,7 @@ public synchronized void addItem(ColorListItem var1) { } public synchronized ColorListItem getItem(int var1) { - return (ColorListItem) ((ColorListItem) this.aVector669.elementAt(var1)); + return this.aVector669.elementAt(var1); } public synchronized ColorListItem getItem(String var1) { @@ -570,7 +570,7 @@ private int method949(ColorListItem var1) { private int method950(int var1, int var2) { for (int var4 = 0; var4 < var2; ++var4) { - int var3 = this.method949((ColorListItem) ((ColorListItem) this.aVector669.elementAt(var4))); + int var3 = this.method949(this.aVector669.elementAt(var4)); if (var1 <= var3) { return var4; } @@ -581,7 +581,7 @@ private int method950(int var1, int var2) { private int method951(int var1, int var2, int var3) { for (int var5 = var2; var5 < var3; ++var5) { - int var4 = this.method949((ColorListItem) ((ColorListItem) this.aVector669.elementAt(var5))); + int var4 = this.method949(this.aVector669.elementAt(var5)); if (var4 > var1) { return var5; } @@ -671,10 +671,10 @@ 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 var5 = this.aVector680.elements(); + Enumeration var5 = this.aVector680.elements(); while (var5.hasMoreElements()) { - ((ItemListener) ((ItemListener) var5.nextElement())).itemStateChanged(var4); + var5.nextElement().itemStateChanged(var4); } } diff --git a/client/src/main/java/com/aapeli/colorgui/ColorSpinner.java b/client/src/main/java/com/aapeli/colorgui/ColorSpinner.java index 5550457a..a0825613 100644 --- a/client/src/main/java/com/aapeli/colorgui/ColorSpinner.java +++ b/client/src/main/java/com/aapeli/colorgui/ColorSpinner.java @@ -20,7 +20,7 @@ public final class ColorSpinner extends IPanel implements MouseListener, MouseMotionListener, ItemSelectable { - private Vector aVector3310 = new Vector(); + private Vector aVector3310 = new Vector<>(); private int anInt3311 = -1; private int anInt3312 = 0; private boolean aBoolean3313; @@ -28,7 +28,7 @@ public final class ColorSpinner extends IPanel implements MouseListener, MouseMo private boolean aBoolean3315; private Font aFont3316; private int anInt3317; - private Vector aVector3318; + private Vector aVector3318; private Image anImage3319; private Graphics aGraphics3320; private int anInt3321; @@ -47,7 +47,7 @@ public ColorSpinner() { this.aClass92_3323 = null; this.anInt3324 = 0; this.anObject3325 = new Object(); - this.aVector3318 = new Vector(); + this.aVector3318 = new Vector<>(); this.addMouseListener(this); this.addMouseMotionListener(this); this.anInt3321 = this.anInt3322 = -1; @@ -214,7 +214,7 @@ public Object[] getSelectedObjects() { } public int addItem(String var1) { - Vector var2 = this.aVector3310; + Vector var2 = this.aVector3310; synchronized (this.aVector3310) { this.aVector3310.addElement(var1); if (this.anInt3311 == -1) { @@ -227,16 +227,16 @@ public int addItem(String var1) { } public String getItem(int var1) { - Vector var2 = this.aVector3310; + Vector var2 = this.aVector3310; synchronized (this.aVector3310) { - return (String) ((String) this.aVector3310.elementAt(var1)); + return this.aVector3310.elementAt(var1); } } public String removeItem(int var1) { - Vector var2 = this.aVector3310; + Vector var2 = this.aVector3310; synchronized (this.aVector3310) { - String var3 = (String) ((String) this.aVector3310.elementAt(var1)); + String var3 = this.aVector3310.elementAt(var1); this.aVector3310.removeElementAt(var1); if (this.anInt3311 >= var1) { --this.anInt3311; @@ -252,7 +252,7 @@ public String removeItem(int var1) { } public boolean removeAllItems() { - Vector var1 = this.aVector3310; + Vector var1 = this.aVector3310; synchronized (this.aVector3310) { if (!this.aVector3310.isEmpty()) { this.aVector3310.removeAllElements(); @@ -266,7 +266,7 @@ public boolean removeAllItems() { } public boolean setSelectedIndex(int var1) { - Vector var2 = this.aVector3310; + Vector var2 = this.aVector3310; synchronized (this.aVector3310) { if (var1 >= 0 && var1 < this.aVector3310.size()) { if (var1 != this.anInt3311) { @@ -287,7 +287,7 @@ public int getSelectedIndex() { } public String getSelectedItem() { - Vector var1 = this.aVector3310; + Vector var1 = this.aVector3310; synchronized (this.aVector3310) { return this.anInt3311 == -1 ? null : this.getItem(this.anInt3311); } @@ -298,14 +298,14 @@ public int getItemCount() { } public void addItemListener(ItemListener var1) { - Vector var2 = this.aVector3318; + Vector var2 = this.aVector3318; synchronized (this.aVector3318) { this.aVector3318.addElement(var1); } } public void removeItemListener(ItemListener var1) { - Vector var2 = this.aVector3318; + Vector var2 = this.aVector3318; synchronized (this.aVector3318) { this.aVector3318.removeElement(var1); } @@ -381,7 +381,7 @@ private Color method844(Color var1, Color var2) { } private void method845() { - Vector var1 = this.aVector3318; + Vector var1 = this.aVector3318; synchronized (this.aVector3318) { if (!this.aVector3318.isEmpty()) { if (this.aClass92_3323 != null) { @@ -403,10 +403,10 @@ protected void method846() { String var1 = this.getSelectedItem(); if (var1 != null) { ItemEvent var2 = new ItemEvent(this, 701, var1, 1); - Enumeration var3 = this.aVector3318.elements(); + Enumeration var3 = this.aVector3318.elements(); while (var3.hasMoreElements()) { - ((ItemListener) ((ItemListener) var3.nextElement())).itemStateChanged(var2); + var3.nextElement().itemStateChanged(var2); } } diff --git a/client/src/main/java/com/aapeli/colorgui/ColorTextArea.java b/client/src/main/java/com/aapeli/colorgui/ColorTextArea.java index 2303cc0b..6f03fe46 100644 --- a/client/src/main/java/com/aapeli/colorgui/ColorTextArea.java +++ b/client/src/main/java/com/aapeli/colorgui/ColorTextArea.java @@ -52,8 +52,8 @@ public class ColorTextArea extends IPanel implements ComponentListener, Adjustme private int anInt3342; private int anInt3343; private int anInt3344; - private Vector aVector3345; - private Vector aVector3346; + private Vector aVector3345; + private Vector aVector3346; private Image anImage3347; private Graphics aGraphics3348; private int anInt3349; @@ -78,8 +78,8 @@ public ColorTextArea(int var1, int var2, Font var3) { this.aFontMetrics3338 = this.getFontMetrics(var3); this.anInt3339 = var3.getSize(); this.aFont3337 = new Font(var3.getName(), 1, var3.getSize()); - this.aVector3345 = new Vector(); - this.aVector3346 = new Vector(); + this.aVector3345 = new Vector<>(); + this.aVector3346 = new Vector<>(); this.anImage3333 = null; this.anInt3343 = this.anInt3339 + 3; this.method849(); @@ -124,7 +124,7 @@ public void update(Graphics var1) { int var5 = this.aBoolean3332 ? this.aScrollbar3331.getValue() : 0; for (int var7 = 0; var7 <= this.anInt3344 && var5 < var3; ++var7) { - Class93 var6 = (Class93) ((Class93) this.aVector3345.elementAt(var5)); + Class93 var6 = this.aVector3345.elementAt(var5); if (!var6.method1754()) { this.aGraphics3348.setFont(var6.method1753() ? this.aFont3337 : this.aFont3336); this.aGraphics3348.setColor(var6.method1751()); @@ -216,7 +216,7 @@ public String[] getTimeStampedCache() { String var4 = ""; for (int var9 = 0; var9 < var2; ++var9) { - Class93 var5 = (Class93) ((Class93) this.aVector3346.elementAt(var9)); + Class93 var5 = this.aVector3346.elementAt(var9); if (var5.method1754()) { var3[var9] = var4; } else { @@ -280,7 +280,7 @@ private void method848() { break; } - Class93 var3 = (Class93) ((Class93) this.aVector3346.elementAt(var4)); + Class93 var3 = this.aVector3346.elementAt(var4); this.method852(var3.method1751(), var3.method1752(), var3.method1753()); ++var4; } diff --git a/client/src/main/java/com/aapeli/colorgui/MultiColorList.java b/client/src/main/java/com/aapeli/colorgui/MultiColorList.java index f9bbdf77..677e0b22 100644 --- a/client/src/main/java/com/aapeli/colorgui/MultiColorList.java +++ b/client/src/main/java/com/aapeli/colorgui/MultiColorList.java @@ -61,14 +61,14 @@ public class MultiColorList extends Panel implements AdjustmentListener, MouseLi private int anInt703; private int[] anIntArray704; private int anInt705; - private Vector aVector706; + private Vector aVector706; private int anInt707; private int anInt708; private int anInt709; private int anInt710; private Image anImage711; private Graphics aGraphics712; - private Vector aVector713; + private Vector aVector713; private MultiColorListListener listListener; public MultiColorList(String[] var1, int[] var2, int var3, int var4, int var5) { @@ -81,7 +81,7 @@ public MultiColorList(String[] var1, int[] var2, int var3, int var4, int var5) { this.aString694 = null; this.aChar695 = 46; this.anInt698 = var1 != null ? var1.length : 0; - this.aVector706 = new Vector(); + this.aVector706 = new Vector<>(); this.anInt705 = 0; this.anInt702 = var4 - 6 - 16; this.anInt703 = var5 / 16 - 1; @@ -96,7 +96,7 @@ public MultiColorList(String[] var1, int[] var2, int var3, int var4, int var5) { this.aScrollbar686.setUnitIncrement(1); this.aBoolean687 = false; this.addMouseListener(this); - this.aVector713 = new Vector(); + this.aVector713 = new Vector<>(); } public void addNotify() { @@ -398,7 +398,7 @@ public synchronized void addItem(MultiColorListItem var1) { } public synchronized MultiColorListItem getItem(int var1) { - return (MultiColorListItem) ((MultiColorListItem) this.aVector706.elementAt(var1)); + return this.aVector706.elementAt(var1); } public synchronized MultiColorListItem getItem(int var1, String var2) { @@ -716,10 +716,10 @@ 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 var5 = this.aVector713.elements(); + Enumeration var5 = this.aVector713.elements(); while (var5.hasMoreElements()) { - ((ItemListener) ((ItemListener) var5.nextElement())).itemStateChanged(var4); + var5.nextElement().itemStateChanged(var4); } } diff --git a/client/src/main/java/com/aapeli/colorgui/RadioButtonGroup.java b/client/src/main/java/com/aapeli/colorgui/RadioButtonGroup.java index 0bf572ae..27a8b216 100644 --- a/client/src/main/java/com/aapeli/colorgui/RadioButtonGroup.java +++ b/client/src/main/java/com/aapeli/colorgui/RadioButtonGroup.java @@ -1,14 +1,13 @@ package com.aapeli.colorgui; -import com.aapeli.colorgui.RadioButton; -import com.aapeli.colorgui.RoundRadioButton; +import com.aapeli.client.IPanel; import java.util.Enumeration; import java.util.Vector; public final class RadioButtonGroup { - private Vector aVector1589; + private Vector aVector1589; private boolean aBoolean1590; @@ -17,7 +16,7 @@ public RadioButtonGroup() { } public RadioButtonGroup(boolean var1) { - this.aVector1589 = new Vector(); + this.aVector1589 = new Vector<>(); this.aBoolean1590 = var1; } @@ -39,14 +38,14 @@ protected boolean method1758(boolean var1) { } private void method1759() { - Enumeration var1 = this.aVector1589.elements(); + Enumeration var1 = this.aVector1589.elements(); while (var1.hasMoreElements()) { Object var2 = var1.nextElement(); if (var2 instanceof RadioButton) { - ((RadioButton) ((RadioButton) var2)).realSetState(false); + ((RadioButton) var2).realSetState(false); } else { - ((RoundRadioButton) ((RoundRadioButton) var2)).realSetState(false); + ((RoundRadioButton) var2).realSetState(false); } } diff --git a/client/src/main/java/com/aapeli/colorgui/RoundButton.java b/client/src/main/java/com/aapeli/colorgui/RoundButton.java index b23bedc7..e27db60c 100644 --- a/client/src/main/java/com/aapeli/colorgui/RoundButton.java +++ b/client/src/main/java/com/aapeli/colorgui/RoundButton.java @@ -1,7 +1,6 @@ package com.aapeli.colorgui; import com.aapeli.client.IPanel; -import com.aapeli.colorgui.Class95; import java.awt.Color; import java.awt.Dimension; @@ -35,7 +34,7 @@ public class RoundButton extends IPanel implements MouseMotionListener, MouseLis private Image anImage3392; private boolean aBoolean3393; private boolean aBoolean3394; - private Vector aVector3395; + private Vector aVector3395; private Image anImage3396; private Graphics aGraphics3397; private int anInt3398; @@ -68,7 +67,7 @@ public RoundButton(String var1, Image var2, Image var3) { this.anImage3391 = var2; this.anImage3392 = var3; this.aBoolean3393 = this.aBoolean3394 = false; - this.aVector3395 = new Vector(); + this.aVector3395 = new Vector<>(); this.aClass95_3400 = null; this.aBoolean3401 = false; this.addMouseMotionListener(this); @@ -219,14 +218,14 @@ public Dimension getPreferredSize() { } public void addActionListener(ActionListener var1) { - Vector var2 = this.aVector3395; + Vector var2 = this.aVector3395; synchronized (this.aVector3395) { this.aVector3395.addElement(var1); } } public void removeActionListener(ActionListener var1) { - Vector var2 = this.aVector3395; + Vector var2 = this.aVector3395; synchronized (this.aVector3395) { this.aVector3395.removeElement(var1); } @@ -261,14 +260,14 @@ public void setFlashing(boolean var1) { } public void processActionEvent() { - Vector var1 = this.aVector3395; + Vector var1 = this.aVector3395; synchronized (this.aVector3395) { if (this.aVector3395.size() != 0) { ActionEvent var2 = new ActionEvent(this, 1001, this.aString3387); - Enumeration var3 = this.aVector3395.elements(); + Enumeration var3 = this.aVector3395.elements(); while (var3.hasMoreElements()) { - ((ActionListener) ((ActionListener) var3.nextElement())).actionPerformed(var2); + var3.nextElement().actionPerformed(var2); } } diff --git a/client/src/main/java/com/aapeli/colorgui/TabBar.java b/client/src/main/java/com/aapeli/colorgui/TabBar.java index 62ac6c1b..acf4c494 100644 --- a/client/src/main/java/com/aapeli/colorgui/TabBar.java +++ b/client/src/main/java/com/aapeli/colorgui/TabBar.java @@ -39,12 +39,12 @@ public class TabBar extends IPanel implements ComponentListener, ActionListener private int anInt3416; private int anInt3417; private RadioButtonGroup aRadioButtonGroup3418; - private Vector aVector3419; + private Vector aVector3419; private int anInt3420; private int anInt3421; private int anInt3422; private int anInt3423; - private Vector aVector3424; + private Vector aVector3424; private Object anObject3425 = new Object(); @@ -59,11 +59,11 @@ public TabBar(int var1, int var2) { this.setButtonForeground(aColor3406); this.anInt3422 = 2; this.aRadioButtonGroup3418 = new RadioButtonGroup(); - this.aVector3419 = new Vector(); + this.aVector3419 = new Vector<>(); this.anInt3420 = 0; this.anInt3421 = -1; this.addComponentListener(this); - this.aVector3424 = new Vector(); + this.aVector3424 = new Vector<>(); this.setLayout((LayoutManager) null); this.anInt3423 = 0; } @@ -223,7 +223,7 @@ public void addTab(TabBarItem var1) { } public TabBarItem getTabBarItemByIndex(int var1) { - TabBarItem var2 = (TabBarItem) ((TabBarItem) this.aVector3419.elementAt(var1)); + TabBarItem var2 = this.aVector3419.elementAt(var1); return var2; } @@ -388,10 +388,10 @@ private void method879(int var1) { Object var2 = this.anObject3425; synchronized (this.anObject3425) { if (this.aVector3424.size() != 0) { - Enumeration var3 = this.aVector3424.elements(); + Enumeration var3 = this.aVector3424.elements(); while (var3.hasMoreElements()) { - ((TabBarListener) ((TabBarListener) var3.nextElement())).selectedTabChanged(var1); + var3.nextElement().selectedTabChanged(var1); } } diff --git a/client/src/main/java/com/aapeli/connection/GamePacketQueue.java b/client/src/main/java/com/aapeli/connection/GamePacketQueue.java index db8fbd1b..09216b49 100644 --- a/client/src/main/java/com/aapeli/connection/GamePacketQueue.java +++ b/client/src/main/java/com/aapeli/connection/GamePacketQueue.java @@ -8,7 +8,7 @@ class GamePacketQueue implements Runnable { private Connection conn; private ConnListener connListener; - private Vector packets; + private Vector packets; private boolean running; private Thread thread; @@ -16,7 +16,7 @@ class GamePacketQueue implements Runnable { protected GamePacketQueue(Connection conn, ConnListener connListener) { this.conn = conn; this.connListener = connListener; - this.packets = new Vector(); + this.packets = new Vector<>(); this.running = true; this.thread = new Thread(this); this.thread.start(); @@ -54,7 +54,7 @@ protected void stop() { private synchronized String nextGamePacket() { if (!this.packets.isEmpty() && this.running) { - String var1 = (String) ((String) this.packets.elementAt(0)); + String var1 = this.packets.elementAt(0); this.packets.removeElementAt(0); return var1; } else { diff --git a/client/src/main/java/com/aapeli/connection/GameQueue.java b/client/src/main/java/com/aapeli/connection/GameQueue.java index 43aae00d..0f136e65 100644 --- a/client/src/main/java/com/aapeli/connection/GameQueue.java +++ b/client/src/main/java/com/aapeli/connection/GameQueue.java @@ -4,7 +4,7 @@ class GameQueue { - private Vector commands = new Vector(); + private Vector commands = new Vector<>(); private int count = 0; private ConnCipher connCipher = new ConnCipher((int) (Math.random() * 19.0D)); protected long sendSeqNum; @@ -29,7 +29,7 @@ protected String pop() { if (this.commands.size() <= this.count) { return null; } else { - String var1 = (String) ((String) this.commands.elementAt(this.count)); + String var1 = this.commands.elementAt(this.count); var1 = this.connCipher.decrypt(var1); if (this.commands.size() > 3) { this.commands.removeElementAt(0); diff --git a/client/src/main/java/com/aapeli/multiuser/ChatTextArea.java b/client/src/main/java/com/aapeli/multiuser/ChatTextArea.java index 82726d45..1df000ba 100644 --- a/client/src/main/java/com/aapeli/multiuser/ChatTextArea.java +++ b/client/src/main/java/com/aapeli/multiuser/ChatTextArea.java @@ -13,7 +13,7 @@ public class ChatTextArea extends ColorTextArea { public static final Font SMALL_FONT; private TextManager aTextManager4728; private BadWordFilter aBadWordFilter4729; - private Hashtable aHashtable4730; + private Hashtable aHashtable4730; public ChatTextArea(TextManager var1, int var2, int var3) { this(var1, (BadWordFilter) null, var2, var3, (Font) null); @@ -31,7 +31,7 @@ public ChatTextArea(TextManager var1, BadWordFilter var2, int var3, int var4, Fo super(var3, var4, var5 != null ? var5 : DEFAULT_FONT); this.aTextManager4728 = var1; this.aBadWordFilter4729 = var2; - this.aHashtable4730 = new Hashtable(); + this.aHashtable4730 = new Hashtable<>(); } public void addOwnSay(String var1, String var2) { @@ -147,7 +147,7 @@ private int method858(int var1) { } private int method859(String var1, int var2) { - Integer var3 = (Integer) ((Integer) this.aHashtable4730.get(var1)); + Integer var3 = this.aHashtable4730.get(var1); return var3 == null ? var2 : var3.intValue(); } diff --git a/client/src/main/java/com/aapeli/multiuser/UserList.java b/client/src/main/java/com/aapeli/multiuser/UserList.java index 5abd8b7c..41a6cb9a 100644 --- a/client/src/main/java/com/aapeli/multiuser/UserList.java +++ b/client/src/main/java/com/aapeli/multiuser/UserList.java @@ -83,14 +83,14 @@ public class UserList extends IPanel implements ComponentListener, ItemListener, private MenuItem aMenuItem3494; private UserListItem anUserListItem3495; private StaffActionFrame aStaffActionFrame__3496; - private Vector aVector3497; - private Vector aVector3498; + private Vector aVector3497; + private Vector aVector3498; private boolean aBoolean3499; private boolean aBoolean3500; private ColorTextArea aColorTextArea3501; private ChatBase aChatBase3502; private Languages aLanguages3503; - private Hashtable aHashtable3504; + private Hashtable aHashtable3504; public UserList(UserListHandler handler, TextManager textManager, ImageManager imageManager, boolean var4, boolean var5, boolean var6) { @@ -115,11 +115,11 @@ public UserList(UserListHandler handler, TextManager textManager, ImageManager i this.isSheriff = false; this.sheriffStatus = this.adminStatus = 0; - this.aVector3497 = new Vector(); - this.aVector3498 = new Vector(); + this.aVector3497 = new Vector<>(); + this.aVector3498 = new Vector<>(); this.aBoolean3499 = this.aBoolean3500 = true; this.aLanguages3503 = new Languages(textManager, imageManager); - this.aHashtable3504 = new Hashtable(); + this.aHashtable3504 = new Hashtable<>(); this.addComponentListener(this); } @@ -472,7 +472,7 @@ public void addUser(UserListItem var1) { int var5 = var1.getLanguage(); Integer var6 = var5; - ColorListItemGroup var7 = (ColorListItemGroup) ((ColorListItemGroup) this.aHashtable3504.get(var6)); + ColorListItemGroup var7 = this.aHashtable3504.get(var6); if (var7 == null) { int var8 = var5; if (var5 == 0) { diff --git a/client/src/main/java/com/aapeli/tools/QuickTimer.java b/client/src/main/java/com/aapeli/tools/QuickTimer.java index 120cfab6..e78b5d34 100644 --- a/client/src/main/java/com/aapeli/tools/QuickTimer.java +++ b/client/src/main/java/com/aapeli/tools/QuickTimer.java @@ -7,7 +7,7 @@ public class QuickTimer implements Runnable { private int anInt1727; - private Vector aVector1728; + private Vector aVector1728; private boolean stopped; private static final String aString1730 = "QuickTimer.start() called after QuickTimer.stopAll() was called"; @@ -22,7 +22,7 @@ public QuickTimer(int var1, QuickTimerListener var2) { private QuickTimer(int var1, QuickTimerListener var2, boolean var3) { this.anInt1727 = var1; - this.aVector1728 = new Vector(); + this.aVector1728 = new Vector<>(); if (var2 != null) { this.addListener(var2); } @@ -41,12 +41,12 @@ public QuickTimer(QuickTimerListener var1, int var2) { public void run() { Tools.sleep((long) this.anInt1727); if (!this.stopped) { - Enumeration var1 = this.aVector1728.elements(); + Enumeration var1 = this.aVector1728.elements(); while (var1.hasMoreElements()) { QuickTimerListener var2; try { - var2 = (QuickTimerListener) ((QuickTimerListener) var1.nextElement()); + var2 = var1.nextElement(); } catch (NoSuchElementException var4) { return; } diff --git a/client/src/main/java/com/aapeli/tools/Tools.java b/client/src/main/java/com/aapeli/tools/Tools.java index a89a082e..eddc1f1e 100644 --- a/client/src/main/java/com/aapeli/tools/Tools.java +++ b/client/src/main/java/com/aapeli/tools/Tools.java @@ -114,7 +114,7 @@ public static int getRandomByPossibility(double[] var0) { } } - public static String[] vectorToStringArray(Vector var0) { + public static String[] vectorToStringArray(Vector var0) { if (var0 == null) { return null; } else { diff --git a/client/src/main/java/com/aapeli/tools/XmlUnit.java b/client/src/main/java/com/aapeli/tools/XmlUnit.java index 59fb9433..25d4db48 100644 --- a/client/src/main/java/com/aapeli/tools/XmlUnit.java +++ b/client/src/main/java/com/aapeli/tools/XmlUnit.java @@ -10,15 +10,15 @@ public class XmlUnit { private static final String aString1736 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-:"; private String name; private String value; - private Vector children; - private Hashtable attributes; + private Vector children; + private Hashtable attributes; private XmlUnit(String var1) { this.name = var1; this.value = null; - this.children = new Vector(); - this.attributes = new Hashtable(); + this.children = new Vector<>(); + this.attributes = new Hashtable<>(); } public static XmlUnit parseString(String declarationTag, boolean var1, boolean var2) throws Exception { @@ -43,7 +43,7 @@ public XmlUnit getChild(String name) { int childrenCount = this.children.size(); for (int index = 0; index < childrenCount; ++index) { - XmlUnit child = (XmlUnit) this.children.elementAt(index); + XmlUnit child = this.children.elementAt(index); if (child.getName().equals(name)) { return child; } @@ -64,7 +64,7 @@ public XmlUnit[] getChildren() { XmlUnit[] childrenArray = new XmlUnit[childrenCount]; for (int index = 0; index < childrenCount; ++index) { - childrenArray[index] = (XmlUnit) this.children.elementAt(index); + childrenArray[index] = this.children.elementAt(index); } return childrenArray; @@ -97,12 +97,12 @@ public XmlUnit[] getChildren(String name) { public String getAttribute(String var1) { synchronized (this.attributes) { - return (String) this.attributes.get(var1); + return this.attributes.get(var1); } } private static XmlUnit method1876(String var0, boolean var1) throws Exception { - Stack var2 = new Stack(); + Stack var2 = new Stack<>(); StringBuffer tagEnd = null; StringBuffer var4 = null; XmlUnit tagStart = null; diff --git a/client/src/main/java/org/moparforia/client/trackdump/Class98.java b/client/src/main/java/org/moparforia/client/trackdump/Class98.java index 50aa0628..26a3311c 100644 --- a/client/src/main/java/org/moparforia/client/trackdump/Class98.java +++ b/client/src/main/java/org/moparforia/client/trackdump/Class98.java @@ -4,7 +4,7 @@ class Class98 { - private Vector aVector1604 = new Vector(); + private Vector aVector1604 = new Vector<>(); private int anInt1605 = 0; private ConnCrypto aConnCrypto_1606 = new ConnCrypto((int) (Math.random() * 19.0D)); protected long aLong1607; @@ -29,7 +29,7 @@ protected String method1773() { if (this.aVector1604.size() <= this.anInt1605) { return null; } else { - String var1 = (String) ((String) this.aVector1604.elementAt(this.anInt1605)); + String var1 = this.aVector1604.elementAt(this.anInt1605); var1 = this.aConnCrypto_1606.decrypt(var1); if (this.aVector1604.size() > 3) { this.aVector1604.removeElementAt(0); diff --git a/client/src/main/java/org/moparforia/client/trackdump/Connection.java b/client/src/main/java/org/moparforia/client/trackdump/Connection.java index 836fa946..c99b0a4c 100644 --- a/client/src/main/java/org/moparforia/client/trackdump/Connection.java +++ b/client/src/main/java/org/moparforia/client/trackdump/Connection.java @@ -26,7 +26,7 @@ public final class Connection implements Runnable { private int anInt1621; private Class98 aClass98_1622; private GamePacketQueue aGamePacketQueue_1623; - private Vector aVector1624; + private Vector aVector1624; private long numReceivedGamePackets; private long lastCmdReceived; private ConnCrypto connCrypto; @@ -45,7 +45,7 @@ public Connection(ConnListener var3, String[] var4) { this.aLong1620 = -1L; this.anInt1621 = 25; this.aClass98_1622 = new Class98(); - this.aVector1624 = new Vector(); + this.aVector1624 = new Vector<>(); this.numReceivedGamePackets = -1L; this.anInt1613 = 0; this.disconnectReason = 0; @@ -215,7 +215,7 @@ private void method1780() { private void method1781() { while (true) { if (this.anInt1613 == 2 && !this.aVector1624.isEmpty()) { - String var1 = (String) ((String) this.aVector1624.firstElement()); + String var1 = this.aVector1624.firstElement(); this.aVector1624.removeElementAt(0); if (this.writeLineS(var1)) { continue; diff --git a/client/src/main/java/org/moparforia/client/trackdump/GamePacketQueue.java b/client/src/main/java/org/moparforia/client/trackdump/GamePacketQueue.java index ce35c9d4..1e1b2af6 100644 --- a/client/src/main/java/org/moparforia/client/trackdump/GamePacketQueue.java +++ b/client/src/main/java/org/moparforia/client/trackdump/GamePacketQueue.java @@ -6,7 +6,7 @@ class GamePacketQueue implements Runnable { private Connection conn; private ConnListener connListener; - private Vector packets; + private Vector packets; private boolean running; private Thread thread; @@ -14,7 +14,7 @@ class GamePacketQueue implements Runnable { protected GamePacketQueue(Connection conn, ConnListener connListener) { this.conn = conn; this.connListener = connListener; - this.packets = new Vector(); + this.packets = new Vector<>(); this.running = true; this.thread = new Thread(this); this.thread.start(); @@ -52,7 +52,7 @@ protected void stop() { private synchronized String nextGamePacket() { if (!this.packets.isEmpty() && this.running) { - String var1 = (String) ((String) this.packets.elementAt(0)); + String var1 = this.packets.elementAt(0); this.packets.removeElementAt(0); return var1; } else { diff --git a/editor/src/main/java/org/moparforia/editor/TrackPropertiesDialog.java b/editor/src/main/java/org/moparforia/editor/TrackPropertiesDialog.java index 6f622e5c..3d9a14e5 100644 --- a/editor/src/main/java/org/moparforia/editor/TrackPropertiesDialog.java +++ b/editor/src/main/java/org/moparforia/editor/TrackPropertiesDialog.java @@ -53,7 +53,7 @@ private void initComponents() { textTrackName = new JTextField(); panel1 = new JPanel(); label2 = new JLabel(); - comboTrackCategory = new JComboBox(); + comboTrackCategory = new JComboBox<>(); buttonBar = new JPanel(); okButton = new JButton(); cancelButton = new JButton(); @@ -100,7 +100,7 @@ private void initComponents() { //---- comboTrackCategory ---- comboTrackCategory.setPreferredSize(new Dimension(200, 20)); - comboTrackCategory.setModel(new DefaultComboBoxModel(new String[] { + comboTrackCategory.setModel(new DefaultComboBoxModel<>(new String[] { "Basic", "Traditional", "Modern", @@ -162,7 +162,7 @@ public void actionPerformed(ActionEvent e) { private JTextField textTrackName; private JPanel panel1; private JLabel label2; - private JComboBox comboTrackCategory; + private JComboBox comboTrackCategory; private JPanel buttonBar; private JButton okButton; private JButton cancelButton; From b186c14790be8a55c484a1c4ba28bb3bf8542842 Mon Sep 17 00:00:00 2001 From: Sten Laane <21343173+StenAL@users.noreply.github.com> Date: Tue, 28 May 2024 11:48:26 +0300 Subject: [PATCH 3/6] Client: Remove all redundant casts This is an automated change done by IntelliJ. --- client/src/main/java/agolf/Conn.java | 2 +- .../src/main/java/agolf/LobbySelectPanel.java | 2 +- .../java/agolf/LobbySelectRNOPspammer.java | 2 +- .../src/main/java/agolf/game/ChatPanel.java | 2 +- .../src/main/java/agolf/game/GameCanvas.java | 14 +++++----- .../java/agolf/game/GameControlPanel.java | 2 +- .../agolf/lobby/LobbyDualPlayerPanel.java | 4 +-- .../agolf/lobby/LobbyGamePasswordPanel.java | 4 +-- .../agolf/lobby/LobbyMultiPlayerPanel.java | 2 +- .../src/main/java/agolf/lobby/LobbyPanel.java | 2 +- .../agolf/lobby/LobbySinglePlayerPanel.java | 2 +- .../main/java/com/aapeli/applet/AdCanvas.java | 8 +++--- .../main/java/com/aapeli/bigtext/BigText.java | 4 +-- .../java/com/aapeli/bigtext/MediumText.java | 10 +++---- .../java/com/aapeli/client/BadWordFilter.java | 4 +-- .../java/com/aapeli/client/Frame_Sub3.java | 2 +- .../java/com/aapeli/client/IPanel_Sub40.java | 2 +- .../java/com/aapeli/client/ImageTracker.java | 4 +-- .../com/aapeli/client/InputTextField.java | 2 +- .../java/com/aapeli/client/Panel_Sub24.java | 6 ++--- .../java/com/aapeli/client/Parameters.java | 2 +- .../java/com/aapeli/colorgui/Class91.java | 4 +-- .../java/com/aapeli/colorgui/Class92.java | 2 +- .../java/com/aapeli/colorgui/ColorButton.java | 10 +++---- .../com/aapeli/colorgui/ColorCheckbox.java | 6 ++--- .../java/com/aapeli/colorgui/ColorList.java | 6 ++--- .../com/aapeli/colorgui/ColorListItem.java | 6 ++--- .../com/aapeli/colorgui/ColorTextArea.java | 6 ++--- .../com/aapeli/colorgui/MultiColorList.java | 4 +-- .../aapeli/colorgui/MultiColorListItem.java | 4 +-- .../java/com/aapeli/colorgui/RadioButton.java | 8 +++--- .../java/com/aapeli/colorgui/RoundButton.java | 18 ++++++------- .../com/aapeli/colorgui/RoundRadioButton.java | 8 +++--- .../main/java/com/aapeli/colorgui/TabBar.java | 2 +- .../java/com/aapeli/colorgui/TabBarItem.java | 2 +- .../com/aapeli/connection/ConnCipher.java | 2 +- .../java/com/aapeli/connection/GameQueue.java | 2 +- .../java/com/aapeli/multiuser/ChatBase.java | 4 +-- .../java/com/aapeli/multiuser/ChatLobby.java | 2 +- .../com/aapeli/multiuser/ChatTextArea.java | 6 ++--- .../com/aapeli/multiuser/GlobalTextArea.java | 10 +++---- .../aapeli/multiuser/StaffActionFrame.java | 2 +- .../java/com/aapeli/multiuser/UserList.java | 26 +++++++++---------- .../java/com/aapeli/tools/QuickTimer.java | 4 +-- .../main/java/com/aapeli/tools/XmlUnit.java | 2 +- .../moparforia/client/trackdump/Class98.java | 2 +- .../client/trackdump/ConnCrypto.java | 2 +- 47 files changed, 116 insertions(+), 116 deletions(-) diff --git a/client/src/main/java/agolf/Conn.java b/client/src/main/java/agolf/Conn.java index ac6f054a..4f66c5e2 100644 --- a/client/src/main/java/agolf/Conn.java +++ b/client/src/main/java/agolf/Conn.java @@ -32,7 +32,7 @@ public void dataReceived(String var1) { ; } - this.gameContainer.gameApplet.setEndState((Throwable) var4); + this.gameContainer.gameApplet.setEndState(var4); this.connection.closeConnection(); } } diff --git a/client/src/main/java/agolf/LobbySelectPanel.java b/client/src/main/java/agolf/LobbySelectPanel.java index 86923668..0c7e28a0 100644 --- a/client/src/main/java/agolf/LobbySelectPanel.java +++ b/client/src/main/java/agolf/LobbySelectPanel.java @@ -132,7 +132,7 @@ else if (evtSource == this.buttonDual) { this.writeData("qmpt"); } else { if (evtSource == this.buttonQuit) { - this.gameContainer.gameApplet.quit((String) null); + this.gameContainer.gameApplet.quit(null); } } diff --git a/client/src/main/java/agolf/LobbySelectRNOPspammer.java b/client/src/main/java/agolf/LobbySelectRNOPspammer.java index fc0ef03e..547b3fef 100644 --- a/client/src/main/java/agolf/LobbySelectRNOPspammer.java +++ b/client/src/main/java/agolf/LobbySelectRNOPspammer.java @@ -21,7 +21,7 @@ public void run() { do { this.lobbySelectPanel.requestNumberOfPlayers(); - Tools.sleep((long) sleepTime); + Tools.sleep(sleepTime); if (sleepTime < 120000) { sleepTime += 5000; } diff --git a/client/src/main/java/agolf/game/ChatPanel.java b/client/src/main/java/agolf/game/ChatPanel.java index 761c7f0b..b290dedf 100644 --- a/client/src/main/java/agolf/game/ChatPanel.java +++ b/client/src/main/java/agolf/game/ChatPanel.java @@ -191,7 +191,7 @@ private void method323() { } if (var1 != ChatBase.CIDR_NONE) { - ChatBase.setInputByCIDR(var1, this, this.textFieldMessage, this.buttonSay, (UrlLabel) null, this.gameContainer.textManager, this.gameContainer.params); + ChatBase.setInputByCIDR(var1, this, this.textFieldMessage, this.buttonSay, null, this.gameContainer.textManager, this.gameContainer.params); } } diff --git a/client/src/main/java/agolf/game/GameCanvas.java b/client/src/main/java/agolf/game/GameCanvas.java index 350e092c..1d3c9de5 100644 --- a/client/src/main/java/agolf/game/GameCanvas.java +++ b/client/src/main/java/agolf/game/GameCanvas.java @@ -785,9 +785,9 @@ protected boolean init(String commandLines, String playerStatuses, int gameId) { for (int magnetIndex = 0; magnetIndex < magnetVecLen; ++magnetIndex) { // [ x, y, blockid ] - int[] magnet = (int[]) magnetVec.elementAt(magnetIndex); - double forceTemp2X = (double) (magnet[0] - magnetLoopX); - double forcetemp2Y = (double) (magnet[1] - magnetLoopY); + int[] magnet = magnetVec.elementAt(magnetIndex); + double forceTemp2X = magnet[0] - magnetLoopX; + double forcetemp2Y = magnet[1] - magnetLoopY; double force = Math.sqrt(forceTemp2X * forceTemp2X + forcetemp2Y * forcetemp2Y); if (force <= 127.0D) { double var35 = Math.abs(forceTemp2X) / force; @@ -1394,7 +1394,7 @@ private void handleTeleport(int teleportId, int playerId, int x, int y) { do { i = startLen - 1; random = this.rngSeed.next() % (i + 1); - teleportPos = (double[]) this.teleportStarts[teleportId].elementAt(random); + teleportPos = this.teleportStarts[teleportId].elementAt(random); if (Math.abs(teleportPos[0] - (double) x) >= 15.0D || Math.abs(teleportPos[1] - (double) y) >= 15.0D) { this.playerX[playerId] = teleportPos[0]; this.playerY[playerId] = teleportPos[1]; @@ -1429,7 +1429,7 @@ private void handleTeleport(int teleportId, int playerId, int x, int y) { } //finally move player to exit position - teleportPos = (double[]) this.teleportExists[var13].elementAt(random); + teleportPos = this.teleportExists[var13].elementAt(random); this.playerX[playerId] = teleportPos[0]; this.playerY[playerId] = teleportPos[1]; } @@ -1666,8 +1666,8 @@ private void drawDashedLine(Graphics var1, int var2, int var3, int var4, int var int var6 = var4 >= 0 ? var4 : -var4; int var7 = var5 >= 0 ? var5 : -var5; int var8 = Math.max(var6, var7) / 10; - double var9 = (double) var2; - double var11 = (double) var3; + double var9 = var2; + double var11 = var3; double var13 = (double) var4 / ((double) var8 * 2.0D); double var15 = (double) var5 / ((double) var8 * 2.0D); var9 += var13; diff --git a/client/src/main/java/agolf/game/GameControlPanel.java b/client/src/main/java/agolf/game/GameControlPanel.java index bc177715..89bfafab 100644 --- a/client/src/main/java/agolf/game/GameControlPanel.java +++ b/client/src/main/java/agolf/game/GameControlPanel.java @@ -35,7 +35,7 @@ protected GameControlPanel(GameContainer var1, PlayerInfoPanel var2, int var3, i this.anInt342 = var3; this.anInt343 = var4; this.setSize(var3, var4); - this.setLayout((LayoutManager) null); + this.setLayout(null); this.skipButtonVisible = false; } diff --git a/client/src/main/java/agolf/lobby/LobbyDualPlayerPanel.java b/client/src/main/java/agolf/lobby/LobbyDualPlayerPanel.java index afb40cd4..b1c9539d 100644 --- a/client/src/main/java/agolf/lobby/LobbyDualPlayerPanel.java +++ b/client/src/main/java/agolf/lobby/LobbyDualPlayerPanel.java @@ -172,7 +172,7 @@ public void itemStateChanged(ItemEvent evt) { } this.gameContainer.lobbyPanel.writeData("nc\t" + (noChallenges ? 't' : 'f')); - this.gameContainer.lobbyPanel.getUser((String) null, noChallenges); + this.gameContainer.lobbyPanel.getUser(null, noChallenges); } } @@ -369,7 +369,7 @@ protected void allowChallenges() { } private void create() { - this.setLayout((LayoutManager) null); + this.setLayout(null); /*if(isUsingCustomServer) { choicerTrackCategory = this.gameContainer.lobbyPanel.addChoicerTrackCategory(this, this.width / 2 - 170, 81, 150, 20); }*/ diff --git a/client/src/main/java/agolf/lobby/LobbyGamePasswordPanel.java b/client/src/main/java/agolf/lobby/LobbyGamePasswordPanel.java index dea030e8..73919d74 100644 --- a/client/src/main/java/agolf/lobby/LobbyGamePasswordPanel.java +++ b/client/src/main/java/agolf/lobby/LobbyGamePasswordPanel.java @@ -74,7 +74,7 @@ public void actionPerformed(ActionEvent evt) { } if (evtSource == this.buttonCancel) { - this.lobbyMultiPlayerPanel.joinMultiPlayerGame(this.gameId, (String) null); + this.lobbyMultiPlayerPanel.joinMultiPlayerGame(this.gameId, null); } } @@ -102,7 +102,7 @@ private void joinGame() { if (!this.emptyField && password.length() != 0) { this.lobbyMultiPlayerPanel.joinMultiPlayerGame(this.gameId, password); } else { - this.lobbyMultiPlayerPanel.joinMultiPlayerGame(this.gameId, (String) null); + this.lobbyMultiPlayerPanel.joinMultiPlayerGame(this.gameId, null); } } } diff --git a/client/src/main/java/agolf/lobby/LobbyMultiPlayerPanel.java b/client/src/main/java/agolf/lobby/LobbyMultiPlayerPanel.java index d02ee505..acefd13f 100644 --- a/client/src/main/java/agolf/lobby/LobbyMultiPlayerPanel.java +++ b/client/src/main/java/agolf/lobby/LobbyMultiPlayerPanel.java @@ -262,7 +262,7 @@ protected boolean handlePacket(String[] args) { } protected void create() { - this.setLayout((LayoutManager) null); + this.setLayout(null); this.choicerNumPlayers = new Choicer(); for (int num = 2; num <= 4; ++num) { diff --git a/client/src/main/java/agolf/lobby/LobbyPanel.java b/client/src/main/java/agolf/lobby/LobbyPanel.java index c67ff597..037ffa22 100644 --- a/client/src/main/java/agolf/lobby/LobbyPanel.java +++ b/client/src/main/java/agolf/lobby/LobbyPanel.java @@ -344,7 +344,7 @@ protected Choicer addChoicerTrackCategory(Panel container, int x, int y, int wid } protected String getTime(int var1) { - return var1 == 0 ? this.gameContainer.textManager.getGame("LobbyReal_TimeLimitNo") : this.gameContainer.textManager.getTime((long) var1); + return var1 == 0 ? this.gameContainer.textManager.getGame("LobbyReal_TimeLimitNo") : this.gameContainer.textManager.getTime(var1); } protected void addMessage(String var1) { diff --git a/client/src/main/java/agolf/lobby/LobbySinglePlayerPanel.java b/client/src/main/java/agolf/lobby/LobbySinglePlayerPanel.java index 2b9bfde8..f548b50d 100644 --- a/client/src/main/java/agolf/lobby/LobbySinglePlayerPanel.java +++ b/client/src/main/java/agolf/lobby/LobbySinglePlayerPanel.java @@ -184,7 +184,7 @@ protected void requestTrackSetList() { } private void create() { - this.setLayout((LayoutManager) null); + this.setLayout(null); /*if(isUsingCustomServer) { this.choicerTrackCategory = this.gameContainer.lobbyPanel.addChoicerTrackCategory(this, this.width / 2 - 170, 175, 150, 20); }*/ diff --git a/client/src/main/java/com/aapeli/applet/AdCanvas.java b/client/src/main/java/com/aapeli/applet/AdCanvas.java index 7badd493..e313f392 100644 --- a/client/src/main/java/com/aapeli/applet/AdCanvas.java +++ b/client/src/main/java/com/aapeli/applet/AdCanvas.java @@ -54,7 +54,7 @@ public void update(Graphics var1) { } } - var1.drawImage(this.anImage122, 0, 0, (ImageObserver) null); + var1.drawImage(this.anImage122, 0, 0, null); int var5 = this.aVector118.size(); for (int var6 = 0; var6 < var5; ++var6) { @@ -134,12 +134,12 @@ protected boolean method213() { this.aBoolean125 = true; } - if (!this.aBoolean125 && !this.gameApplet.prepareImage(this.anImage122, (ImageObserver) null)) { + if (!this.aBoolean125 && !this.gameApplet.prepareImage(this.anImage122, null)) { return false; } else { if (!this.aBoolean125) { - int var1 = this.anImage122.getWidth((ImageObserver) null); - int var2 = this.anImage122.getHeight((ImageObserver) null); + int var1 = this.anImage122.getWidth(null); + int var2 = this.anImage122.getHeight(null); this.setSize(var1, var2); } else { this.setSize(20, 20); diff --git a/client/src/main/java/com/aapeli/bigtext/BigText.java b/client/src/main/java/com/aapeli/bigtext/BigText.java index 472fe843..b489b5bd 100644 --- a/client/src/main/java/com/aapeli/bigtext/BigText.java +++ b/client/src/main/java/com/aapeli/bigtext/BigText.java @@ -59,7 +59,7 @@ public BigText(String var1, Color var2) { } public BigText(String var1, Color var2, int var3) { - this(var1, var2, var3, anIntArray1317, anIntArray1318, 1, (Component) null); + this(var1, var2, var3, anIntArray1317, anIntArray1318, 1, null); } public BigText(String var1, Color var2, int var3, Component var4) { @@ -82,7 +82,7 @@ protected BigText(String var1, Color var2, int var3, int[] var4, int[] var5, int } public void setAlpha(int var1) { - this.method1558(var1, (Component) null); + this.method1558(var1, null); } public void drawText(Graphics var1, int var2, int var3, int var4, int var5) { diff --git a/client/src/main/java/com/aapeli/bigtext/MediumText.java b/client/src/main/java/com/aapeli/bigtext/MediumText.java index fe398e9b..23ba7683 100644 --- a/client/src/main/java/com/aapeli/bigtext/MediumText.java +++ b/client/src/main/java/com/aapeli/bigtext/MediumText.java @@ -39,14 +39,14 @@ public MediumText(String var1, Color var2) { } public MediumText(String var1, Color var2, int var3) { - super(var1, var2, var3, anIntArray3591, anIntArray3592, 2, (Component) null); + super(var1, var2, var3, anIntArray3591, anIntArray3592, 2, null); } private static int method1560(int[] var0, int var1, int var2) { - long var3 = (long) var0[var2 * 1432 + var1]; - long var5 = (long) var0[var2 * 1432 + var1 + 1]; - long var7 = (long) var0[(var2 + 1) * 1432 + var1]; - long var9 = (long) var0[(var2 + 1) * 1432 + var1 + 1]; + long var3 = var0[var2 * 1432 + var1]; + long var5 = var0[var2 * 1432 + var1 + 1]; + long var7 = var0[(var2 + 1) * 1432 + var1]; + long var9 = var0[(var2 + 1) * 1432 + var1 + 1]; long var11 = ((var3 & 4278190080L) >> 24) + ((var5 & 4278190080L) >> 24) + ((var7 & 4278190080L) >> 24) + ((var9 & 4278190080L) >> 24); long var13 = ((var3 & 16711680L) >> 16) + ((var5 & 16711680L) >> 16) + ((var7 & 16711680L) >> 16) + ((var9 & 16711680L) >> 16); long var15 = ((var3 & 65280L) >> 8) + ((var5 & 65280L) >> 8) + ((var7 & 65280L) >> 8) + ((var9 & 65280L) >> 8); diff --git a/client/src/main/java/com/aapeli/client/BadWordFilter.java b/client/src/main/java/com/aapeli/client/BadWordFilter.java index 444fc495..27625135 100644 --- a/client/src/main/java/com/aapeli/client/BadWordFilter.java +++ b/client/src/main/java/com/aapeli/client/BadWordFilter.java @@ -22,11 +22,11 @@ public final class BadWordFilter { public BadWordFilter(TextManager var1) { - this(var1, true, (String) null); + this(var1, true, null); } protected BadWordFilter(TextManager var1, boolean var2) { - this(var1, var2, (String) null); + this(var1, var2, null); } protected BadWordFilter(TextManager var1, boolean var2, String var3) { diff --git a/client/src/main/java/com/aapeli/client/Frame_Sub3.java b/client/src/main/java/com/aapeli/client/Frame_Sub3.java index 1cfcd013..c9e7a532 100644 --- a/client/src/main/java/com/aapeli/client/Frame_Sub3.java +++ b/client/src/main/java/com/aapeli/client/Frame_Sub3.java @@ -81,7 +81,7 @@ protected void method238(Component var1, String var2, Panel var3) { Dimension var7 = var1.getSize(); this.setLocation(var6.x + var7.width / 2 - this.anInt188 / 2, var6.y + var7.height / 2 - this.anInt189 / 2); this.setBackground(Panel_Sub24.aColor616); - this.setLayout((LayoutManager) null); + this.setLayout(null); var3.setLocation(var4.left, var4.top); this.add(var3); this.addWindowListener(this); diff --git a/client/src/main/java/com/aapeli/client/IPanel_Sub40.java b/client/src/main/java/com/aapeli/client/IPanel_Sub40.java index af803a60..a3a82ba8 100644 --- a/client/src/main/java/com/aapeli/client/IPanel_Sub40.java +++ b/client/src/main/java/com/aapeli/client/IPanel_Sub40.java @@ -80,7 +80,7 @@ protected String method820() { } private void method821() { - this.setLayout((LayoutManager) null); + this.setLayout(null); if (this.anInt3212 == 0) { this.aRoundButton3215 = new RoundButton(this.anAApplet3210.textManager.getShared("GameFin_W_CreateAccount")); this.aRoundButton3215.setBounds(210, 225, 220, 30); diff --git a/client/src/main/java/com/aapeli/client/ImageTracker.java b/client/src/main/java/com/aapeli/client/ImageTracker.java index eeb6c763..a4d566b3 100644 --- a/client/src/main/java/com/aapeli/client/ImageTracker.java +++ b/client/src/main/java/com/aapeli/client/ImageTracker.java @@ -142,7 +142,7 @@ protected void removeAllImageResources() { while (this.aThread1401 != null && var1 > 0) { var1 -= var2; - Tools.sleep((long) var2); + Tools.sleep(var2); } } @@ -263,7 +263,7 @@ private boolean method1645() { return true; } - Tools.sleep((long) var5); + Tools.sleep(var5); } if (this.anAApplet1400 != null) { diff --git a/client/src/main/java/com/aapeli/client/InputTextField.java b/client/src/main/java/com/aapeli/client/InputTextField.java index bc9d27ff..652fcaba 100644 --- a/client/src/main/java/com/aapeli/client/InputTextField.java +++ b/client/src/main/java/com/aapeli/client/InputTextField.java @@ -113,7 +113,7 @@ public void keyReleased(KeyEvent evt) { String var4; if (this.anInt727 < this.userInputzCount) { - var4 = (String) this.userInputz.elementAt(this.anInt727); + var4 = this.userInputz.elementAt(this.anInt727); } else { var4 = this.finalInput; } diff --git a/client/src/main/java/com/aapeli/client/Panel_Sub24.java b/client/src/main/java/com/aapeli/client/Panel_Sub24.java index c5dd97fb..2bef7f55 100644 --- a/client/src/main/java/com/aapeli/client/Panel_Sub24.java +++ b/client/src/main/java/com/aapeli/client/Panel_Sub24.java @@ -62,7 +62,7 @@ protected Panel_Sub24(TextManager var1, ImageManager var2, Class88 var3, Frame_S this.anInt638 = 0; this.aBoolean640 = false; this.anInt639 = 1; - this.method481((InputTextField) null); + this.method481(null); } public void addNotify() { @@ -241,7 +241,7 @@ public synchronized void focusLost(FocusEvent var1) { } private void method480() { - this.setLayout((LayoutManager) null); + this.setLayout(null); this.anInputTextFieldArray632 = new InputTextField[4]; int var1; @@ -317,7 +317,7 @@ private void method481(InputTextField var1) { private void method482(boolean var1) { ++this.anInt639; - this.method481((InputTextField) null); + this.method481(null); if (var1) { this.anInputTextFieldArray632[this.anInt639 - 1].requestFocus(); } diff --git a/client/src/main/java/com/aapeli/client/Parameters.java b/client/src/main/java/com/aapeli/client/Parameters.java index 7c1eb06a..3e8ce605 100644 --- a/client/src/main/java/com/aapeli/client/Parameters.java +++ b/client/src/main/java/com/aapeli/client/Parameters.java @@ -207,7 +207,7 @@ public boolean showPlayerCard(String var1) { } public void showPlayerList(String[] var1) { - this.showPlayerList(var1, (String) null); + this.showPlayerList(var1, null); } public void showPlayerList(String[] nicks, String var2) { diff --git a/client/src/main/java/com/aapeli/colorgui/Class91.java b/client/src/main/java/com/aapeli/colorgui/Class91.java index e5e6755b..f81ef0ab 100644 --- a/client/src/main/java/com/aapeli/colorgui/Class91.java +++ b/client/src/main/java/com/aapeli/colorgui/Class91.java @@ -88,14 +88,14 @@ private void method1743(Graphics var1, ColorList var2) { var1.fillRect(this.anInt1536, this.anInt1537, this.anInt1538, this.anInt1539); } - this.method1744(var1, var2, this.anImage1547, this.aColor1545, this.aFont1542, this.aString1546, (Image) null); + this.method1744(var1, var2, this.anImage1547, this.aColor1545, this.aFont1542, this.aString1546, null); } private void method1744(Graphics var1, ColorList var2, Image var3, Color var4, Font var5, String var6, Image var7) { int var8 = 4; if (var3 != null) { var1.drawImage(var3, var8, this.anInt1537 + this.anInt1539 / 2 - var3.getHeight(var2) / 2, var2); - int var9 = this.anInt1540 > 0 ? this.anInt1540 : var3.getWidth((ImageObserver) null); + int var9 = this.anInt1540 > 0 ? this.anInt1540 : var3.getWidth(null); var8 += var9 + 3; } diff --git a/client/src/main/java/com/aapeli/colorgui/Class92.java b/client/src/main/java/com/aapeli/colorgui/Class92.java index 954fcb68..5d77a236 100644 --- a/client/src/main/java/com/aapeli/colorgui/Class92.java +++ b/client/src/main/java/com/aapeli/colorgui/Class92.java @@ -22,7 +22,7 @@ protected Class92(ColorSpinner var1, ColorSpinner var2, int var3) { } public void run() { - Tools.sleep((long) this.anInt1550); + Tools.sleep(this.anInt1550); if (this.aBoolean1551) { this.aColorSpinner1549.method846(); } diff --git a/client/src/main/java/com/aapeli/colorgui/ColorButton.java b/client/src/main/java/com/aapeli/colorgui/ColorButton.java index 900d308f..3203631e 100644 --- a/client/src/main/java/com/aapeli/colorgui/ColorButton.java +++ b/client/src/main/java/com/aapeli/colorgui/ColorButton.java @@ -60,7 +60,7 @@ public class ColorButton extends IPanel implements MouseMotionListener, MouseLis public static boolean aBoolean3287; public ColorButton() { - this((String) null); + this(null); } public ColorButton(String var1) { @@ -69,7 +69,7 @@ public ColorButton(String var1) { this.setFont(Class94.aFont1575); this.setLabel(var1); this.setSecondaryFont(new Font("Dialog", 0, 11)); - this.setSecondaryLabel((String) null); + this.setSecondaryLabel(null); this.aBoolean3276 = true; this.aBoolean3277 = this.aBoolean3278 = false; this.anInt3279 = 1; @@ -282,9 +282,9 @@ public void setForegroundImage(Image var1, Image var2, int var3, int var4) { public void setIconImage(Image var1) { if (var1 != null) { - this.setIconImage(var1, var1.getWidth((ImageObserver) null), var1.getHeight((ImageObserver) null)); + this.setIconImage(var1, var1.getWidth(null), var1.getHeight(null)); } else { - this.setIconImage((Image) null, -1, -1); + this.setIconImage(null, -1, -1); } } @@ -341,7 +341,7 @@ public void setBorderColor(Color var1) { public void click() { this.aBoolean3278 = true; - this.mouseReleased((MouseEvent) null); + this.mouseReleased(null); } public Dimension getPreferredSize() { diff --git a/client/src/main/java/com/aapeli/colorgui/ColorCheckbox.java b/client/src/main/java/com/aapeli/colorgui/ColorCheckbox.java index 5a94206a..8e8e6313 100644 --- a/client/src/main/java/com/aapeli/colorgui/ColorCheckbox.java +++ b/client/src/main/java/com/aapeli/colorgui/ColorCheckbox.java @@ -44,11 +44,11 @@ public class ColorCheckbox extends IPanel implements ItemSelectable, MouseListen public ColorCheckbox() { - this((String) null, false); + this(null, false); } public ColorCheckbox(boolean var1) { - this((String) null, var1); + this(null, var1); } public ColorCheckbox(String var1) { @@ -249,7 +249,7 @@ public boolean getState() { } public void click() { - this.mouseReleased((MouseEvent) null); + this.mouseReleased(null); } public Dimension getPreferredSize() { diff --git a/client/src/main/java/com/aapeli/colorgui/ColorList.java b/client/src/main/java/com/aapeli/colorgui/ColorList.java index ea89a931..a24c59aa 100644 --- a/client/src/main/java/com/aapeli/colorgui/ColorList.java +++ b/client/src/main/java/com/aapeli/colorgui/ColorList.java @@ -99,7 +99,7 @@ public ColorList(int var1, int var2, Font var3, int var4, int var5) { this.anInt671 = this.anInt672 = this.anInt678 = this.anInt679 = -1; this.anInt673 = -1; this.anInt675 = 0; - this.setLayout((LayoutManager) null); + this.setLayout(null); this.aScrollbar653 = new Scrollbar(1); this.aScrollbar653.setBounds(var1 - 16 - 1, 1, 16, var2 - 2); this.aScrollbar653.setBlockIncrement(this.anInt664 - 1); @@ -140,7 +140,7 @@ public void update(Graphics var1) { int var6 = 0; Class91 var2; if (this.aString667 != null) { - var2 = new Class91(1, var6, this.anInt661 - 2, this.anInt663, this.anInt660, this.anImage655 != null, this.aFont659, this.aColor668, this.aString667, (Image) null); + var2 = new Class91(1, var6, this.anInt661 - 2, this.anInt663, this.anInt660, this.anImage655 != null, this.aFont659, this.aColor668, this.aString667, null); this.aVector670.addElement(var2); var2.method1739(this.aGraphics677, this); var6 += this.anInt663; @@ -521,7 +521,7 @@ private ColorListItem method946(int var1) { return null; } else { for (int var4 = 0; var4 < var2; ++var4) { - Class91 var3 = (Class91) ((Class91) this.aVector670.elementAt(var4)); + Class91 var3 = this.aVector670.elementAt(var4); if (var3.method1740(var1)) { return var3.method1741(); } diff --git a/client/src/main/java/com/aapeli/colorgui/ColorListItem.java b/client/src/main/java/com/aapeli/colorgui/ColorListItem.java index 8685fd3a..4e78bd14 100644 --- a/client/src/main/java/com/aapeli/colorgui/ColorListItem.java +++ b/client/src/main/java/com/aapeli/colorgui/ColorListItem.java @@ -32,15 +32,15 @@ public class ColorListItem { public ColorListItem(String var1) { - this((Image) null, 0, false, var1, (Object) null, false); + this(null, 0, false, var1, null, false); } public ColorListItem(int var1, boolean var2, String var3) { - this((Image) null, var1, var2, var3, (Object) null, false); + this(null, var1, var2, var3, null, false); } public ColorListItem(int var1, boolean var2, String var3, Object var4, boolean var5) { - this((Image) null, aColorArray1554[var1], var2, var3, var4, var5); + this(null, aColorArray1554[var1], var2, var3, var4, var5); } public ColorListItem(Image var1, int var2, boolean var3, String var4, Object var5, boolean var6) { diff --git a/client/src/main/java/com/aapeli/colorgui/ColorTextArea.java b/client/src/main/java/com/aapeli/colorgui/ColorTextArea.java index 6f03fe46..be06d6ce 100644 --- a/client/src/main/java/com/aapeli/colorgui/ColorTextArea.java +++ b/client/src/main/java/com/aapeli/colorgui/ColorTextArea.java @@ -62,7 +62,7 @@ public class ColorTextArea extends IPanel implements ComponentListener, Adjustme private Object anObject3352; public ColorTextArea(int var1, int var2) { - this(var1, var2, (Font) null); + this(var1, var2, null); } public ColorTextArea(int var1, int var2, Font var3) { @@ -85,7 +85,7 @@ public ColorTextArea(int var1, int var2, Font var3) { this.method849(); this.anInt3351 = 1; this.addComponentListener(this); - this.setLayout((LayoutManager) null); + this.setLayout(null); this.aScrollbar3331 = new Scrollbar(1); this.method850(); this.aScrollbar3331.setUnitIncrement(1); @@ -184,7 +184,7 @@ public void clear() { } public void addLine() { - this.addLine((Color) null, (String) null, false); + this.addLine(null, null, false); } public void addLine(int var1, String var2) { diff --git a/client/src/main/java/com/aapeli/colorgui/MultiColorList.java b/client/src/main/java/com/aapeli/colorgui/MultiColorList.java index 677e0b22..97c5d2c3 100644 --- a/client/src/main/java/com/aapeli/colorgui/MultiColorList.java +++ b/client/src/main/java/com/aapeli/colorgui/MultiColorList.java @@ -89,7 +89,7 @@ public MultiColorList(String[] var1, int[] var2, int var3, int var4, int var5) { this.anInt707 = this.anInt708 = -1; this.anInt709 = -1; this.aColor691 = aColor682; - this.setLayout((LayoutManager) null); + this.setLayout(null); this.aScrollbar686 = new Scrollbar(1); this.aScrollbar686.setBounds(var4 - 16 - 1, 1, 16, var5 - 2); this.aScrollbar686.setBlockIncrement(this.anInt703 - 1); @@ -186,7 +186,7 @@ public synchronized void update(Graphics var1) { for (int var14 = 0; var14 < this.anInt698; ++var14) { if (var9[var13][var14] != null) { - this.aGraphics712.drawImage(var9[var13][var14], 3 + this.anIntArray704[var14] + 1, var15 - var3 + (8 - var9[var13][var14].getHeight((ImageObserver) null) / 2) + 1, this); + this.aGraphics712.drawImage(var9[var13][var14], 3 + this.anIntArray704[var14] + 1, var15 - var3 + (8 - var9[var13][var14].getHeight(null) / 2) + 1, this); } else if (var8[var13][var14] != null) { this.aGraphics712.drawString(var8[var13][var14], 3 + this.anIntArray704[var14], var15); } diff --git a/client/src/main/java/com/aapeli/colorgui/MultiColorListItem.java b/client/src/main/java/com/aapeli/colorgui/MultiColorListItem.java index 1ba3ee09..2f43249a 100644 --- a/client/src/main/java/com/aapeli/colorgui/MultiColorListItem.java +++ b/client/src/main/java/com/aapeli/colorgui/MultiColorListItem.java @@ -30,11 +30,11 @@ public class MultiColorListItem { public MultiColorListItem(String[] strings) { - this(colours[0], false, strings, (Object) null, false); + this(colours[0], false, strings, null, false); } public MultiColorListItem(int colourIndex, boolean bold, String[] strings) { - this(colours[colourIndex], bold, strings, (Object) null, false); + this(colours[colourIndex], bold, strings, null, false); } public MultiColorListItem(int colourIndex, String[] strings, Object data) { diff --git a/client/src/main/java/com/aapeli/colorgui/RadioButton.java b/client/src/main/java/com/aapeli/colorgui/RadioButton.java index 2e3da977..71b6eff2 100644 --- a/client/src/main/java/com/aapeli/colorgui/RadioButton.java +++ b/client/src/main/java/com/aapeli/colorgui/RadioButton.java @@ -16,15 +16,15 @@ public class RadioButton extends ColorButton { public RadioButton() { - this((String) null, (RadioButtonGroup) null); + this(null, null); } public RadioButton(RadioButtonGroup var1) { - this((String) null, var1); + this(null, var1); } public RadioButton(String var1) { - this(var1, (RadioButtonGroup) null); + this(var1, null); } public RadioButton(String var1, RadioButtonGroup var2) { @@ -75,7 +75,7 @@ public boolean getState() { } public void click() { - this.mousePressed((MouseEvent) null); + this.mousePressed(null); } public void boldSelected(boolean var1) { diff --git a/client/src/main/java/com/aapeli/colorgui/RoundButton.java b/client/src/main/java/com/aapeli/colorgui/RoundButton.java index e27db60c..02e95337 100644 --- a/client/src/main/java/com/aapeli/colorgui/RoundButton.java +++ b/client/src/main/java/com/aapeli/colorgui/RoundButton.java @@ -45,15 +45,15 @@ public class RoundButton extends IPanel implements MouseMotionListener, MouseLis public RoundButton() { - this((String) null, (Image) null, (Image) null); + this(null, null, null); } public RoundButton(String var1) { - this(var1, (Image) null, (Image) null); + this(var1, null, null); } public RoundButton(String var1, Image var2) { - this(var1, var2, (Image) null); + this(var1, var2, null); } public RoundButton(String var1, Image var2, Image var3) { @@ -63,7 +63,7 @@ public RoundButton(String var1, Image var2, Image var3) { this.setFont(aFont3382); this.setLabel(var1); this.setSecondaryFont(aFont3382); - this.setSecondaryLabel((String) null); + this.setSecondaryLabel(null); this.anImage3391 = var2; this.anImage3392 = var3; this.aBoolean3393 = this.aBoolean3394 = false; @@ -214,7 +214,7 @@ public void setBorderColor(Color var1) { } public Dimension getPreferredSize() { - return this.anImage3391 == null ? new Dimension(13 + this.getFontMetrics(this.aFont3388).stringWidth(this.aString3387) + 13, 5 + this.aFont3388.getSize() + 5) : new Dimension(this.anImage3391.getWidth((ImageObserver) null), this.anImage3391.getHeight((ImageObserver) null)); + return this.anImage3391 == null ? new Dimension(13 + this.getFontMetrics(this.aFont3388).stringWidth(this.aString3387) + 13, 5 + this.aFont3388.getSize() + 5) : new Dimension(this.anImage3391.getWidth(null), this.anImage3391.getHeight(null)); } public void addActionListener(ActionListener var1) { @@ -287,8 +287,8 @@ public boolean isHighlighted() { } private void method871(Graphics var1, Color var2, int var3, int var4, boolean var5) { - int var6 = (int) (Math.sqrt((double) var4) + 1.8D); - double var7 = Math.sqrt(Math.sqrt((double) var4)) - 0.34D; + int var6 = (int) (Math.sqrt(var4) + 1.8D); + double var7 = Math.sqrt(Math.sqrt(var4)) - 0.34D; Color var9 = this.getParent().getBackground(); Color var10 = this.aColor3386; if (!var5) { @@ -316,8 +316,8 @@ private void method871(Graphics var1, Color var2, int var3, int var4, boolean va var14 = var3 - var6 - 1; } - double var16 = (double) (var13 - var14); - double var18 = (double) (var12 - var15); + double var16 = var13 - var14; + double var18 = var12 - var15; double var20 = Math.sqrt(var16 * var16 + var18 * var18); if (var20 <= (double) var6 + 1.0D && var20 <= (double) var6) { if (var20 > (double) var6 - var7) { diff --git a/client/src/main/java/com/aapeli/colorgui/RoundRadioButton.java b/client/src/main/java/com/aapeli/colorgui/RoundRadioButton.java index 11746679..fdd98753 100644 --- a/client/src/main/java/com/aapeli/colorgui/RoundRadioButton.java +++ b/client/src/main/java/com/aapeli/colorgui/RoundRadioButton.java @@ -14,15 +14,15 @@ public class RoundRadioButton extends RoundButton { public RoundRadioButton() { - this((String) null, (RadioButtonGroup) null); + this(null, null); } public RoundRadioButton(RadioButtonGroup var1) { - this((String) null, var1); + this(null, var1); } public RoundRadioButton(String var1) { - this(var1, (RadioButtonGroup) null); + this(var1, null); } public RoundRadioButton(String var1, RadioButtonGroup var2) { @@ -62,7 +62,7 @@ public boolean getState() { } public void click() { - this.mousePressed((MouseEvent) null); + this.mousePressed(null); } public void boldSelected(boolean var1) { diff --git a/client/src/main/java/com/aapeli/colorgui/TabBar.java b/client/src/main/java/com/aapeli/colorgui/TabBar.java index acf4c494..e631ac2f 100644 --- a/client/src/main/java/com/aapeli/colorgui/TabBar.java +++ b/client/src/main/java/com/aapeli/colorgui/TabBar.java @@ -64,7 +64,7 @@ public TabBar(int var1, int var2) { this.anInt3421 = -1; this.addComponentListener(this); this.aVector3424 = new Vector<>(); - this.setLayout((LayoutManager) null); + this.setLayout(null); this.anInt3423 = 0; } diff --git a/client/src/main/java/com/aapeli/colorgui/TabBarItem.java b/client/src/main/java/com/aapeli/colorgui/TabBarItem.java index e0d92058..c2a6c964 100644 --- a/client/src/main/java/com/aapeli/colorgui/TabBarItem.java +++ b/client/src/main/java/com/aapeli/colorgui/TabBarItem.java @@ -15,7 +15,7 @@ public final class TabBarItem { public TabBarItem(TabBar var1, String var2, Component var3) { - this(var1, (Image) null, var2, var3); + this(var1, null, var2, var3); } public TabBarItem(TabBar var1, Image var2, String var3, Component var4) { diff --git a/client/src/main/java/com/aapeli/connection/ConnCipher.java b/client/src/main/java/com/aapeli/connection/ConnCipher.java index 9228d194..db3fb7ab 100644 --- a/client/src/main/java/com/aapeli/connection/ConnCipher.java +++ b/client/src/main/java/com/aapeli/connection/ConnCipher.java @@ -32,7 +32,7 @@ public void initialise(int newSeed) { this.randomsOther[1][i - 128] = -1; } - ConnRandom random = new ConnRandom((long) newSeed); + ConnRandom random = new ConnRandom(newSeed); int rand; for (int index = 1; index <= 125;) { diff --git a/client/src/main/java/com/aapeli/connection/GameQueue.java b/client/src/main/java/com/aapeli/connection/GameQueue.java index 0f136e65..1ead05eb 100644 --- a/client/src/main/java/com/aapeli/connection/GameQueue.java +++ b/client/src/main/java/com/aapeli/connection/GameQueue.java @@ -18,7 +18,7 @@ protected GameQueue() { protected void add(String var1) { long var2; synchronized (this) { - var2 = (long) (this.sendSeqNum++); + var2 = this.sendSeqNum++; } var1 = this.connCipher.encrypt(var2 + " " + var1); diff --git a/client/src/main/java/com/aapeli/multiuser/ChatBase.java b/client/src/main/java/com/aapeli/multiuser/ChatBase.java index 6b1544d6..7eb80bfd 100644 --- a/client/src/main/java/com/aapeli/multiuser/ChatBase.java +++ b/client/src/main/java/com/aapeli/multiuser/ChatBase.java @@ -432,7 +432,7 @@ public UserListItem addToUserListNew(String var1, boolean var2) { } public RoundButton copyColorButtonToRoundButton(Component var1) { - ColorButton var2 = (ColorButton) ((ColorButton) var1); + ColorButton var2 = (ColorButton) var1; var2.removeActionListener(this); this.remove(var2); RoundButton var3 = new RoundButton(var2.getLabel()); @@ -587,7 +587,7 @@ private void sendMessage() { var6 = this.gui_globaloutput.method914(); for (int var7 = 0; var7 < var4.length; ++var7) { - ((GlobalChatListener) ((GlobalChatListener) var4[var7])).localUserSay(var6, message); + ((GlobalChatListener) var4[var7]).localUserSay(var6, message); } } } diff --git a/client/src/main/java/com/aapeli/multiuser/ChatLobby.java b/client/src/main/java/com/aapeli/multiuser/ChatLobby.java index 5df9d9e1..41d17e3c 100644 --- a/client/src/main/java/com/aapeli/multiuser/ChatLobby.java +++ b/client/src/main/java/com/aapeli/multiuser/ChatLobby.java @@ -145,7 +145,7 @@ public void usersLeftStartedGame(String var1, String var2, String var3) { } public void usersLeftStartedGame(String var1, String var2) { - this.usersLeftStartedGame(var1, var2, (String) null); + this.usersLeftStartedGame(var1, var2, null); } public UserListItem getSelectedUserForChallenge() { diff --git a/client/src/main/java/com/aapeli/multiuser/ChatTextArea.java b/client/src/main/java/com/aapeli/multiuser/ChatTextArea.java index 1df000ba..449fa0ed 100644 --- a/client/src/main/java/com/aapeli/multiuser/ChatTextArea.java +++ b/client/src/main/java/com/aapeli/multiuser/ChatTextArea.java @@ -16,15 +16,15 @@ public class ChatTextArea extends ColorTextArea { private Hashtable aHashtable4730; public ChatTextArea(TextManager var1, int var2, int var3) { - this(var1, (BadWordFilter) null, var2, var3, (Font) null); + this(var1, null, var2, var3, null); } public ChatTextArea(TextManager var1, int var2, int var3, Font var4) { - this(var1, (BadWordFilter) null, var2, var3, var4); + this(var1, null, var2, var3, var4); } public ChatTextArea(TextManager var1, BadWordFilter var2, int var3, int var4) { - this(var1, var2, var3, var4, (Font) null); + this(var1, var2, var3, var4, null); } public ChatTextArea(TextManager var1, BadWordFilter var2, int var3, int var4, Font var5) { diff --git a/client/src/main/java/com/aapeli/multiuser/GlobalTextArea.java b/client/src/main/java/com/aapeli/multiuser/GlobalTextArea.java index b6e3a21c..09e5bb8b 100644 --- a/client/src/main/java/com/aapeli/multiuser/GlobalTextArea.java +++ b/client/src/main/java/com/aapeli/multiuser/GlobalTextArea.java @@ -31,7 +31,7 @@ protected GlobalTextArea(ChatBase var1, ChatTextArea var2, int var3) { this.anInt2363 = var4.width; this.anInt2364 = var4.height; this.setSize(this.anInt2363, this.anInt2364); - this.setLayout((LayoutManager) null); + this.setLayout(null); var2.setLocation(0, 0); this.add(var2); this.aChatTextArea2365 = var2; @@ -65,7 +65,7 @@ public void componentResized(ComponentEvent var1) { public void selectedTabChanged(int var1) { TabBarItem var2 = this.aTabBar2367.getTabBarItemByIndex(var1); - ChatTextArea var3 = (ChatTextArea) ((ChatTextArea) var2.getComponent()); + ChatTextArea var3 = (ChatTextArea) var2.getComponent(); this.aChatBase2361.setCurrentOutput(var3); } @@ -163,9 +163,9 @@ private ChatTextArea method922(int var1) { TabBarItem var3 = this.aTabBar2367.getTabBarItemByID(var1); if (var3 != null) { - return (ChatTextArea) ((ChatTextArea) var3.getComponent()); + return (ChatTextArea) var3.getComponent(); } else { - ChatTextArea var4 = (ChatTextArea) ((ChatTextArea) this.aTabBar2367.getTabBarItemByIndex(0).getComponent()); + ChatTextArea var4 = (ChatTextArea) this.aTabBar2367.getTabBarItemByIndex(0).getComponent(); var4 = new ChatTextArea(var4.getTextManager(), var4.getBadWordFilter(), this.anInt2363, this.anInt2364 - 15, var4.getFont()); var4.setLocation(0, 15); this.method923(var1, var4); @@ -193,7 +193,7 @@ private ChatTextArea[] method924() { ChatTextArea[] var4 = new ChatTextArea[var3]; for (int var5 = 0; var5 < var3; ++var5) { - var4[var5] = (ChatTextArea) ((ChatTextArea) var2[var5].getComponent()); + var4[var5] = (ChatTextArea) var2[var5].getComponent(); } return var4; diff --git a/client/src/main/java/com/aapeli/multiuser/StaffActionFrame.java b/client/src/main/java/com/aapeli/multiuser/StaffActionFrame.java index 1edaedc2..e304b694 100644 --- a/client/src/main/java/com/aapeli/multiuser/StaffActionFrame.java +++ b/client/src/main/java/com/aapeli/multiuser/StaffActionFrame.java @@ -193,7 +193,7 @@ protected void method251(Component var1, boolean var2) { Dimension var5 = var1.getSize(); this.setLocation(var4.x + var5.width / 2 - this.width / 2, var4.y + var5.height / 2 - this.height / 2); this.method252(this, true); - this.setLayout((LayoutManager) null); + this.setLayout(null); String var6 = null; Label var7 = new Label("Target user:"); var7.setBounds(this.insets.left + 10, this.insets.top + 10, 80, 25); diff --git a/client/src/main/java/com/aapeli/multiuser/UserList.java b/client/src/main/java/com/aapeli/multiuser/UserList.java index 41a6cb9a..fb2569c3 100644 --- a/client/src/main/java/com/aapeli/multiuser/UserList.java +++ b/client/src/main/java/com/aapeli/multiuser/UserList.java @@ -200,10 +200,10 @@ public void itemStateChanged(ItemEvent var1) { return; } - var3 = (ColorListItem) ((ColorListItem) var1.getItem()); + var3 = (ColorListItem) var1.getItem(); } - UserListItem var8 = (UserListItem) ((UserListItem) var3.getData()); + UserListItem var8 = (UserListItem) var3.getData(); if (var2 == this.aColorList3465) { int var6 = var1.getID(); if (var6 == 2) { @@ -269,16 +269,16 @@ public void actionPerformed(ActionEvent var1) { this.method929(2, this.anUserListItem3495.getNick()); } else if (var2 != this.aMenuItem3485 && var2 != this.aMenuItem3486 && var2 != this.aMenuItem3487 && var2 != this.aMenuItem3488 && var2 != this.aMenuItem3489) { if (var2 == this.aMenuItem3490) { - this.method929(4, (String) null); + this.method929(4, null); } else if (var2 == this.aMenuItem3491) { CopyChatFrame var4 = new CopyChatFrame(); - var4.create(this.imageManager.getApplet(), (ColorTextArea) (this.aChatBase3502 != null ? this.aChatBase3502.chatTextArea : this.aColorTextArea3501)); + var4.create(this.imageManager.getApplet(), this.aChatBase3502 != null ? this.aChatBase3502.chatTextArea : this.aColorTextArea3501); } else if (var2 == this.aMenuItem3492) { this.anUserListHandler3458.adminCommand("info", this.anUserListItem3495.getNick()); } else if (var2 == this.aMenuItem3493) { this.anUserListHandler3458.adminCommand("unmute", this.anUserListItem3495.getNick()); } else if (var2 == this.aMenuItem3494) { - this.method929(5, (String) null); + this.method929(5, null); } } else { short var3 = 0; @@ -370,7 +370,7 @@ public void setForeground(Color var1) { } public void setBackgroundImage(Image var1, int var2, int var3) { - this.setBackgroundImage(var1, (Image) null, var2, var3); + this.setBackgroundImage(var1, null, var2, var3); } public void setBackgroundImage(Image var1, Image var2, int var3, int var4) { @@ -496,7 +496,7 @@ public void addUser(UserListItem var1) { public UserListItem getSelectedUser() { ColorListItem var1 = this.aColorList3465.getSelectedItem(); - return var1 == null ? null : (UserListItem) ((UserListItem) var1.getData()); + return var1 == null ? null : (UserListItem) var1.getData(); } public UserListItem getUser(String var1) { @@ -505,7 +505,7 @@ public UserListItem getUser(String var1) { int var3 = var2.length; if (var3 > 0) { for (int var5 = 0; var5 < var3; ++var5) { - UserListItem var4 = (UserListItem) ((UserListItem) var2[var5].getData()); + UserListItem var4 = (UserListItem) var2[var5].getData(); if (var4.getNick().equals(var1)) { return var4; } @@ -526,7 +526,7 @@ public UserListItem getLocalUser() { int var2 = var1.length; if (var2 > 0) { for (int var4 = 0; var4 < var2; ++var4) { - UserListItem var3 = (UserListItem) ((UserListItem) var1[var4].getData()); + UserListItem var3 = (UserListItem) var1[var4].getData(); if (var3.isLocal()) { return var3; } @@ -543,7 +543,7 @@ public void removeUser(String var1) { int var3 = var2.length; if (var3 > 0) { for (int var5 = 0; var5 < var3; ++var5) { - UserListItem var4 = (UserListItem) ((UserListItem) var2[var5].getData()); + UserListItem var4 = (UserListItem) var2[var5].getData(); if (var4.getNick().equals(var1)) { this.aColorList3465.removeItem(var2[var5]); if (var2[var5].isSelected()) { @@ -565,7 +565,7 @@ public UserListItem removeUserNew(String var1) { int var3 = var2.length; if (var3 > 0) { for (int var5 = 0; var5 < var3; ++var5) { - UserListItem var4 = (UserListItem) ((UserListItem) var2[var5].getData()); + UserListItem var4 = (UserListItem) var2[var5].getData(); if (var4.getNick().equals(var1)) { this.aColorList3465.removeItem(var2[var5]); if (var2[var5].isSelected()) { @@ -588,7 +588,7 @@ public void removeAllUsers() { int var2 = var1.length; for (int var3 = 0; var3 < var2; ++var3) { - this.method934((UserListItem) ((UserListItem) var1[var3].getData())); + this.method934((UserListItem) var1[var3].getData()); } } @@ -732,7 +732,7 @@ private MenuItem method928(Menu var1, String var2, boolean var3) { private void method929(int var1, String var2) { if (this.aStaffActionFrame__3496 != null) { - this.aStaffActionFrame__3496.windowClosing((WindowEvent) null); + this.aStaffActionFrame__3496.windowClosing(null); } this.aStaffActionFrame__3496 = new StaffActionFrame(this.textManager, this.anUserListHandler3458, var1, var2); diff --git a/client/src/main/java/com/aapeli/tools/QuickTimer.java b/client/src/main/java/com/aapeli/tools/QuickTimer.java index e78b5d34..ffeef8e5 100644 --- a/client/src/main/java/com/aapeli/tools/QuickTimer.java +++ b/client/src/main/java/com/aapeli/tools/QuickTimer.java @@ -13,7 +13,7 @@ public class QuickTimer implements Runnable { public QuickTimer(int var1) { - this(var1, (QuickTimerListener) null, false); + this(var1, null, false); } public QuickTimer(int var1, QuickTimerListener var2) { @@ -39,7 +39,7 @@ public QuickTimer(QuickTimerListener var1, int var2) { } public void run() { - Tools.sleep((long) this.anInt1727); + Tools.sleep(this.anInt1727); if (!this.stopped) { Enumeration var1 = this.aVector1728.elements(); diff --git a/client/src/main/java/com/aapeli/tools/XmlUnit.java b/client/src/main/java/com/aapeli/tools/XmlUnit.java index 25d4db48..bcf0ab4f 100644 --- a/client/src/main/java/com/aapeli/tools/XmlUnit.java +++ b/client/src/main/java/com/aapeli/tools/XmlUnit.java @@ -218,7 +218,7 @@ private static XmlUnit method1876(String var0, boolean var1) throws Exception { if (var2.empty()) { var7 = 5; } else { - XmlUnit var6 = (XmlUnit) ((XmlUnit) var2.pop()); + XmlUnit var6 = var2.pop(); var6.addChild(tagStart); tagStart = var6; var7 = 2; diff --git a/client/src/main/java/org/moparforia/client/trackdump/Class98.java b/client/src/main/java/org/moparforia/client/trackdump/Class98.java index 26a3311c..d8a1a3cc 100644 --- a/client/src/main/java/org/moparforia/client/trackdump/Class98.java +++ b/client/src/main/java/org/moparforia/client/trackdump/Class98.java @@ -18,7 +18,7 @@ protected Class98() { protected void method1772(String var1) { long var2; synchronized (this) { - var2 = (long) (this.aLong1607++); + var2 = this.aLong1607++; } var1 = this.aConnCrypto_1606.encrypt(var2 + " " + var1); diff --git a/client/src/main/java/org/moparforia/client/trackdump/ConnCrypto.java b/client/src/main/java/org/moparforia/client/trackdump/ConnCrypto.java index ece428b4..ea49134c 100644 --- a/client/src/main/java/org/moparforia/client/trackdump/ConnCrypto.java +++ b/client/src/main/java/org/moparforia/client/trackdump/ConnCrypto.java @@ -34,7 +34,7 @@ public void setKey(int newKey) { this.anIntArrayArray1603[1][var2 - 128] = -1; } - Class100 var5 = new Class100((long) newKey); + Class100 var5 = new Class100(newKey); int var3; int var4; From 2a2a58ff9f62d7b21cc6f60a8f70b38366f63ca7 Mon Sep 17 00:00:00 2001 From: Sten Laane <21343173+StenAL@users.noreply.github.com> Date: Tue, 28 May 2024 12:30:44 +0300 Subject: [PATCH 4/6] Client: Automated code-quality improvements by IntelliJ IntelliJ was complaining about many warnings and offered automatic fixes for them so this commit applies the following changes: - use String.repeat() instead of for-loop for string building (available since Java 11) - use enchanced for loop (i.e. `for (Class item: collection)`) where possible (available since Java 5) - remove unnecessary unboxing of wrapped types, i.e. calls to .intValue() (available since Java 5) - use diamond shorthand (<>) in generics where available (available since Java 7) - replace C-style array declarations with Java style declarations - remove unnecessary character escapes - replace manual min/max calculations with Math.min/max calls - remove redundant array initializations - convert some Javadoc comments to normal multiline comments, remove other useless ones - remove some unused imports - remove redundant "throws" clauses - remove redundant semicolons from empty catch blocks - remove unnecessary toString calls - use magic constants (e.g. Font.PLAIN) instead of integers where possible --- client/src/main/java/agolf/Conn.java | 3 +- client/src/main/java/agolf/GameApplet.java | 16 ++++----- client/src/main/java/agolf/SpriteManager.java | 2 +- .../src/main/java/agolf/game/ChatPanel.java | 4 +-- .../main/java/agolf/game/ConfirmButton.java | 2 +- .../java/agolf/game/GameBackgroundCanvas.java | 9 ++--- .../src/main/java/agolf/game/GameCanvas.java | 2 +- .../java/agolf/game/GameControlPanel.java | 1 - .../src/main/java/agolf/game/HackedShot.java | 4 +-- .../main/java/agolf/game/TrackInfoPanel.java | 9 +++-- .../main/java/agolf/lobby/LobbyChatPanel.java | 4 +-- .../agolf/lobby/LobbyDualPlayerPanel.java | 1 - .../agolf/lobby/LobbyMultiPlayerPanel.java | 9 ++--- .../src/main/java/agolf/lobby/LobbyPanel.java | 1 - .../agolf/lobby/LobbySinglePlayerPanel.java | 1 - .../main/java/com/aapeli/applet/AApplet.java | 15 +++----- .../main/java/com/aapeli/applet/AdCanvas.java | 5 ++- .../java/com/aapeli/applet/LoadingPanel.java | 7 ++-- .../main/java/com/aapeli/bigtext/BigText.java | 8 ++--- .../java/com/aapeli/bigtext/MediumText.java | 1 - .../java/com/aapeli/client/BadWordFilter.java | 28 +++++++-------- .../main/java/com/aapeli/client/Class78.java | 1 - .../main/java/com/aapeli/client/Class79.java | 2 +- .../main/java/com/aapeli/client/Class80.java | 2 +- .../main/java/com/aapeli/client/Class81.java | 10 +++--- .../main/java/com/aapeli/client/Class88.java | 24 +++++-------- .../java/com/aapeli/client/Frame_Sub3.java | 1 - .../main/java/com/aapeli/client/IPanel.java | 4 +-- .../java/com/aapeli/client/IPanel_Sub40.java | 3 +- .../java/com/aapeli/client/ImageManager.java | 2 -- .../java/com/aapeli/client/ImageTracker.java | 4 +-- .../com/aapeli/client/InputTextField.java | 2 +- .../java/com/aapeli/client/Panel_Sub24.java | 11 +++--- .../java/com/aapeli/client/Parameters.java | 12 +------ .../java/com/aapeli/client/TextManager.java | 3 -- .../main/java/com/aapeli/client/UrlLabel.java | 1 - .../java/com/aapeli/colorgui/Class91.java | 1 - .../java/com/aapeli/colorgui/Class94.java | 2 +- .../java/com/aapeli/colorgui/ColorButton.java | 5 ++- .../java/com/aapeli/colorgui/ColorList.java | 5 ++- .../com/aapeli/colorgui/ColorSpinner.java | 4 +-- .../com/aapeli/colorgui/ColorTextArea.java | 8 ++--- .../com/aapeli/colorgui/MultiColorList.java | 4 +-- .../java/com/aapeli/colorgui/RadioButton.java | 5 +-- .../java/com/aapeli/colorgui/RoundButton.java | 2 +- .../main/java/com/aapeli/colorgui/TabBar.java | 1 - .../com/aapeli/connection/Connection.java | 9 ++--- .../java/com/aapeli/multiuser/ChatBase.java | 16 ++++----- .../com/aapeli/multiuser/ChatTextArea.java | 6 ++-- .../com/aapeli/multiuser/CopyChatFrame.java | 6 ++-- .../com/aapeli/multiuser/GlobalTextArea.java | 21 ++++++----- .../aapeli/multiuser/StaffActionFrame.java | 3 +- .../java/com/aapeli/multiuser/UserList.java | 35 ++++++++----------- .../src/main/java/com/aapeli/tools/Tools.java | 5 ++- .../main/java/com/aapeli/tools/XmlUnit.java | 15 ++++---- .../org/moparforia/client/MD5Checksum.java | 14 +++----- .../org/moparforia/client/TrackDumper.java | 6 +--- .../java/org/moparforia/client/recordz.java | 6 +--- .../client/trackdump/Connection.java | 7 ---- .../moparforia/client/LauncherCLITest.java | 1 - 60 files changed, 151 insertions(+), 250 deletions(-) diff --git a/client/src/main/java/agolf/Conn.java b/client/src/main/java/agolf/Conn.java index 4f66c5e2..18f2fdb9 100644 --- a/client/src/main/java/agolf/Conn.java +++ b/client/src/main/java/agolf/Conn.java @@ -29,7 +29,6 @@ public void dataReceived(String var1) { try { this.writeData("error-debug\t" + this.gameContainer.gameApplet.method32() + "\t" + var2.toString().trim().replace('\n', '\\') + "\t" + var1.replace('\t', '\\') + "\t" + this.aString2373.replace('\t', '\\') + "\t" + this.aString2372.replace('\t', '\\')); } catch (Exception var3) { - ; } this.gameContainer.gameApplet.setEndState(var4); @@ -75,7 +74,7 @@ protected void disconnect() { } } - private void handlePacket(String cmd) throws Exception { + private void handlePacket(String cmd) { String[] args = Tools.separateString(cmd, "\t"); if (args[0].equals("error")) { if (args[1].equals("vernotok")) { diff --git a/client/src/main/java/agolf/GameApplet.java b/client/src/main/java/agolf/GameApplet.java index 88be0477..b255a0f7 100644 --- a/client/src/main/java/agolf/GameApplet.java +++ b/client/src/main/java/agolf/GameApplet.java @@ -20,11 +20,11 @@ public class GameApplet extends AApplet { public static final Color colourButtonYellow = new Color(224, 224, 144); public static final Color colourButtonRed = new Color(224, 144, 144); public static final Color colourButtonBlue = new Color(144, 144, 224); - public static final Font fontSerif26b = new Font("Serif", 1, 26); - public static final Font fontSerif20 = new Font("Serif", 0, 20); - public static final Font fontDialog14b = new Font("Dialog", 1, 14); - public static final Font fontDialog12 = new Font("Dialog", 0, 12); - public static final Font fontDialog11 = new Font("Dialog", 0, 11); + public static final Font fontSerif26b = new Font("Serif", Font.BOLD, 26); + public static final Font fontSerif20 = new Font("Serif", Font.PLAIN, 20); + public static final Font fontDialog14b = new Font("Dialog", Font.BOLD, 14); + public static final Font fontDialog12 = new Font("Dialog", Font.PLAIN, 12); + public static final Font fontDialog11 = new Font("Dialog", Font.PLAIN, 11); private GameContainer gameContainer; private int activePanel; private SynchronizedBool syncUnknownBool; @@ -284,12 +284,12 @@ private boolean isValidSite() { } private boolean containsDomain(String host, String domain, String[] tld) { - for (int i = 0; i < tld.length; ++i) { - if (host.equals(domain + "." + tld[i])) { + for (String text : tld) { + if (host.equals(domain + "." + text)) { return true; } - if (host.endsWith("." + domain + "." + tld[i])) { + if (host.endsWith("." + domain + "." + text)) { return true; } } diff --git a/client/src/main/java/agolf/SpriteManager.java b/client/src/main/java/agolf/SpriteManager.java index 9df80990..57b5273e 100644 --- a/client/src/main/java/agolf/SpriteManager.java +++ b/client/src/main/java/agolf/SpriteManager.java @@ -62,7 +62,7 @@ public int[] getPixelsFromTileCode(int tileCode) { int shapeIndex = tileCode / 65536 % 256; // Becomes the SpecialIndex if isNoSpecial==2 int foregroundElementIndex = tileCode / 256 % 256; int backgroundElementIndex = tileCode % 256; - /** + /* * element index's * 0=grass, 1=dirt, 2=mud, 3=ice, 4=speed-n, 5=speed-ne, 6=speed-e, 7=speed-se * 8=speed-s, 9=speed-sw, 10=speed-w, 11=speed-nw diff --git a/client/src/main/java/agolf/game/ChatPanel.java b/client/src/main/java/agolf/game/ChatPanel.java index b290dedf..bda8df9a 100644 --- a/client/src/main/java/agolf/game/ChatPanel.java +++ b/client/src/main/java/agolf/game/ChatPanel.java @@ -3,14 +3,12 @@ import agolf.GameApplet; import agolf.GameContainer; import com.aapeli.client.InputTextField; -import com.aapeli.client.UrlLabel; import com.aapeli.colorgui.ColorButton; import com.aapeli.multiuser.ChatBase; import com.aapeli.multiuser.ChatTextArea; import java.awt.Font; import java.awt.Graphics; -import java.awt.LayoutManager; import java.awt.Panel; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -161,7 +159,7 @@ protected void addBroadcastMessage(String message) { private void create() { this.setLayout(null); - this.textAreaChat = new ChatTextArea(this.gameContainer.textManager, this.gameContainer.badWordFilter, this.width, this.height - 22, new Font("Dialog", 0, 11)); + this.textAreaChat = new ChatTextArea(this.gameContainer.textManager, this.gameContainer.badWordFilter, this.width, this.height - 22, new Font("Dialog", Font.PLAIN, 11)); this.textAreaChat.setLocation(0, 0); this.textFieldMessage = new InputTextField(this.gameContainer.textManager.getGame("GameChat_TypeHere"), 200, true); this.textFieldMessage.setBounds(0, this.height - 20, this.width - 70, 20); diff --git a/client/src/main/java/agolf/game/ConfirmButton.java b/client/src/main/java/agolf/game/ConfirmButton.java index 9da6a6c1..c24b688a 100644 --- a/client/src/main/java/agolf/game/ConfirmButton.java +++ b/client/src/main/java/agolf/game/ConfirmButton.java @@ -14,7 +14,7 @@ class ConfirmButton extends Canvas implements MouseMotionListener, MouseListener { - private static final Font fontDialog12 = new Font("Dialog", 0, 12); + private static final Font fontDialog12 = new Font("Dialog", Font.PLAIN, 12); private static final Color colourWhite = new Color(192, 192, 192); private static final Color colourBlack = new Color(0, 0, 0); private Font font; diff --git a/client/src/main/java/agolf/game/GameBackgroundCanvas.java b/client/src/main/java/agolf/game/GameBackgroundCanvas.java index 7d8d59f5..2f2ef495 100644 --- a/client/src/main/java/agolf/game/GameBackgroundCanvas.java +++ b/client/src/main/java/agolf/game/GameBackgroundCanvas.java @@ -244,7 +244,7 @@ private boolean parseMapInstruction(String map) throws Exception { if(subtknzr.countTokens() != 4) { return false; } - /** + /* * 0 = num of completions * 1 = num of strokes * 2 = best num of strokes @@ -384,7 +384,7 @@ private boolean parseMapInstruction(String map) throws Exception { return true; } - private String expandMap(String mapString) throws Exception { + private String expandMap(String mapString) { StringBuffer buffer = new StringBuffer(4900); int length = mapString.length(); @@ -408,9 +408,7 @@ private String expandMap(String mapString) throws Exception { char var6 = mapString.charAt(var4); - for (int var7 = 0; var7 < var5; ++var7) { - buffer.append(var6); - } + buffer.append(String.valueOf(var6).repeat(Math.max(0, var5))); } return buffer.toString(); @@ -660,7 +658,6 @@ private void drawMap() { } } } catch (OutOfMemoryError e) { - ; } this.graphics.drawImage(this.gameContainer.imageManager.createImage(mapPixels, 735, 375), 0, 0, this); diff --git a/client/src/main/java/agolf/game/GameCanvas.java b/client/src/main/java/agolf/game/GameCanvas.java index 1d3c9de5..1dc94f32 100644 --- a/client/src/main/java/agolf/game/GameCanvas.java +++ b/client/src/main/java/agolf/game/GameCanvas.java @@ -21,7 +21,7 @@ public class GameCanvas extends GameBackgroundCanvas implements Runnable, MouseM private static final Cursor cursorDefault = new Cursor(Cursor.DEFAULT_CURSOR); private static final Cursor cursorCrosshair = new Cursor(Cursor.CROSSHAIR_CURSOR); private static final Color colourAimLine = new Color(128, 0, 32); - private static final Font gameFont = new Font("Dialog", 0, 10); + private static final Font gameFont = new Font("Dialog", Font.PLAIN, 10); private static final Color blackColour = Color.black; private static final Color whiteColour = Color.white; private static final Color backgroundColour = new Color(19, 167, 19); diff --git a/client/src/main/java/agolf/game/GameControlPanel.java b/client/src/main/java/agolf/game/GameControlPanel.java index 89bfafab..71431ab4 100644 --- a/client/src/main/java/agolf/game/GameControlPanel.java +++ b/client/src/main/java/agolf/game/GameControlPanel.java @@ -7,7 +7,6 @@ import java.awt.Checkbox; import java.awt.Graphics; -import java.awt.LayoutManager; import java.awt.Panel; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; diff --git a/client/src/main/java/agolf/game/HackedShot.java b/client/src/main/java/agolf/game/HackedShot.java index 25733b2e..aad5c8c3 100644 --- a/client/src/main/java/agolf/game/HackedShot.java +++ b/client/src/main/java/agolf/game/HackedShot.java @@ -106,8 +106,8 @@ public HackedShot(int anInt2809, this.aSeed_2836 = aSeed_2836.clone(); this.anInt2839 = anInt2839; this.aBoolean2843 = aBoolean2843; - this.isSolidArrayIThink = Arrays.copyOf(isSolidArrayIThink, isSolidArrayIThink.length);; - this.mapTiles = Arrays.copyOf(mapTiles , mapTiles .length);; + this.isSolidArrayIThink = Arrays.copyOf(isSolidArrayIThink, isSolidArrayIThink.length); + this.mapTiles = Arrays.copyOf(mapTiles , mapTiles .length); } diff --git a/client/src/main/java/agolf/game/TrackInfoPanel.java b/client/src/main/java/agolf/game/TrackInfoPanel.java index 60ae643c..61bbb5f0 100644 --- a/client/src/main/java/agolf/game/TrackInfoPanel.java +++ b/client/src/main/java/agolf/game/TrackInfoPanel.java @@ -15,10 +15,10 @@ class TrackInfoPanel extends Panel implements ActionListener { - private static final Font fontDialog12 = new Font("Dialog", 0, 12); - private static final Font fontDialog14 = new Font("Dialog", 0, 14); - private static final Font fontSerif16 = new Font("Serif", 0, 16); - private static final Font fontDialog11 = new Font("Dialog", 0, 11); + private static final Font fontDialog12 = new Font("Dialog", Font.PLAIN, 12); + private static final Font fontDialog14 = new Font("Dialog", Font.PLAIN, 14); + private static final Font fontSerif16 = new Font("Serif", Font.PLAIN, 16); + private static final Font fontDialog11 = new Font("Dialog", Font.PLAIN, 11); private static final Color[] voteColours = new Color[]{ new Color(192, 0, 0), new Color(255, 0, 0), new Color(255, 64, 0), new Color(255, 128, 0), new Color(255, 192, 0), new Color(255, 255, 0), @@ -108,7 +108,6 @@ public void update(Graphics g) { Font font; for (font = fontSerif16; this.getFontMetrics(font).stringWidth(this.trackName) / 2 > this.width / 4 - xMod; font = new Font(font.getName(), font.getStyle(), font.getSize() - 1)) { - ; } this.graphics.setFont(font); diff --git a/client/src/main/java/agolf/lobby/LobbyChatPanel.java b/client/src/main/java/agolf/lobby/LobbyChatPanel.java index ec116849..9b897dc5 100644 --- a/client/src/main/java/agolf/lobby/LobbyChatPanel.java +++ b/client/src/main/java/agolf/lobby/LobbyChatPanel.java @@ -212,9 +212,7 @@ else if(args[1].equals("users")) { int i = args.length - 2; String[] users = new String[i]; - for (int var4 = 0; var4 < i; ++var4) { - users[var4] = args[2 + var4]; - } + System.arraycopy(args, 2, users, 0, i); this.setFullUserList(users); return true; diff --git a/client/src/main/java/agolf/lobby/LobbyDualPlayerPanel.java b/client/src/main/java/agolf/lobby/LobbyDualPlayerPanel.java index b1c9539d..fc91187d 100644 --- a/client/src/main/java/agolf/lobby/LobbyDualPlayerPanel.java +++ b/client/src/main/java/agolf/lobby/LobbyDualPlayerPanel.java @@ -13,7 +13,6 @@ import java.awt.Color; import java.awt.Graphics; import java.awt.Image; -import java.awt.LayoutManager; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; diff --git a/client/src/main/java/agolf/lobby/LobbyMultiPlayerPanel.java b/client/src/main/java/agolf/lobby/LobbyMultiPlayerPanel.java index acefd13f..c0383868 100644 --- a/client/src/main/java/agolf/lobby/LobbyMultiPlayerPanel.java +++ b/client/src/main/java/agolf/lobby/LobbyMultiPlayerPanel.java @@ -10,7 +10,6 @@ import java.awt.Color; import java.awt.Graphics; import java.awt.Image; -import java.awt.LayoutManager; import java.awt.Panel; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -418,12 +417,10 @@ private void removeTrack(int var1) { synchronized (trackList) { MultiColorListItem[] tracks = this.trackList.getAllItems(); if (tracks != null) { - int tracksLen = tracks.length; - - for (int index = 0; index < tracksLen; ++index) { - int[] trackData = (int[]) tracks[index].getData(); + for (MultiColorListItem track : tracks) { + int[] trackData = (int[]) track.getData(); if (trackData[0] == var1) { - this.trackList.removeItem(tracks[index]); + this.trackList.removeItem(track); return; } } diff --git a/client/src/main/java/agolf/lobby/LobbyPanel.java b/client/src/main/java/agolf/lobby/LobbyPanel.java index 037ffa22..c25cbfd7 100644 --- a/client/src/main/java/agolf/lobby/LobbyPanel.java +++ b/client/src/main/java/agolf/lobby/LobbyPanel.java @@ -188,7 +188,6 @@ public void handlePacket(String[] args) { } if (dummy) { - ; } } diff --git a/client/src/main/java/agolf/lobby/LobbySinglePlayerPanel.java b/client/src/main/java/agolf/lobby/LobbySinglePlayerPanel.java index f548b50d..33f0746a 100644 --- a/client/src/main/java/agolf/lobby/LobbySinglePlayerPanel.java +++ b/client/src/main/java/agolf/lobby/LobbySinglePlayerPanel.java @@ -9,7 +9,6 @@ import java.awt.Color; import java.awt.Graphics; import java.awt.Image; -import java.awt.LayoutManager; import java.awt.Panel; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; diff --git a/client/src/main/java/com/aapeli/applet/AApplet.java b/client/src/main/java/com/aapeli/applet/AApplet.java index 0ef9ec44..3310a3fd 100644 --- a/client/src/main/java/com/aapeli/applet/AApplet.java +++ b/client/src/main/java/com/aapeli/applet/AApplet.java @@ -13,7 +13,6 @@ import java.applet.Applet; import java.awt.Color; import java.awt.Component; -import java.awt.Dimension; import java.awt.Font; import java.awt.Graphics; import java.awt.GridBagLayout; @@ -41,10 +40,10 @@ public abstract class AApplet extends Applet implements Runnable, ActionListener public static final int END_ERROR_REGLOGIN_FAILED = 12; public static final int END_ERROR_TOOMANYIP_INIT = 13; public static final int END_THROWABLE = 14; - private static final Font fontDialog15 = new Font("Dialog", 0, 15); - private static final Font fontDialog12b = new Font("Dialog", 1, 12); - private static final Font fontDialog12 = new Font("Dialog", 0, 12); - private static final Font fontDialog11 = new Font("Dialog", 0, 12); + private static final Font fontDialog15 = new Font("Dialog", Font.PLAIN, 15); + private static final Font fontDialog12b = new Font("Dialog", Font.BOLD, 12); + private static final Font fontDialog12 = new Font("Dialog", Font.PLAIN, 12); + private static final Font fontDialog11 = new Font("Dialog", Font.PLAIN, 12); public int appletWidth; public int appletHeight; public Parameters param; @@ -111,7 +110,6 @@ public void destroy() { try { this.destroyApplet(); } catch (Exception e) { - ; } if (this.contentPanel != null) { @@ -756,12 +754,11 @@ private void sendLoadTimes(int readyTime, int finishedTime, int time1, int time2 queryUrl = Tools.replaceFirst(queryUrl, "%6", "" + time6); URL url = new URL(queryUrl); if (this.isDebug()) { - System.out.println("AApplet.sendLoadTimes(...): Displaying page \"" + url.toString() + "\""); + System.out.println("AApplet.sendLoadTimes(...): Displaying page \"" + url + "\""); } this.getAppletContext().showDocument(url); } catch (Exception e) { - ; } } @@ -773,9 +770,7 @@ private String getSystemProperty(String key) { return result; } } catch (Exception e) { - ; } catch (Error e) { - ; } return ""; diff --git a/client/src/main/java/com/aapeli/applet/AdCanvas.java b/client/src/main/java/com/aapeli/applet/AdCanvas.java index e313f392..906c0c5c 100644 --- a/client/src/main/java/com/aapeli/applet/AdCanvas.java +++ b/client/src/main/java/com/aapeli/applet/AdCanvas.java @@ -5,7 +5,6 @@ import java.awt.*; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; -import java.awt.image.ImageObserver; import java.net.URL; import java.util.Vector; @@ -147,7 +146,7 @@ protected boolean method213() { if (this.anURL119 != null) { this.addMouseListener(this); - this.setCursor(new Cursor(12)); + this.setCursor(new Cursor(Cursor.HAND_CURSOR)); } this.aBoolean123 = true; @@ -167,7 +166,7 @@ protected int method215() { } else { int var1 = (int) (System.currentTimeMillis() - this.aLong126); int var2 = this.anInt121 * 1000 - var1; - return var2 < 0 ? 0 : var2; + return Math.max(var2, 0); } } diff --git a/client/src/main/java/com/aapeli/applet/LoadingPanel.java b/client/src/main/java/com/aapeli/applet/LoadingPanel.java index 825f36aa..b8db3e27 100644 --- a/client/src/main/java/com/aapeli/applet/LoadingPanel.java +++ b/client/src/main/java/com/aapeli/applet/LoadingPanel.java @@ -16,8 +16,8 @@ class LoadingPanel extends Panel implements Runnable, ActionListener { - private static final Font fontDialog14 = new Font("Dialog", 0, 14); - private static final Font fontDialog20b = new Font("Dialog", 1, 20); + private static final Font fontDialog14 = new Font("Dialog", Font.PLAIN, 14); + private static final Font fontDialog20b = new Font("Dialog", Font.BOLD, 20); private AApplet gameApplet; private Parameters parameters; private TextManager textManager; @@ -118,7 +118,6 @@ public void run() { try { Thread.sleep(this.updateInterval); } catch (InterruptedException e) { - ; } if (this.destroyed) { @@ -371,7 +370,7 @@ private double getNextProgressIncrementToRender() { } else { double remainingProgress = 1.0D - this.renderedProgress; double var4 = remainingProgress * (double) this.updateInterval / (double) var1; - return var4 > this.aDouble586 ? this.aDouble586 : var4; + return Math.min(var4, this.aDouble586); } } } diff --git a/client/src/main/java/com/aapeli/bigtext/BigText.java b/client/src/main/java/com/aapeli/bigtext/BigText.java index b489b5bd..2327be02 100644 --- a/client/src/main/java/com/aapeli/bigtext/BigText.java +++ b/client/src/main/java/com/aapeli/bigtext/BigText.java @@ -20,7 +20,7 @@ public class BigText { public static final int VALIGN_MIDDLE = 0; public static final int VALIGN_BOTTOM = 1; protected static final Color aColor1312; - private static final String aString1313 = "ABCDEFGHIJKLMNOPQRSTUVWXYZÅÄÖ 1234567890:!?/&Ü+-*%<>()ÁÉÑ\'\"¿¡ÍÓÚØ"; + private static final String aString1313 = "ABCDEFGHIJKLMNOPQRSTUVWXYZÅÄÖ 1234567890:!?/&Ü+-*%<>()ÁÉÑ'\"¿¡ÍÓÚØ"; protected static final int[] anIntArray1314; protected static final int anInt1315; private static ImageManager anImageManager1316; @@ -123,7 +123,7 @@ private boolean method1550(String var1) { int var2 = var1.length(); for (int var3 = 0; var3 < var2; ++var3) { - if ("ABCDEFGHIJKLMNOPQRSTUVWXYZÅÄÖ 1234567890:!?/&Ü+-*%<>()ÁÉÑ\'\"¿¡ÍÓÚØ".indexOf(var1.charAt(var3)) == -1) { + if ("ABCDEFGHIJKLMNOPQRSTUVWXYZÅÄÖ 1234567890:!?/&Ü+-*%<>()ÁÉÑ'\"¿¡ÍÓÚØ".indexOf(var1.charAt(var3)) == -1) { return false; } } @@ -138,7 +138,7 @@ private void method1551(String var1, Color var2, int[] var3, int[] var4, int var this.anInt1322 = 0; for (int var10 = 0; var10 < var6; ++var10) { - int var9 = "ABCDEFGHIJKLMNOPQRSTUVWXYZÅÄÖ 1234567890:!?/&Ü+-*%<>()ÁÉÑ\'\"¿¡ÍÓÚØ".indexOf(var1.charAt(var10)); + int var9 = "ABCDEFGHIJKLMNOPQRSTUVWXYZÅÄÖ 1234567890:!?/&Ü+-*%<>()ÁÉÑ'\"¿¡ÍÓÚØ".indexOf(var1.charAt(var10)); var7[var10] = anIntArray1314[var9] / var5; var8[var10] = var4[var9]; this.anInt1322 += var8[var10]; @@ -181,7 +181,7 @@ private int method1553(int var1, int var2, double var3, double var5, double var7 private void method1554(String var1, Color var2, int var3, Component var4) { this.anInt1323 = 50 / var3; - Font var5 = new Font("Dialog", 1, this.anInt1323 * 6 / 8); + Font var5 = new Font("Dialog", Font.BOLD, this.anInt1323 * 6 / 8); Applet var6 = anImageManager1316.getApplet(); this.anInt1322 = var6.getFontMetrics(var5).stringWidth(var1) + 2; Image var7 = null; diff --git a/client/src/main/java/com/aapeli/bigtext/MediumText.java b/client/src/main/java/com/aapeli/bigtext/MediumText.java index 23ba7683..a5fdca20 100644 --- a/client/src/main/java/com/aapeli/bigtext/MediumText.java +++ b/client/src/main/java/com/aapeli/bigtext/MediumText.java @@ -3,7 +3,6 @@ import com.aapeli.bigtext.BigText; import java.awt.Color; -import java.awt.Component; public class MediumText extends BigText { diff --git a/client/src/main/java/com/aapeli/client/BadWordFilter.java b/client/src/main/java/com/aapeli/client/BadWordFilter.java index 27625135..5b863d57 100644 --- a/client/src/main/java/com/aapeli/client/BadWordFilter.java +++ b/client/src/main/java/com/aapeli/client/BadWordFilter.java @@ -10,7 +10,7 @@ public final class BadWordFilter { private static final String aString1335 = "0123456789 l |¦!¡( @¤× ª°º¹²³ ©® ¥ßµ¢ àáâãåçèéêëìíîïñòóôõøùúûüýÿæ"; private static final String aString1336 = "oizeasgtbp i iiiic aox aooize cr ybuc aaaäoceeeeiiiinooooouuuuyye"; private static final String aString1337 = "¦!¡ []{}() ~ ª°º¹²³* `´\""; - private static final String aString1338 = "||| |||||| - \'\'\'\'\'\'\' \'\'\'"; + private static final String aString1338 = "||| |||||| - ''''''' '''"; private static final String[] aStringArray1339; private static final String[] aStringArray1340; private static final String[] aStringArray1341; @@ -70,10 +70,8 @@ protected BadWordFilter(TextManager var1, boolean var2, String var3) { public boolean containsBadWords(String var1) { int[] var2 = this.method1566(var1); - int var3 = var2.length; - - for (int var4 = 0; var4 < var3; ++var4) { - if (var2[var4] < 0) { + for (int i : var2) { + if (i < 0) { return true; } } @@ -126,10 +124,10 @@ private int method1567(char var1) { } private void method1568(String var1, int[] var2) { - for (int var3 = 0; var3 < aStringArray1341.length; ++var3) { - int var4 = aStringArray1341[var3].length(); + for (String text : aStringArray1341) { + int var4 = text.length(); - for (int var5 = 0; (var5 = var1.indexOf(aStringArray1341[var3], var5)) >= 0; var5 += var4) { + for (int var5 = 0; (var5 = var1.indexOf(text, var5)) >= 0; var5 += var4) { for (int var6 = 0; var6 < var4; ++var6) { var2[var5 + var6] = 1; } @@ -144,7 +142,7 @@ private void method1569(String var1, int[] var2, int[] var3, String[] var4, int var6 = this.method1570(var6, this.aString1342, this.aString1343); this.method1572(var6, var2, var3, var4, var5); var6 = var1.toLowerCase(); - var6 = this.method1570(var6, "¦!¡ []{}() ~ ª°º¹²³* `´\"", "||| |||||| - \'\'\'\'\'\'\' \'\'\'"); + var6 = this.method1570(var6, "¦!¡ []{}() ~ ª°º¹²³* `´\"", "||| |||||| - ''''''' '''"); var6 = this.method1571(var6, aStringArray1339, aStringArray1340); this.method1572(var6, var2, var3, var4, var5); var6 = this.method1570(var6, this.aString1342, this.aString1343); @@ -177,9 +175,9 @@ private String method1571(String var1, String[] var2, String[] var3) { private void method1572(String var1, int[] var2, int[] var3, String[] var4, int var5) { int var6 = var1.length(); - for (int var7 = 0; var7 < var4.length; ++var7) { + for (String text : var4) { for (int var8 = 0; var8 < var6; ++var8) { - this.method1573(var1, var8, var2, var3, var4[var7], var5); + this.method1573(var1, var8, var2, var3, text, var5); } } @@ -330,10 +328,10 @@ private char method1575() { aStringArray1339[18] = "_)"; aStringArray1339[19] = "(_"; aStringArray1339[20] = "||"; - aStringArray1339[21] = "\'|\'"; + aStringArray1339[21] = "'|'"; aStringArray1339[22] = "|3"; aStringArray1339[23] = "|)"; - aStringArray1339[24] = "|\'"; + aStringArray1339[24] = "|'"; aStringArray1340 = new String[25]; aStringArray1340[0] = "kk"; aStringArray1340[1] = "|z"; @@ -361,7 +359,7 @@ private char method1575() { aStringArray1340[23] = "dd"; aStringArray1340[24] = "pp"; aStringArray1341 = new String[2]; - aStringArray1341[0] = "He\'ll"; - aStringArray1341[1] = "he\'ll"; + aStringArray1341[0] = "He'll"; + aStringArray1341[1] = "he'll"; } } diff --git a/client/src/main/java/com/aapeli/client/Class78.java b/client/src/main/java/com/aapeli/client/Class78.java index 75ac24a0..b600dbb3 100644 --- a/client/src/main/java/com/aapeli/client/Class78.java +++ b/client/src/main/java/com/aapeli/client/Class78.java @@ -64,7 +64,6 @@ protected void method1602() { this.frame.close(); } } catch (Exception var2) { - ; } } diff --git a/client/src/main/java/com/aapeli/client/Class79.java b/client/src/main/java/com/aapeli/client/Class79.java index 05e46e2a..938195a0 100644 --- a/client/src/main/java/com/aapeli/client/Class79.java +++ b/client/src/main/java/com/aapeli/client/Class79.java @@ -34,7 +34,7 @@ public String toString() { var2 = var2 + " " + this.aVector1368.elementAt(var3).toString() + "\n"; } - var2 = var2 + "\'relatx\'=" + this.anInt1369 + " \'height\'=" + this.anInt1370 + "]"; + var2 = var2 + "'relatx'=" + this.anInt1369 + " 'height'=" + this.anInt1370 + "]"; return var2; } diff --git a/client/src/main/java/com/aapeli/client/Class80.java b/client/src/main/java/com/aapeli/client/Class80.java index 7b5588ed..10d85fcb 100644 --- a/client/src/main/java/com/aapeli/client/Class80.java +++ b/client/src/main/java/com/aapeli/client/Class80.java @@ -23,7 +23,7 @@ protected Class80(Class79 var1, String var2, Font var3, int var4, int var5) { } public String toString() { - return "[HtmlWord: \'word\'=\"" + this.aString1373 + "\" \'font\'=\"" + this.aFont1374.toString() + "\" \'relx\'=" + this.anInt1375 + "]"; + return "[HtmlWord: 'word'=\"" + this.aString1373 + "\" 'font'=\"" + this.aFont1374.toString() + "\" 'relx'=" + this.anInt1375 + "]"; } protected int method1609() { diff --git a/client/src/main/java/com/aapeli/client/Class81.java b/client/src/main/java/com/aapeli/client/Class81.java index fc3660db..f6808998 100644 --- a/client/src/main/java/com/aapeli/client/Class81.java +++ b/client/src/main/java/com/aapeli/client/Class81.java @@ -29,11 +29,11 @@ protected String method1611() { Font var4; if (this.method1615("strong", "b")) { var4 = this.aGraphics1380.getFont(); - this.aGraphics1380.setFont(new Font(var4.getName(), 1, var4.getSize())); + this.aGraphics1380.setFont(new Font(var4.getName(), Font.BOLD, var4.getSize())); return this.method1611(); } else if (this.method1615("/strong", "/b")) { var4 = this.aGraphics1380.getFont(); - this.aGraphics1380.setFont(new Font(var4.getName(), 0, var4.getSize())); + this.aGraphics1380.setFont(new Font(var4.getName(), Font.PLAIN, var4.getSize())); return this.method1611(); } else if (this.method1614("big")) { var4 = this.aGraphics1380.getFont(); @@ -99,9 +99,9 @@ private boolean method1616(String var1, String var2, String var3) { private boolean method1617(String[] var1) { String var2 = this.aString1379.toLowerCase(); - for (int var3 = 0; var3 < var1.length; ++var3) { - if (var2.startsWith(var1[var3])) { - int var4 = var1[var3].length(); + for (String text : var1) { + if (var2.startsWith(text)) { + int var4 = text.length(); this.aString1379 = this.aString1379.substring(var4); return true; } diff --git a/client/src/main/java/com/aapeli/client/Class88.java b/client/src/main/java/com/aapeli/client/Class88.java index e4c80aa1..868422dd 100644 --- a/client/src/main/java/com/aapeli/client/Class88.java +++ b/client/src/main/java/com/aapeli/client/Class88.java @@ -83,7 +83,6 @@ protected boolean method1700() { this.method1704(); return true; } catch (Exception var2) { - ; } } @@ -97,7 +96,6 @@ protected void method1701() { this.aFrame_Sub3_Sub3_1508.close(); } } catch (Exception var2) { - ; } } @@ -131,9 +129,7 @@ protected boolean method1702(String[] var1, String var2, int var3, int var4, int this.aParameters1500.getAppletContext().showDocument(var14, this.aString1505); return true; } catch (Exception var12) { - ; } catch (Error var13) { - ; } return false; @@ -151,11 +147,9 @@ private void method1704() { private String method1705(String[] var1, String var2) { String var3 = ""; - int var4 = var1.length; - - for (int var5 = 0; var5 < var4; ++var5) { - if (var1[var5] != null) { - var3 = var3 + var1[var5]; + for (String text : var1) { + if (text != null) { + var3 = var3 + text; } } @@ -177,8 +171,8 @@ private String method1707(byte[] var1) { int var2 = var1.length; StringBuffer var3 = new StringBuffer(var2 * 2); - for (int var4 = 0; var4 < var2; ++var4) { - int var5 = var1[var4] >= 0 ? var1[var4] : 256 + var1[var4]; + for (byte b : var1) { + int var5 = b >= 0 ? b : 256 + b; if (var5 < 16) { var3.append('0'); } @@ -193,9 +187,9 @@ private static String method1708(String var0) { char[] var1 = var0.toCharArray(); StringBuffer var2 = new StringBuffer(var1.length); - for (int var3 = 0; var3 < var1.length; ++var3) { - if ((var1[var3] < 97 || var1[var3] > 122) && (var1[var3] < 65 || var1[var3] > 90) && (var1[var3] < 48 || var1[var3] > 57)) { - char var4 = var1[var3]; + for (char c : var1) { + if ((c < 97 || c > 122) && (c < 65 || c > 90) && (c < 48 || c > 57)) { + char var4 = c; if (var4 > 255) { var4 = 255; } @@ -204,7 +198,7 @@ private static String method1708(String var0) { var2.append(Integer.toHexString(var4 / 16)); var2.append(Integer.toHexString(var4 % 16)); } else { - var2.append(var1[var3]); + var2.append(c); } } diff --git a/client/src/main/java/com/aapeli/client/Frame_Sub3.java b/client/src/main/java/com/aapeli/client/Frame_Sub3.java index c9e7a532..cdd532cc 100644 --- a/client/src/main/java/com/aapeli/client/Frame_Sub3.java +++ b/client/src/main/java/com/aapeli/client/Frame_Sub3.java @@ -9,7 +9,6 @@ import java.awt.Frame; import java.awt.Graphics; import java.awt.Insets; -import java.awt.LayoutManager; import java.awt.Panel; import java.awt.Point; import java.awt.event.WindowEvent; diff --git a/client/src/main/java/com/aapeli/client/IPanel.java b/client/src/main/java/com/aapeli/client/IPanel.java index 238c1e31..61f63f7c 100644 --- a/client/src/main/java/com/aapeli/client/IPanel.java +++ b/client/src/main/java/com/aapeli/client/IPanel.java @@ -71,13 +71,13 @@ public void setSharedBackground(ImageManager var1, String var2, int var3, int va public void drawBackground(Graphics var1) { if (!this.drawBackgroundImage(var1)) { - Object var2 = this.getParent(); + Component var2 = this.getParent(); if (var2 == null) { var2 = this; } Dimension var3 = this.getSize(); - var1.setColor(((Component) var2).getBackground()); + var1.setColor(var2.getBackground()); var1.fillRect(0, 0, var3.width, var3.height); } diff --git a/client/src/main/java/com/aapeli/client/IPanel_Sub40.java b/client/src/main/java/com/aapeli/client/IPanel_Sub40.java index a3a82ba8..60744b0d 100644 --- a/client/src/main/java/com/aapeli/client/IPanel_Sub40.java +++ b/client/src/main/java/com/aapeli/client/IPanel_Sub40.java @@ -6,7 +6,6 @@ import java.awt.Color; import java.awt.Font; import java.awt.Graphics; -import java.awt.LayoutManager; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -107,6 +106,6 @@ private void method821() { aColor3206 = Color.black; aColor3207 = new Color(128, 255, 128); aColor3208 = new Color(240, 240, 96); - aFont3209 = new Font("Dialog", 0, 16); + aFont3209 = new Font("Dialog", Font.PLAIN, 16); } } diff --git a/client/src/main/java/com/aapeli/client/ImageManager.java b/client/src/main/java/com/aapeli/client/ImageManager.java index ca113bac..9d1fcf36 100644 --- a/client/src/main/java/com/aapeli/client/ImageManager.java +++ b/client/src/main/java/com/aapeli/client/ImageManager.java @@ -157,7 +157,6 @@ public Image getShared(String var1, boolean var2) { codebaseURL = new URL(codebaseURL, "../Shared/picture/"); } } catch (MalformedURLException var9) { - ; } URL url = codebaseURL; @@ -198,7 +197,6 @@ public int[] getPixels(Image var1, int var2, int var3, int var4, int var5) { try { var7.grabPixels(); } catch (InterruptedException var9) { - ; } return var6; diff --git a/client/src/main/java/com/aapeli/client/ImageTracker.java b/client/src/main/java/com/aapeli/client/ImageTracker.java index a4d566b3..f32b5197 100644 --- a/client/src/main/java/com/aapeli/client/ImageTracker.java +++ b/client/src/main/java/com/aapeli/client/ImageTracker.java @@ -152,7 +152,6 @@ protected void removeAllImageResources() { try { var6.nextElement().flush(); } catch (Exception var5) { - ; } } @@ -164,7 +163,6 @@ protected void removeAllImageResources() { try { var7.nextElement().method1652(); } catch (Exception var4) { - ; } } @@ -271,7 +269,7 @@ private boolean method1645() { } if (this.aBoolean1397) { - System.out.println("ImageTracker: Loaded image \"" + imageAlias + "\", moving from \'notloaded\' to \'loaded\'"); + System.out.println("ImageTracker: Loaded image \"" + imageAlias + "\", moving from 'notloaded' to 'loaded'"); } synchronized (this) { diff --git a/client/src/main/java/com/aapeli/client/InputTextField.java b/client/src/main/java/com/aapeli/client/InputTextField.java index 652fcaba..0a945ed3 100644 --- a/client/src/main/java/com/aapeli/client/InputTextField.java +++ b/client/src/main/java/com/aapeli/client/InputTextField.java @@ -64,7 +64,7 @@ public InputTextField(String defaultText, int maxLen, boolean enabled) { this.addKeyListener(this); this.addActionListener(this); this.inputTextLength = 0; - this.listeners = new Vector(); + this.listeners = new Vector<>(); } public void focusGained(FocusEvent var1) { diff --git a/client/src/main/java/com/aapeli/client/Panel_Sub24.java b/client/src/main/java/com/aapeli/client/Panel_Sub24.java index 2bef7f55..31294319 100644 --- a/client/src/main/java/com/aapeli/client/Panel_Sub24.java +++ b/client/src/main/java/com/aapeli/client/Panel_Sub24.java @@ -13,7 +13,6 @@ import java.awt.Font; import java.awt.Graphics; import java.awt.Image; -import java.awt.LayoutManager; import java.awt.Panel; import java.awt.TextArea; import java.awt.event.ActionEvent; @@ -366,10 +365,10 @@ private boolean method484(String var1) { aColor620 = new Color(128, 255, 128); aColor621 = new Color(255, 128, 128); aColor622 = new Color(224, 224, 128); - aFont623 = new Font("Dialog", 0, 12); - aFont624 = new Font("Dialog", 0, 14); - aFont625 = new Font("Dialog", 0, 11); - aFont626 = new Font("Serif", 0, 18); - aFont627 = new Font("Dialog", 0, 16); + aFont623 = new Font("Dialog", Font.PLAIN, 12); + aFont624 = new Font("Dialog", Font.PLAIN, 14); + aFont625 = new Font("Dialog", Font.PLAIN, 11); + aFont626 = new Font("Serif", Font.PLAIN, 18); + aFont627 = new Font("Dialog", Font.PLAIN, 16); } } diff --git a/client/src/main/java/com/aapeli/client/Parameters.java b/client/src/main/java/com/aapeli/client/Parameters.java index 3e8ce605..16896e73 100644 --- a/client/src/main/java/com/aapeli/client/Parameters.java +++ b/client/src/main/java/com/aapeli/client/Parameters.java @@ -200,7 +200,6 @@ public boolean showPlayerCard(String var1) { return true; } } catch (Exception e) { - ; } return false; @@ -234,7 +233,6 @@ public void showPlayerList(String[] nicks, String var2) { this.aString1457 = var2; this.anInt1455 = 1; } catch (Exception e) { - ; } } @@ -274,7 +272,6 @@ public void showPlayerListWinners(boolean[] winners) { this.showPlayerList(this.aStringArray1456, winners, this.aString1457); this.anInt1455 = 2; } catch (Exception e) { - ; } } @@ -292,7 +289,6 @@ public void removePlayerList() { this.showPlayerList(null, null, null); this.anInt1455 = 0; } catch (Exception e) { - ; } } @@ -492,7 +488,7 @@ private void init() { this.json = this.getParameter("json"); this.username = this.getParameter("username"); if (this.json != null) { - this.json = Tools.replaceFirst(this.json, "\'%o\'", "%o"); + this.json = Tools.replaceFirst(this.json, "'%o'", "%o"); if (!this.json.toLowerCase().startsWith("javascript:")) { this.json = "javascript:" + this.json; } @@ -531,7 +527,6 @@ private String getParamLocale() { return locale; } } catch (Exception e) { - ; } if (this.codeBaseHost.endsWith("aapeli.com")) { @@ -546,7 +541,6 @@ private String getParamLocale() { return locale; } } catch (Exception e) { - ; } } @@ -557,7 +551,6 @@ private String getParamLocale() { return locale; } } catch (Exception e) { - ; } } @@ -577,7 +570,6 @@ private String getParamLanguage() { return language; } } catch (Exception e) { - ; } return null; @@ -595,7 +587,6 @@ private String getParamChatLanguage() { return chatLanguage; } } catch (Exception e) { - ; } return null; @@ -608,7 +599,6 @@ private String getParamSiteName() { return siteName; } } catch (Exception e) { - ; } if (this.documentBaseHost.contains("aapeli.")) { diff --git a/client/src/main/java/com/aapeli/client/TextManager.java b/client/src/main/java/com/aapeli/client/TextManager.java index fa7503f2..605c3288 100644 --- a/client/src/main/java/com/aapeli/client/TextManager.java +++ b/client/src/main/java/com/aapeli/client/TextManager.java @@ -493,7 +493,6 @@ private String getDate(long timestamp, int mode) { result = this.getShared("DateToday"); } } catch (Exception e) { - ; } return result; @@ -579,7 +578,6 @@ private void loadLocaleFiles(Applet applet) { codeBase = new URL(codeBase, "../Shared/"); } } catch (MalformedURLException e) { - ; } this.sharedTable = this.loadLocalizationTable(codeBase); @@ -646,7 +644,6 @@ private Hashtable loadLocalizationTable(URL baseUrl) { try { reader.close(); } catch (Exception e) { - ; } return localizationTable; diff --git a/client/src/main/java/com/aapeli/client/UrlLabel.java b/client/src/main/java/com/aapeli/client/UrlLabel.java index 18e698c3..2b9219b9 100644 --- a/client/src/main/java/com/aapeli/client/UrlLabel.java +++ b/client/src/main/java/com/aapeli/client/UrlLabel.java @@ -139,7 +139,6 @@ public void setText(String text, String url) { try { this.url = new URL(url); } catch (MalformedURLException e) { - ; } } diff --git a/client/src/main/java/com/aapeli/colorgui/Class91.java b/client/src/main/java/com/aapeli/colorgui/Class91.java index f81ef0ab..6e8ca446 100644 --- a/client/src/main/java/com/aapeli/colorgui/Class91.java +++ b/client/src/main/java/com/aapeli/colorgui/Class91.java @@ -8,7 +8,6 @@ import java.awt.Font; import java.awt.Graphics; import java.awt.Image; -import java.awt.image.ImageObserver; class Class91 { diff --git a/client/src/main/java/com/aapeli/colorgui/Class94.java b/client/src/main/java/com/aapeli/colorgui/Class94.java index 24468f29..889bdae4 100644 --- a/client/src/main/java/com/aapeli/colorgui/Class94.java +++ b/client/src/main/java/com/aapeli/colorgui/Class94.java @@ -6,7 +6,7 @@ class Class94 { protected static final String aString1574 = "Dialog"; - protected static final Font aFont1575 = new Font("Dialog", 0, 12); + protected static final Font aFont1575 = new Font("Dialog", Font.PLAIN, 12); protected static final Color aColor1576 = new Color(0, 0, 0); diff --git a/client/src/main/java/com/aapeli/colorgui/ColorButton.java b/client/src/main/java/com/aapeli/colorgui/ColorButton.java index 3203631e..70378a54 100644 --- a/client/src/main/java/com/aapeli/colorgui/ColorButton.java +++ b/client/src/main/java/com/aapeli/colorgui/ColorButton.java @@ -14,7 +14,6 @@ import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; -import java.awt.image.ImageObserver; import java.util.Enumeration; import java.util.Vector; @@ -68,7 +67,7 @@ public ColorButton(String var1) { this.setForeground(Class94.aColor1576); this.setFont(Class94.aFont1575); this.setLabel(var1); - this.setSecondaryFont(new Font("Dialog", 0, 11)); + this.setSecondaryFont(new Font("Dialog", Font.PLAIN, 11)); this.setSecondaryLabel(null); this.aBoolean3276 = true; this.aBoolean3277 = this.aBoolean3278 = false; @@ -545,7 +544,7 @@ private int method828(int var1, int var2) { } private Font method829(Font var1) { - return this.isBolded() ? new Font(var1.getName(), 1, var1.getSize()) : var1; + return this.isBolded() ? new Font(var1.getName(), Font.BOLD, var1.getSize()) : var1; } private Font method830(Font var1, String var2, int var3) { diff --git a/client/src/main/java/com/aapeli/colorgui/ColorList.java b/client/src/main/java/com/aapeli/colorgui/ColorList.java index a24c59aa..2dcbc1ca 100644 --- a/client/src/main/java/com/aapeli/colorgui/ColorList.java +++ b/client/src/main/java/com/aapeli/colorgui/ColorList.java @@ -11,7 +11,6 @@ import java.awt.Graphics; import java.awt.Image; import java.awt.ItemSelectable; -import java.awt.LayoutManager; import java.awt.Panel; import java.awt.Scrollbar; import java.awt.event.AdjustmentEvent; @@ -89,12 +88,12 @@ public ColorList(int var1, int var2, Font var3, int var4, int var5) { this.setSize(var1, var2); this.aFont658 = var3; int var6 = var3.getSize(); - this.aFont659 = new Font(var3.getName(), 1, var6); + this.aFont659 = new Font(var3.getName(), Font.BOLD, var6); this.anInt660 = var4; this.aVector669 = new Vector<>(); this.anInt665 = 0; this.anInt666 = 0; - this.anInt663 = (var6 > var5 ? var6 : var5) + 4; + this.anInt663 = (Math.max(var6, var5)) + 4; this.anInt664 = var2 / this.anInt663; this.anInt671 = this.anInt672 = this.anInt678 = this.anInt679 = -1; this.anInt673 = -1; diff --git a/client/src/main/java/com/aapeli/colorgui/ColorSpinner.java b/client/src/main/java/com/aapeli/colorgui/ColorSpinner.java index a0825613..ddd20b77 100644 --- a/client/src/main/java/com/aapeli/colorgui/ColorSpinner.java +++ b/client/src/main/java/com/aapeli/colorgui/ColorSpinner.java @@ -112,7 +112,7 @@ public Font getFont() { } if (this.aFont3316 == null || var1 != this.anInt3317) { - this.aFont3316 = new Font("Dialog", 0, var1); + this.aFont3316 = new Font("Dialog", Font.PLAIN, var1); this.anInt3317 = var1; } @@ -402,7 +402,7 @@ private void method845() { protected void method846() { String var1 = this.getSelectedItem(); if (var1 != null) { - ItemEvent var2 = new ItemEvent(this, 701, var1, 1); + ItemEvent var2 = new ItemEvent(this, 701, var1, ItemEvent.SELECTED); Enumeration var3 = this.aVector3318.elements(); while (var3.hasMoreElements()) { diff --git a/client/src/main/java/com/aapeli/colorgui/ColorTextArea.java b/client/src/main/java/com/aapeli/colorgui/ColorTextArea.java index be06d6ce..0f0fc193 100644 --- a/client/src/main/java/com/aapeli/colorgui/ColorTextArea.java +++ b/client/src/main/java/com/aapeli/colorgui/ColorTextArea.java @@ -10,7 +10,6 @@ import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Image; -import java.awt.LayoutManager; import java.awt.Scrollbar; import java.awt.event.AdjustmentEvent; import java.awt.event.AdjustmentListener; @@ -77,7 +76,7 @@ public ColorTextArea(int var1, int var2, Font var3) { this.aFont3336 = var3; this.aFontMetrics3338 = this.getFontMetrics(var3); this.anInt3339 = var3.getSize(); - this.aFont3337 = new Font(var3.getName(), 1, var3.getSize()); + this.aFont3337 = new Font(var3.getName(), Font.BOLD, var3.getSize()); this.aVector3345 = new Vector<>(); this.aVector3346 = new Vector<>(); this.anImage3333 = null; @@ -222,8 +221,8 @@ public String[] getTimeStampedCache() { } else { Calendar var6 = Calendar.getInstance(); var6.setTime(new Date(var5.method1750())); - int var7 = var6.get(11); - int var8 = var6.get(12); + int var7 = var6.get(Calendar.HOUR_OF_DAY); + int var8 = var6.get(Calendar.MINUTE); var3[var9] = "[" + (var7 < 10 ? "0" : "") + var7 + ":" + (var8 < 10 ? "0" : "") + var8 + "] " + var5.method1752(); } } @@ -331,7 +330,6 @@ private void method852(Color var1, String var2, boolean var3) { int var8; for (var8 = var7; var8 > 3 && var2.charAt(var8) != 32; --var8) { - ; } if (var8 == 3) { diff --git a/client/src/main/java/com/aapeli/colorgui/MultiColorList.java b/client/src/main/java/com/aapeli/colorgui/MultiColorList.java index 97c5d2c3..17e192c5 100644 --- a/client/src/main/java/com/aapeli/colorgui/MultiColorList.java +++ b/client/src/main/java/com/aapeli/colorgui/MultiColorList.java @@ -8,7 +8,6 @@ import java.awt.Graphics; import java.awt.Image; import java.awt.ItemSelectable; -import java.awt.LayoutManager; import java.awt.Panel; import java.awt.Scrollbar; import java.awt.event.AdjustmentEvent; @@ -17,7 +16,6 @@ import java.awt.event.ItemListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; -import java.awt.image.ImageObserver; import java.util.Enumeration; import java.util.Vector; @@ -35,7 +33,7 @@ public class MultiColorList extends Panel implements AdjustmentListener, MouseLi public static final int ORDER_321_FIRST = 3; public static final int ORDER_123_ALL = 4; public static final int ORDER_321_ALL = 5; - private static final Font aFont681 = new Font("Dialog", 1, 12); + private static final Font aFont681 = new Font("Dialog", Font.BOLD, 12); private static final Color aColor682 = new Color(255, 255, 255); private static final Color aColor683 = new Color(192, 192, 192); private static final Color aColor684 = new Color(64, 64, 64); diff --git a/client/src/main/java/com/aapeli/colorgui/RadioButton.java b/client/src/main/java/com/aapeli/colorgui/RadioButton.java index 71b6eff2..e80bc9e0 100644 --- a/client/src/main/java/com/aapeli/colorgui/RadioButton.java +++ b/client/src/main/java/com/aapeli/colorgui/RadioButton.java @@ -139,10 +139,7 @@ public void drawBorder(Graphics var1, int var2, int var3) { } public int drawIcon(Graphics var1, Image var2, int var3) { - int var4 = var3; - if (var3 < 5) { - var4 = 5; - } + int var4 = Math.max(var3, 5); var1.drawImage(var2, var4, var3, this); return var4; diff --git a/client/src/main/java/com/aapeli/colorgui/RoundButton.java b/client/src/main/java/com/aapeli/colorgui/RoundButton.java index 02e95337..18f4375a 100644 --- a/client/src/main/java/com/aapeli/colorgui/RoundButton.java +++ b/client/src/main/java/com/aapeli/colorgui/RoundButton.java @@ -21,7 +21,7 @@ public class RoundButton extends IPanel implements MouseMotionListener, MouseLis private static final Color aColor3379 = new Color(224, 224, 224); private static final Color aColor3380 = new Color(0, 0, 0); private static final Color aColor3381 = new Color(255, 255, 255); - private static final Font aFont3382 = new Font("Dialog", 0, 12); + private static final Font aFont3382 = new Font("Dialog", Font.PLAIN, 12); private Color aColor3383; private Color aColor3384; private Color aColor3385; diff --git a/client/src/main/java/com/aapeli/colorgui/TabBar.java b/client/src/main/java/com/aapeli/colorgui/TabBar.java index e631ac2f..bc3ccba0 100644 --- a/client/src/main/java/com/aapeli/colorgui/TabBar.java +++ b/client/src/main/java/com/aapeli/colorgui/TabBar.java @@ -13,7 +13,6 @@ import java.awt.Font; import java.awt.Graphics; import java.awt.Image; -import java.awt.LayoutManager; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ComponentEvent; diff --git a/client/src/main/java/com/aapeli/connection/Connection.java b/client/src/main/java/com/aapeli/connection/Connection.java index 9ae9124b..96c782ce 100644 --- a/client/src/main/java/com/aapeli/connection/Connection.java +++ b/client/src/main/java/com/aapeli/connection/Connection.java @@ -122,9 +122,9 @@ public void run() { } } while (this.state != STATE_DISCONNECTED); } catch (Exception ex) { - ; // TODO: hanlde + // TODO: hanlde } catch (Error err) { - ; // TODO: handle + // TODO: handle } this.close(); @@ -410,7 +410,6 @@ private String readLine() { } catch (InterruptedIOException ex) { return null; } catch (IOException ex) { - ; } this.disconnect(); @@ -432,7 +431,6 @@ private void reconnect() { try { Thread.sleep(3000L); } catch (InterruptedException ex) { - ; } if (this.state != STATE_DOWN) { @@ -456,7 +454,6 @@ private void close() { try { this.sockIn.close(); } catch (IOException ex) { - ; } this.sockIn = null; @@ -466,7 +463,6 @@ private void close() { try { this.sockOut.close(); } catch (IOException ex) { - ; } this.sockOut = null; @@ -476,7 +472,6 @@ private void close() { try { this.socket.close(); } catch (IOException ex) { - ; } this.socket = null; diff --git a/client/src/main/java/com/aapeli/multiuser/ChatBase.java b/client/src/main/java/com/aapeli/multiuser/ChatBase.java index 7eb80bfd..c554b1a8 100644 --- a/client/src/main/java/com/aapeli/multiuser/ChatBase.java +++ b/client/src/main/java/com/aapeli/multiuser/ChatBase.java @@ -119,8 +119,8 @@ public void openPlayerCard(String var1) { public void adminCommand(String var1, String var2) { ChatListener[] var3 = this.getChatListenersCopy(); - for (int var4 = 0; var4 < var3.length; ++var4) { - var3[var4].localUserAdminCommand(var1, var2); + for (ChatListener chatListener : var3) { + chatListener.localUserAdminCommand(var1, var2); } } @@ -128,8 +128,8 @@ public void adminCommand(String var1, String var2) { public void adminCommand(String var1, String var2, String var3) { ChatListener[] var4 = this.getChatListenersCopy(); - for (int var5 = 0; var5 < var4.length; ++var5) { - var4[var5].localUserAdminCommand(var1, var2, var3); + for (ChatListener chatListener : var4) { + chatListener.localUserAdminCommand(var1, var2, var3); } } @@ -568,8 +568,8 @@ private void sendMessage() { if (message.length() > 0) { ChatListener[] var4 = this.getChatListenersCopy(); if (var2 != null) { - for (int var10 = 0; var10 < var4.length; ++var10) { - var4[var10].localUserSayPrivately(var2, message); + for (ChatListener chatListener : var4) { + chatListener.localUserSayPrivately(var2, message); } this.chatTextArea.addOwnSayPrivately(this.aString2355, var2, message); @@ -586,8 +586,8 @@ private void sendMessage() { } else { var6 = this.gui_globaloutput.method914(); - for (int var7 = 0; var7 < var4.length; ++var7) { - ((GlobalChatListener) var4[var7]).localUserSay(var6, message); + for (ChatListener chatListener : var4) { + ((GlobalChatListener) chatListener).localUserSay(var6, message); } } } diff --git a/client/src/main/java/com/aapeli/multiuser/ChatTextArea.java b/client/src/main/java/com/aapeli/multiuser/ChatTextArea.java index 449fa0ed..e1359ffb 100644 --- a/client/src/main/java/com/aapeli/multiuser/ChatTextArea.java +++ b/client/src/main/java/com/aapeli/multiuser/ChatTextArea.java @@ -148,7 +148,7 @@ private int method858(int var1) { private int method859(String var1, int var2) { Integer var3 = this.aHashtable4730.get(var1); - return var3 == null ? var2 : var3.intValue(); + return var3 == null ? var2 : var3; } private String method860(String var1, boolean var2) { @@ -195,7 +195,7 @@ private String method862(String var1, boolean var2) { } static { - DEFAULT_FONT = new Font("Dialog", 0, 12); - SMALL_FONT = new Font("Dialog", 0, 11); + DEFAULT_FONT = new Font("Dialog", Font.PLAIN, 12); + SMALL_FONT = new Font("Dialog", Font.PLAIN, 11); } } diff --git a/client/src/main/java/com/aapeli/multiuser/CopyChatFrame.java b/client/src/main/java/com/aapeli/multiuser/CopyChatFrame.java index a96f3f4c..5822691b 100644 --- a/client/src/main/java/com/aapeli/multiuser/CopyChatFrame.java +++ b/client/src/main/java/com/aapeli/multiuser/CopyChatFrame.java @@ -83,11 +83,11 @@ private String getChatText(ColorTextArea colorTextArea) { int linesCount = lines.length; StringBuffer sb = new StringBuffer(linesCount * 20); - for (int i = 0; i < linesCount; ++i) { - int lineLength = lines[i].length(); + for (String line : lines) { + int lineLength = line.length(); for (int j = 0; j < lineLength; ++j) { - char chr = lines[i].charAt(j); + char chr = line.charAt(j); if (chr == '<') { chr = '{'; } else if (chr == '>') { diff --git a/client/src/main/java/com/aapeli/multiuser/GlobalTextArea.java b/client/src/main/java/com/aapeli/multiuser/GlobalTextArea.java index 09e5bb8b..02ac8d03 100644 --- a/client/src/main/java/com/aapeli/multiuser/GlobalTextArea.java +++ b/client/src/main/java/com/aapeli/multiuser/GlobalTextArea.java @@ -7,7 +7,6 @@ import java.awt.Color; import java.awt.Dimension; -import java.awt.LayoutManager; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; @@ -98,8 +97,8 @@ protected void method917(int var1, String var2) { protected void method918(String var1) { ChatTextArea[] var2 = this.method924(); - for (int var3 = 0; var3 < var2.length; ++var3) { - var2[var3].addSheriffSay(var1); + for (ChatTextArea chatTextArea : var2) { + chatTextArea.addSheriffSay(var1); } } @@ -107,8 +106,8 @@ protected void method918(String var1) { protected void method919(String var1) { ChatTextArea[] var2 = this.method924(); - for (int var3 = 0; var3 < var2.length; ++var3) { - var2[var3].addServerSay(var1); + for (ChatTextArea chatTextArea : var2) { + chatTextArea.addServerSay(var1); } } @@ -116,8 +115,8 @@ protected void method919(String var1) { protected void method920(String var1) { ChatTextArea[] var2 = this.method924(); - for (int var3 = 0; var3 < var2.length; ++var3) { - var2[var3].addLocalizedServerSay(var1); + for (ChatTextArea chatTextArea : var2) { + chatTextArea.addLocalizedServerSay(var1); } } @@ -125,8 +124,8 @@ protected void method920(String var1) { protected void method921(String var1) { ChatTextArea[] var2 = this.method924(); - for (int var3 = 0; var3 < var2.length; ++var3) { - var2[var3].addBroadcastMessage(var1); + for (ChatTextArea chatTextArea : var2) { + chatTextArea.addBroadcastMessage(var1); } } @@ -134,8 +133,8 @@ protected void method921(String var1) { public void clear() { ChatTextArea[] var1 = this.method924(); - for (int var2 = 0; var2 < var1.length; ++var2) { - var1[var2].clear(); + for (ChatTextArea chatTextArea : var1) { + chatTextArea.clear(); } } diff --git a/client/src/main/java/com/aapeli/multiuser/StaffActionFrame.java b/client/src/main/java/com/aapeli/multiuser/StaffActionFrame.java index e304b694..f730601d 100644 --- a/client/src/main/java/com/aapeli/multiuser/StaffActionFrame.java +++ b/client/src/main/java/com/aapeli/multiuser/StaffActionFrame.java @@ -14,7 +14,6 @@ import java.awt.Graphics; import java.awt.Insets; import java.awt.Label; -import java.awt.LayoutManager; import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -85,7 +84,7 @@ public void update(Graphics g) { } if (this.actionType == 4) { - StringDraw.drawStringWithMaxWidth(g, "(Message is displayed to all users after chat is cleared. To avoid any confusion, it\'s highly recommended that some message is provided.)", this.insets.left + 10, 135, -1, this.width - this.insets.right - 10 - this.insets.left - 10); + StringDraw.drawStringWithMaxWidth(g, "(Message is displayed to all users after chat is cleared. To avoid any confusion, it's highly recommended that some message is provided.)", this.insets.left + 10, 135, -1, this.width - this.insets.right - 10 - this.insets.left - 10); } } diff --git a/client/src/main/java/com/aapeli/multiuser/UserList.java b/client/src/main/java/com/aapeli/multiuser/UserList.java index fb2569c3..b69ae081 100644 --- a/client/src/main/java/com/aapeli/multiuser/UserList.java +++ b/client/src/main/java/com/aapeli/multiuser/UserList.java @@ -16,7 +16,6 @@ import java.awt.Font; import java.awt.Graphics; import java.awt.Image; -import java.awt.LayoutManager; import java.awt.Menu; import java.awt.MenuItem; import java.awt.Point; @@ -27,7 +26,6 @@ import java.awt.event.ComponentListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; -import java.awt.event.WindowEvent; import java.net.URL; import java.util.Hashtable; import java.util.StringTokenizer; @@ -504,8 +502,8 @@ public UserListItem getUser(String var1) { if (var2 != null) { int var3 = var2.length; if (var3 > 0) { - for (int var5 = 0; var5 < var3; ++var5) { - UserListItem var4 = (UserListItem) var2[var5].getData(); + for (ColorListItem colorListItem : var2) { + UserListItem var4 = (UserListItem) colorListItem.getData(); if (var4.getNick().equals(var1)) { return var4; } @@ -525,8 +523,8 @@ public UserListItem getLocalUser() { if (var1 != null) { int var2 = var1.length; if (var2 > 0) { - for (int var4 = 0; var4 < var2; ++var4) { - UserListItem var3 = (UserListItem) var1[var4].getData(); + for (ColorListItem colorListItem : var1) { + UserListItem var3 = (UserListItem) colorListItem.getData(); if (var3.isLocal()) { return var3; } @@ -542,11 +540,11 @@ public void removeUser(String var1) { if (var2 != null) { int var3 = var2.length; if (var3 > 0) { - for (int var5 = 0; var5 < var3; ++var5) { - UserListItem var4 = (UserListItem) var2[var5].getData(); + for (ColorListItem colorListItem : var2) { + UserListItem var4 = (UserListItem) colorListItem.getData(); if (var4.getNick().equals(var1)) { - this.aColorList3465.removeItem(var2[var5]); - if (var2[var5].isSelected()) { + this.aColorList3465.removeItem(colorListItem); + if (colorListItem.isSelected()) { this.method932(); } @@ -564,11 +562,11 @@ public UserListItem removeUserNew(String var1) { if (var2 != null) { int var3 = var2.length; if (var3 > 0) { - for (int var5 = 0; var5 < var3; ++var5) { - UserListItem var4 = (UserListItem) var2[var5].getData(); + for (ColorListItem colorListItem : var2) { + UserListItem var4 = (UserListItem) colorListItem.getData(); if (var4.getNick().equals(var1)) { - this.aColorList3465.removeItem(var2[var5]); - if (var2[var5].isSelected()) { + this.aColorList3465.removeItem(colorListItem); + if (colorListItem.isSelected()) { this.method932(); } @@ -585,10 +583,8 @@ public UserListItem removeUserNew(String var1) { public void removeAllUsers() { ColorListItem[] var1 = this.aColorList3465.getAllItems(); if (var1 != null) { - int var2 = var1.length; - - for (int var3 = 0; var3 < var2; ++var3) { - this.method934((UserListItem) var1[var3].getData()); + for (ColorListItem colorListItem : var1) { + this.method934((UserListItem) colorListItem.getData()); } } @@ -860,7 +856,6 @@ private boolean openProfilePage(UserListItem var1) { this.imageManager.getApplet().getAppletContext().showDocument(new URL(var2), var3); } catch (Exception var4) { - ; } return true; @@ -939,7 +934,7 @@ private UserListItem method937(String var1, boolean var2, int var3) { static { aColor3453 = Color.white; aColor3454 = Color.black; - aFont3455 = new Font("Dialog", 0, 9); + aFont3455 = new Font("Dialog", Font.PLAIN, 9); aColor3456 = new Color(224, 224, 224); aColor3457 = new Color(208, 208, 255); } diff --git a/client/src/main/java/com/aapeli/tools/Tools.java b/client/src/main/java/com/aapeli/tools/Tools.java index eddc1f1e..72d0ab36 100644 --- a/client/src/main/java/com/aapeli/tools/Tools.java +++ b/client/src/main/java/com/aapeli/tools/Tools.java @@ -36,7 +36,6 @@ public static boolean forcedRepaint(Component target) { target.repaint(); } catch (Exception var2) { - ; } return false; @@ -73,7 +72,7 @@ public static String changeFromSaveable(String var0) { var2.append('^'); } else { if (var3 != 'd') { - System.out.println("Program error: Tools.changeFromSaveable(\"" + var0 + "\"), " + "unexpected character \'" + var3 + "\' after \'$\'"); + System.out.println("Program error: Tools.changeFromSaveable(\"" + var0 + "\"), " + "unexpected character '" + var3 + "' after '$'"); return null; } @@ -285,7 +284,7 @@ public static void printTimeElapsed(String message) { } sb.append("] ").append(message); - System.out.println(sb.toString()); + System.out.println(sb); } public static String arrayToString(Object[] var0, char var1) { diff --git a/client/src/main/java/com/aapeli/tools/XmlUnit.java b/client/src/main/java/com/aapeli/tools/XmlUnit.java index bcf0ab4f..4cf77846 100644 --- a/client/src/main/java/com/aapeli/tools/XmlUnit.java +++ b/client/src/main/java/com/aapeli/tools/XmlUnit.java @@ -73,11 +73,10 @@ public XmlUnit[] getChildren() { public XmlUnit[] getChildren(String name) { XmlUnit[] children = this.getChildren(); - int childrenCount = children.length; int var4 = 0; - for (int index = 0; index < childrenCount; ++index) { - if (children[index].getName().equals(name)) { + for (XmlUnit xmlUnit : children) { + if (xmlUnit.getName().equals(name)) { ++var4; } } @@ -85,9 +84,9 @@ public XmlUnit[] getChildren(String name) { XmlUnit[] childrenArray = new XmlUnit[var4]; int var6 = 0; - for (int index = 0; index < childrenCount; ++index) { - if (children[index].getName().equals(name)) { - childrenArray[var6] = children[index]; + for (XmlUnit child : children) { + if (child.getName().equals(name)) { + childrenArray[var6] = child; ++var6; } } @@ -211,7 +210,7 @@ private static XmlUnit method1876(String var0, boolean var1) throws Exception { } if (!var10) { - throw new Exception("Unexpected character \'" + var9 + "\'"); + throw new Exception("Unexpected character '" + var9 + "'"); } if (var11) { @@ -294,7 +293,7 @@ private static int method1877(XmlUnit var0, String var1, int var2, int var3) thr } } while (var9); - throw new Exception("Unexpected character \'" + var8 + "\' in attributes"); + throw new Exception("Unexpected character '" + var8 + "' in attributes"); } private static int method1878(StringBuffer var0, String var1, int var2) { diff --git a/client/src/main/java/org/moparforia/client/MD5Checksum.java b/client/src/main/java/org/moparforia/client/MD5Checksum.java index 8ccd376b..250dc9a1 100644 --- a/client/src/main/java/org/moparforia/client/MD5Checksum.java +++ b/client/src/main/java/org/moparforia/client/MD5Checksum.java @@ -1,9 +1,5 @@ package org.moparforia.client; -/** - * Playforia - * 3.6.2013 - */ import java.io.*; import java.security.MessageDigest; @@ -14,8 +10,8 @@ public static String getMD5Checksum(byte[] data) throws Exception { byte[] digest = complete.digest(data); String result = ""; - for (int i=0; i < digest.length; i++) { - result += Integer.toString( ( digest[i] & 0xff ) + 0x100, 16).substring( 1 ); + for (byte b : digest) { + result += Integer.toString((b & 0xff) + 0x100, 16).substring(1); } return result; } @@ -44,13 +40,13 @@ public static String getMD5Checksum(String filename) throws Exception { byte[] b = createChecksum(filename); String result = ""; - for (int i=0; i < b.length; i++) { - result += Integer.toString( ( b[i] & 0xff ) + 0x100, 16).substring( 1 ); + for (byte value : b) { + result += Integer.toString((value & 0xff) + 0x100, 16).substring(1); } return result; } - public static void main(String args[]) { + public static void main(String[] args) { try { System.out.println(getMD5Checksum("apache-tomcat-5.5.17.exe")); // output : diff --git a/client/src/main/java/org/moparforia/client/TrackDumper.java b/client/src/main/java/org/moparforia/client/TrackDumper.java index 4086704c..ad1680a7 100644 --- a/client/src/main/java/org/moparforia/client/TrackDumper.java +++ b/client/src/main/java/org/moparforia/client/TrackDumper.java @@ -6,10 +6,6 @@ import java.io.FileOutputStream; import java.io.PrintStream; -/** - * Playforia - * 3.6.2013 - */ public class TrackDumper implements ConnListener { static int track_basic = 1; @@ -31,7 +27,7 @@ public TrackDumper(int track_type, String map_dir) { System.out.println("started downloading " + track_type + " into " + map_dir); } - public static void main(String args[]) { + public static void main(String[] args) { new TrackDumper(track_basic, "tracks/basic/"); new TrackDumper(track_traditional, "tracks/traditional/"); new TrackDumper(track_modern, "tracks/modern/"); diff --git a/client/src/main/java/org/moparforia/client/recordz.java b/client/src/main/java/org/moparforia/client/recordz.java index e4805f8b..2a14877e 100644 --- a/client/src/main/java/org/moparforia/client/recordz.java +++ b/client/src/main/java/org/moparforia/client/recordz.java @@ -3,10 +3,6 @@ import java.io.*; import java.util.ArrayList; -/** - * Playforia - * 7.7.2013 - */ public class recordz { public static final void main(String[] args) throws Exception { @@ -42,7 +38,7 @@ else if(line.startsWith("R ")) } private static File[] listTracks(String dir) { - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList<>(); File dirfile = new File(dir); for(File subdir : dirfile.listFiles()) { if(subdir.isDirectory()) { diff --git a/client/src/main/java/org/moparforia/client/trackdump/Connection.java b/client/src/main/java/org/moparforia/client/trackdump/Connection.java index c99b0a4c..bc9df0ac 100644 --- a/client/src/main/java/org/moparforia/client/trackdump/Connection.java +++ b/client/src/main/java/org/moparforia/client/trackdump/Connection.java @@ -81,9 +81,7 @@ public void run() { } } while (this.anInt1613 != 4); } catch (Exception var2) { - ; } catch (Error var3) { - ; } this.method1792(); @@ -364,7 +362,6 @@ private String readLine() { } catch (InterruptedIOException var2) { return null; } catch (IOException var3) { - ; } this.method1783(); @@ -386,7 +383,6 @@ private void method1791() { try { Thread.sleep(3000L); } catch (InterruptedException var4) { - ; } if (this.anInt1613 != 3) { @@ -410,7 +406,6 @@ private void method1792() { try { this.in.close(); } catch (IOException var4) { - ; } this.in = null; @@ -420,7 +415,6 @@ private void method1792() { try { this.out.close(); } catch (IOException var3) { - ; } this.out = null; @@ -430,7 +424,6 @@ private void method1792() { try { this.aSocket1617.close(); } catch (IOException var2) { - ; } this.aSocket1617 = null; diff --git a/client/src/test/java/org/moparforia/client/LauncherCLITest.java b/client/src/test/java/org/moparforia/client/LauncherCLITest.java index 68dffce1..81fb0069 100644 --- a/client/src/test/java/org/moparforia/client/LauncherCLITest.java +++ b/client/src/test/java/org/moparforia/client/LauncherCLITest.java @@ -13,7 +13,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals; -import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.*; /** From 055acc9c0215a083d636cd32392bb26faf872e94 Mon Sep 17 00:00:00 2001 From: Sten Laane <21343173+StenAL@users.noreply.github.com> Date: Tue, 28 May 2024 12:56:28 +0300 Subject: [PATCH 5/6] Client: Remove all unused imports --- client/src/main/java/agolf/GameApplet.java | 11 +++++++++-- .../src/main/java/agolf/TrackTestLoginPanel.java | 12 ++++++++++-- .../java/agolf/game/GameBackgroundCanvas.java | 5 ++++- client/src/main/java/agolf/game/GameCanvas.java | 13 ++++++++++--- .../java/agolf/lobby/LobbyMultiPlayerPanel.java | 6 +++++- client/src/main/java/agolf/lobby/LobbyPanel.java | 3 ++- .../java/agolf/lobby/LobbySinglePlayerPanel.java | 6 +++++- .../src/main/java/com/aapeli/applet/AdCanvas.java | 8 +++++++- .../src/main/java/com/aapeli/bigtext/BigText.java | 1 - .../main/java/com/aapeli/bigtext/MediumText.java | 2 -- .../java/com/aapeli/client/BadWordFilter.java | 1 - .../src/main/java/com/aapeli/client/Class79.java | 3 --- .../src/main/java/com/aapeli/client/Class80.java | 2 -- .../src/main/java/com/aapeli/client/Class81.java | 2 -- .../main/java/com/aapeli/client/Frame_Sub3.java | 3 --- .../java/com/aapeli/client/Frame_Sub3_Sub3.java | 6 ------ .../src/main/java/com/aapeli/client/HtmlText.java | 3 --- .../main/java/com/aapeli/client/ImageManager.java | 4 +++- .../java/com/aapeli/client/ImageResource.java | 2 +- .../main/java/com/aapeli/client/ImageTracker.java | 2 +- .../main/java/com/aapeli/client/Panel_Sub24.java | 6 ------ .../main/java/com/aapeli/colorgui/Choicer.java | 5 ++++- .../main/java/com/aapeli/colorgui/Class90.java | 1 - .../main/java/com/aapeli/colorgui/Class91.java | 2 -- .../main/java/com/aapeli/colorgui/Class92.java | 1 - .../main/java/com/aapeli/colorgui/Class93.java | 2 -- .../main/java/com/aapeli/colorgui/Class95.java | 1 - .../java/com/aapeli/colorgui/ColorButton.java | 2 -- .../com/aapeli/colorgui/ColorCheckboxGroup.java | 2 -- .../main/java/com/aapeli/colorgui/ColorList.java | 5 ----- .../java/com/aapeli/colorgui/ColorListItem.java | 3 --- .../java/com/aapeli/colorgui/ColorSpinner.java | 1 - .../java/com/aapeli/colorgui/ColorTextArea.java | 2 -- .../java/com/aapeli/colorgui/RadioButton.java | 3 --- .../com/aapeli/colorgui/RoundRadioButton.java | 3 --- .../src/main/java/com/aapeli/colorgui/TabBar.java | 5 ----- .../main/java/com/aapeli/colorgui/TabBarItem.java | 3 --- .../com/aapeli/multiuser/GlobalChatListener.java | 2 -- .../java/com/aapeli/tools/EncodedXmlReader.java | 6 +++++- .../src/main/java/org/moparforia/client/Game.java | 2 +- .../main/java/org/moparforia/client/Launcher.java | 14 +++++++++++--- .../java/org/moparforia/client/MD5Checksum.java | 3 ++- .../java/org/moparforia/client/TrackDumper.java | 3 ++- .../main/java/org/moparforia/client/recordz.java | 6 +++++- .../moparforia/client/trackdump/Connection.java | 10 +++++++++- .../org/moparforia/client/LauncherCLITest.java | 15 +++++++++++++-- 46 files changed, 109 insertions(+), 94 deletions(-) diff --git a/client/src/main/java/agolf/GameApplet.java b/client/src/main/java/agolf/GameApplet.java index b255a0f7..f5d7158e 100644 --- a/client/src/main/java/agolf/GameApplet.java +++ b/client/src/main/java/agolf/GameApplet.java @@ -4,10 +4,17 @@ import agolf.game.GamePanel; import agolf.lobby.LobbyPanel; import com.aapeli.applet.AApplet; -import com.aapeli.client.*; +import com.aapeli.client.AutoPopups; +import com.aapeli.client.BadWordFilter; +import com.aapeli.client.ImageManager; +import com.aapeli.client.Parameters; +import com.aapeli.client.SoundManager; +import com.aapeli.client.TextManager; import org.moparforia.client.Launcher; -import java.awt.*; +import java.awt.Color; +import java.awt.Font; +import java.awt.Image; public class GameApplet extends AApplet { diff --git a/client/src/main/java/agolf/TrackTestLoginPanel.java b/client/src/main/java/agolf/TrackTestLoginPanel.java index 4c16e53e..5dfec463 100644 --- a/client/src/main/java/agolf/TrackTestLoginPanel.java +++ b/client/src/main/java/agolf/TrackTestLoginPanel.java @@ -2,8 +2,16 @@ import com.aapeli.multiuser.UsernameValidator; -import java.awt.*; -import java.awt.event.*; +import java.awt.Button; +import java.awt.Color; +import java.awt.Graphics; +import java.awt.Label; +import java.awt.Panel; +import java.awt.TextField; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; class TrackTestLoginPanel extends Panel implements ActionListener, KeyListener { diff --git a/client/src/main/java/agolf/game/GameBackgroundCanvas.java b/client/src/main/java/agolf/game/GameBackgroundCanvas.java index 2f2ef495..a107ee44 100644 --- a/client/src/main/java/agolf/game/GameBackgroundCanvas.java +++ b/client/src/main/java/agolf/game/GameBackgroundCanvas.java @@ -3,7 +3,10 @@ import agolf.GameApplet; import agolf.GameContainer; -import java.awt.*; +import java.awt.Canvas; +import java.awt.Color; +import java.awt.Graphics; +import java.awt.Image; import java.util.StringTokenizer; public class GameBackgroundCanvas extends Canvas { diff --git a/client/src/main/java/agolf/game/GameCanvas.java b/client/src/main/java/agolf/game/GameCanvas.java index 1dc94f32..3afb6412 100644 --- a/client/src/main/java/agolf/game/GameCanvas.java +++ b/client/src/main/java/agolf/game/GameCanvas.java @@ -3,13 +3,20 @@ import agolf.GameContainer; import agolf.Seed; import agolf.SynchronizedBool; - import com.aapeli.client.Parameters; import com.aapeli.client.StringDraw; import com.aapeli.tools.Tools; -import java.awt.*; -import java.awt.event.*; +import java.awt.Color; +import java.awt.Cursor; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.Image; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionListener; import java.util.Arrays; import java.util.StringTokenizer; import java.util.Vector; diff --git a/client/src/main/java/agolf/lobby/LobbyMultiPlayerPanel.java b/client/src/main/java/agolf/lobby/LobbyMultiPlayerPanel.java index c0383868..1589018c 100644 --- a/client/src/main/java/agolf/lobby/LobbyMultiPlayerPanel.java +++ b/client/src/main/java/agolf/lobby/LobbyMultiPlayerPanel.java @@ -5,7 +5,11 @@ import com.aapeli.client.FilterTextField; import com.aapeli.client.InputTextField; import com.aapeli.client.StringDraw; -import com.aapeli.colorgui.*; +import com.aapeli.colorgui.Choicer; +import com.aapeli.colorgui.ColorButton; +import com.aapeli.colorgui.MultiColorList; +import com.aapeli.colorgui.MultiColorListItem; +import com.aapeli.colorgui.MultiColorListListener; import java.awt.Color; import java.awt.Graphics; diff --git a/client/src/main/java/agolf/lobby/LobbyPanel.java b/client/src/main/java/agolf/lobby/LobbyPanel.java index c25cbfd7..48740a41 100644 --- a/client/src/main/java/agolf/lobby/LobbyPanel.java +++ b/client/src/main/java/agolf/lobby/LobbyPanel.java @@ -6,7 +6,8 @@ import com.aapeli.multiuser.UserListItem; import org.moparforia.client.Launcher; -import java.awt.*; +import java.awt.Graphics; +import java.awt.Panel; public class LobbyPanel extends Panel { diff --git a/client/src/main/java/agolf/lobby/LobbySinglePlayerPanel.java b/client/src/main/java/agolf/lobby/LobbySinglePlayerPanel.java index 33f0746a..fa9b408d 100644 --- a/client/src/main/java/agolf/lobby/LobbySinglePlayerPanel.java +++ b/client/src/main/java/agolf/lobby/LobbySinglePlayerPanel.java @@ -3,7 +3,11 @@ import agolf.GameApplet; import agolf.GameContainer; import com.aapeli.client.StringDraw; -import com.aapeli.colorgui.*; +import com.aapeli.colorgui.Choicer; +import com.aapeli.colorgui.ColorButton; +import com.aapeli.colorgui.MultiColorList; +import com.aapeli.colorgui.MultiColorListItem; +import com.aapeli.colorgui.MultiColorListListener; import org.moparforia.client.Launcher; import java.awt.Color; diff --git a/client/src/main/java/com/aapeli/applet/AdCanvas.java b/client/src/main/java/com/aapeli/applet/AdCanvas.java index 906c0c5c..366a7b02 100644 --- a/client/src/main/java/com/aapeli/applet/AdCanvas.java +++ b/client/src/main/java/com/aapeli/applet/AdCanvas.java @@ -2,7 +2,13 @@ import com.aapeli.client.Parameters; -import java.awt.*; +import java.awt.Canvas; +import java.awt.Color; +import java.awt.Cursor; +import java.awt.Graphics; +import java.awt.Image; +import java.awt.Point; +import java.awt.Toolkit; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.net.URL; diff --git a/client/src/main/java/com/aapeli/bigtext/BigText.java b/client/src/main/java/com/aapeli/bigtext/BigText.java index 2327be02..85414141 100644 --- a/client/src/main/java/com/aapeli/bigtext/BigText.java +++ b/client/src/main/java/com/aapeli/bigtext/BigText.java @@ -1,6 +1,5 @@ package com.aapeli.bigtext; -import com.aapeli.bigtext.MediumText; import com.aapeli.client.ImageManager; import java.applet.Applet; diff --git a/client/src/main/java/com/aapeli/bigtext/MediumText.java b/client/src/main/java/com/aapeli/bigtext/MediumText.java index a5fdca20..6f3e572c 100644 --- a/client/src/main/java/com/aapeli/bigtext/MediumText.java +++ b/client/src/main/java/com/aapeli/bigtext/MediumText.java @@ -1,7 +1,5 @@ package com.aapeli.bigtext; -import com.aapeli.bigtext.BigText; - import java.awt.Color; public class MediumText extends BigText { diff --git a/client/src/main/java/com/aapeli/client/BadWordFilter.java b/client/src/main/java/com/aapeli/client/BadWordFilter.java index 5b863d57..2ce1e796 100644 --- a/client/src/main/java/com/aapeli/client/BadWordFilter.java +++ b/client/src/main/java/com/aapeli/client/BadWordFilter.java @@ -1,6 +1,5 @@ package com.aapeli.client; -import com.aapeli.client.TextManager; import com.aapeli.tools.Tools; import java.util.StringTokenizer; diff --git a/client/src/main/java/com/aapeli/client/Class79.java b/client/src/main/java/com/aapeli/client/Class79.java index 938195a0..2d3f11c2 100644 --- a/client/src/main/java/com/aapeli/client/Class79.java +++ b/client/src/main/java/com/aapeli/client/Class79.java @@ -1,8 +1,5 @@ package com.aapeli.client; -import com.aapeli.client.Class80; -import com.aapeli.client.HtmlText; - import java.awt.Font; import java.awt.Graphics; import java.util.Vector; diff --git a/client/src/main/java/com/aapeli/client/Class80.java b/client/src/main/java/com/aapeli/client/Class80.java index 10d85fcb..61a4a753 100644 --- a/client/src/main/java/com/aapeli/client/Class80.java +++ b/client/src/main/java/com/aapeli/client/Class80.java @@ -1,7 +1,5 @@ package com.aapeli.client; -import com.aapeli.client.Class79; - import java.awt.Font; import java.awt.Graphics; diff --git a/client/src/main/java/com/aapeli/client/Class81.java b/client/src/main/java/com/aapeli/client/Class81.java index f6808998..20b2064a 100644 --- a/client/src/main/java/com/aapeli/client/Class81.java +++ b/client/src/main/java/com/aapeli/client/Class81.java @@ -1,7 +1,5 @@ package com.aapeli.client; -import com.aapeli.client.HtmlText; - import java.awt.Font; import java.awt.Graphics; diff --git a/client/src/main/java/com/aapeli/client/Frame_Sub3.java b/client/src/main/java/com/aapeli/client/Frame_Sub3.java index cdd532cc..a8964216 100644 --- a/client/src/main/java/com/aapeli/client/Frame_Sub3.java +++ b/client/src/main/java/com/aapeli/client/Frame_Sub3.java @@ -1,8 +1,5 @@ package com.aapeli.client; -import com.aapeli.client.Panel_Sub24; -import com.aapeli.client.TextManager; - import java.awt.Color; import java.awt.Component; import java.awt.Dimension; diff --git a/client/src/main/java/com/aapeli/client/Frame_Sub3_Sub3.java b/client/src/main/java/com/aapeli/client/Frame_Sub3_Sub3.java index 173c7195..d3aa5b3d 100644 --- a/client/src/main/java/com/aapeli/client/Frame_Sub3_Sub3.java +++ b/client/src/main/java/com/aapeli/client/Frame_Sub3_Sub3.java @@ -1,11 +1,5 @@ package com.aapeli.client; -import com.aapeli.client.Class88; -import com.aapeli.client.Frame_Sub3; -import com.aapeli.client.ImageManager; -import com.aapeli.client.Panel_Sub24; -import com.aapeli.client.TextManager; - import java.awt.Component; class Frame_Sub3_Sub3 extends Frame_Sub3 { diff --git a/client/src/main/java/com/aapeli/client/HtmlText.java b/client/src/main/java/com/aapeli/client/HtmlText.java index 7725a70a..4c0cc8a5 100644 --- a/client/src/main/java/com/aapeli/client/HtmlText.java +++ b/client/src/main/java/com/aapeli/client/HtmlText.java @@ -1,8 +1,5 @@ package com.aapeli.client; -import com.aapeli.client.Class79; -import com.aapeli.client.Class81; - import java.awt.Graphics; import java.util.Vector; diff --git a/client/src/main/java/com/aapeli/client/ImageManager.java b/client/src/main/java/com/aapeli/client/ImageManager.java index 9d1fcf36..1701f498 100644 --- a/client/src/main/java/com/aapeli/client/ImageManager.java +++ b/client/src/main/java/com/aapeli/client/ImageManager.java @@ -4,7 +4,9 @@ import com.aapeli.tools.Tools; import java.applet.Applet; -import java.awt.*; +import java.awt.Component; +import java.awt.Image; +import java.awt.Toolkit; import java.awt.image.MemoryImageSource; import java.awt.image.PixelGrabber; import java.net.MalformedURLException; diff --git a/client/src/main/java/com/aapeli/client/ImageResource.java b/client/src/main/java/com/aapeli/client/ImageResource.java index a4b39725..2600e65a 100644 --- a/client/src/main/java/com/aapeli/client/ImageResource.java +++ b/client/src/main/java/com/aapeli/client/ImageResource.java @@ -1,6 +1,6 @@ package com.aapeli.client; -import java.awt.*; +import java.awt.Image; class ImageResource { diff --git a/client/src/main/java/com/aapeli/client/ImageTracker.java b/client/src/main/java/com/aapeli/client/ImageTracker.java index f32b5197..61639800 100644 --- a/client/src/main/java/com/aapeli/client/ImageTracker.java +++ b/client/src/main/java/com/aapeli/client/ImageTracker.java @@ -4,7 +4,7 @@ import com.aapeli.tools.Tools; import java.applet.Applet; -import java.awt.*; +import java.awt.Image; import java.util.Enumeration; import java.util.Hashtable; import java.util.Vector; diff --git a/client/src/main/java/com/aapeli/client/Panel_Sub24.java b/client/src/main/java/com/aapeli/client/Panel_Sub24.java index 31294319..4f3d9d34 100644 --- a/client/src/main/java/com/aapeli/client/Panel_Sub24.java +++ b/client/src/main/java/com/aapeli/client/Panel_Sub24.java @@ -1,11 +1,5 @@ package com.aapeli.client; -import com.aapeli.client.Class88; -import com.aapeli.client.Frame_Sub3_Sub3; -import com.aapeli.client.ImageManager; -import com.aapeli.client.InputTextField; -import com.aapeli.client.StringDraw; -import com.aapeli.client.TextManager; import com.aapeli.colorgui.ColorButton; import com.aapeli.tools.DelayRepaint; diff --git a/client/src/main/java/com/aapeli/colorgui/Choicer.java b/client/src/main/java/com/aapeli/colorgui/Choicer.java index 40daf99a..35252fd4 100644 --- a/client/src/main/java/com/aapeli/colorgui/Choicer.java +++ b/client/src/main/java/com/aapeli/colorgui/Choicer.java @@ -2,7 +2,10 @@ import com.aapeli.client.IPanel; -import java.awt.*; +import java.awt.Choice; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.ItemSelectable; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; import java.awt.event.ItemEvent; diff --git a/client/src/main/java/com/aapeli/colorgui/Class90.java b/client/src/main/java/com/aapeli/colorgui/Class90.java index 7c121295..67c33d67 100644 --- a/client/src/main/java/com/aapeli/colorgui/Class90.java +++ b/client/src/main/java/com/aapeli/colorgui/Class90.java @@ -1,6 +1,5 @@ package com.aapeli.colorgui; -import com.aapeli.colorgui.ColorButton; import com.aapeli.tools.Tools; class Class90 implements Runnable { diff --git a/client/src/main/java/com/aapeli/colorgui/Class91.java b/client/src/main/java/com/aapeli/colorgui/Class91.java index 6e8ca446..9e4db539 100644 --- a/client/src/main/java/com/aapeli/colorgui/Class91.java +++ b/client/src/main/java/com/aapeli/colorgui/Class91.java @@ -1,8 +1,6 @@ package com.aapeli.colorgui; import com.aapeli.client.StringDraw; -import com.aapeli.colorgui.ColorList; -import com.aapeli.colorgui.ColorListItem; import java.awt.Color; import java.awt.Font; diff --git a/client/src/main/java/com/aapeli/colorgui/Class92.java b/client/src/main/java/com/aapeli/colorgui/Class92.java index 5d77a236..c98cce29 100644 --- a/client/src/main/java/com/aapeli/colorgui/Class92.java +++ b/client/src/main/java/com/aapeli/colorgui/Class92.java @@ -1,6 +1,5 @@ package com.aapeli.colorgui; -import com.aapeli.colorgui.ColorSpinner; import com.aapeli.tools.Tools; class Class92 implements Runnable { diff --git a/client/src/main/java/com/aapeli/colorgui/Class93.java b/client/src/main/java/com/aapeli/colorgui/Class93.java index 0c813744..41077673 100644 --- a/client/src/main/java/com/aapeli/colorgui/Class93.java +++ b/client/src/main/java/com/aapeli/colorgui/Class93.java @@ -1,7 +1,5 @@ package com.aapeli.colorgui; -import com.aapeli.colorgui.ColorTextArea; - import java.awt.Color; class Class93 { diff --git a/client/src/main/java/com/aapeli/colorgui/Class95.java b/client/src/main/java/com/aapeli/colorgui/Class95.java index a076972a..1f9d3df5 100644 --- a/client/src/main/java/com/aapeli/colorgui/Class95.java +++ b/client/src/main/java/com/aapeli/colorgui/Class95.java @@ -1,6 +1,5 @@ package com.aapeli.colorgui; -import com.aapeli.colorgui.RoundButton; import com.aapeli.tools.Tools; class Class95 implements Runnable { diff --git a/client/src/main/java/com/aapeli/colorgui/ColorButton.java b/client/src/main/java/com/aapeli/colorgui/ColorButton.java index 70378a54..c34aacc5 100644 --- a/client/src/main/java/com/aapeli/colorgui/ColorButton.java +++ b/client/src/main/java/com/aapeli/colorgui/ColorButton.java @@ -1,8 +1,6 @@ package com.aapeli.colorgui; import com.aapeli.client.IPanel; -import com.aapeli.colorgui.Class90; -import com.aapeli.colorgui.Class94; import java.awt.Color; import java.awt.Dimension; diff --git a/client/src/main/java/com/aapeli/colorgui/ColorCheckboxGroup.java b/client/src/main/java/com/aapeli/colorgui/ColorCheckboxGroup.java index db2814b1..c6646582 100644 --- a/client/src/main/java/com/aapeli/colorgui/ColorCheckboxGroup.java +++ b/client/src/main/java/com/aapeli/colorgui/ColorCheckboxGroup.java @@ -1,7 +1,5 @@ package com.aapeli.colorgui; -import com.aapeli.colorgui.ColorCheckbox; - import java.util.Enumeration; import java.util.Vector; diff --git a/client/src/main/java/com/aapeli/colorgui/ColorList.java b/client/src/main/java/com/aapeli/colorgui/ColorList.java index 2dcbc1ca..e1c515f2 100644 --- a/client/src/main/java/com/aapeli/colorgui/ColorList.java +++ b/client/src/main/java/com/aapeli/colorgui/ColorList.java @@ -1,10 +1,5 @@ package com.aapeli.colorgui; -import com.aapeli.colorgui.Class91; -import com.aapeli.colorgui.Class94; -import com.aapeli.colorgui.ColorListItem; -import com.aapeli.colorgui.ColorListItemGroup; - import java.awt.Color; import java.awt.Dimension; import java.awt.Font; diff --git a/client/src/main/java/com/aapeli/colorgui/ColorListItem.java b/client/src/main/java/com/aapeli/colorgui/ColorListItem.java index 4e78bd14..81f3c46d 100644 --- a/client/src/main/java/com/aapeli/colorgui/ColorListItem.java +++ b/client/src/main/java/com/aapeli/colorgui/ColorListItem.java @@ -1,8 +1,5 @@ package com.aapeli.colorgui; -import com.aapeli.colorgui.ColorList; -import com.aapeli.colorgui.ColorListItemGroup; - import java.awt.Color; import java.awt.Image; diff --git a/client/src/main/java/com/aapeli/colorgui/ColorSpinner.java b/client/src/main/java/com/aapeli/colorgui/ColorSpinner.java index ddd20b77..ec4e32bf 100644 --- a/client/src/main/java/com/aapeli/colorgui/ColorSpinner.java +++ b/client/src/main/java/com/aapeli/colorgui/ColorSpinner.java @@ -2,7 +2,6 @@ import com.aapeli.client.IPanel; import com.aapeli.client.StringDraw; -import com.aapeli.colorgui.Class92; import java.awt.Color; import java.awt.Dimension; diff --git a/client/src/main/java/com/aapeli/colorgui/ColorTextArea.java b/client/src/main/java/com/aapeli/colorgui/ColorTextArea.java index 0f0fc193..9f9bf104 100644 --- a/client/src/main/java/com/aapeli/colorgui/ColorTextArea.java +++ b/client/src/main/java/com/aapeli/colorgui/ColorTextArea.java @@ -1,8 +1,6 @@ package com.aapeli.colorgui; import com.aapeli.client.IPanel; -import com.aapeli.colorgui.Class93; -import com.aapeli.colorgui.Class94; import java.awt.Color; import java.awt.Dimension; diff --git a/client/src/main/java/com/aapeli/colorgui/RadioButton.java b/client/src/main/java/com/aapeli/colorgui/RadioButton.java index e80bc9e0..4643334f 100644 --- a/client/src/main/java/com/aapeli/colorgui/RadioButton.java +++ b/client/src/main/java/com/aapeli/colorgui/RadioButton.java @@ -1,8 +1,5 @@ package com.aapeli.colorgui; -import com.aapeli.colorgui.ColorButton; -import com.aapeli.colorgui.RadioButtonGroup; - import java.awt.Graphics; import java.awt.Image; import java.awt.event.MouseEvent; diff --git a/client/src/main/java/com/aapeli/colorgui/RoundRadioButton.java b/client/src/main/java/com/aapeli/colorgui/RoundRadioButton.java index fdd98753..a30ad624 100644 --- a/client/src/main/java/com/aapeli/colorgui/RoundRadioButton.java +++ b/client/src/main/java/com/aapeli/colorgui/RoundRadioButton.java @@ -1,8 +1,5 @@ package com.aapeli.colorgui; -import com.aapeli.colorgui.RadioButtonGroup; -import com.aapeli.colorgui.RoundButton; - import java.awt.event.MouseEvent; public class RoundRadioButton extends RoundButton { diff --git a/client/src/main/java/com/aapeli/colorgui/TabBar.java b/client/src/main/java/com/aapeli/colorgui/TabBar.java index bc3ccba0..00132647 100644 --- a/client/src/main/java/com/aapeli/colorgui/TabBar.java +++ b/client/src/main/java/com/aapeli/colorgui/TabBar.java @@ -1,11 +1,6 @@ package com.aapeli.colorgui; import com.aapeli.client.IPanel; -import com.aapeli.colorgui.Class94; -import com.aapeli.colorgui.RadioButton; -import com.aapeli.colorgui.RadioButtonGroup; -import com.aapeli.colorgui.TabBarItem; -import com.aapeli.colorgui.TabBarListener; import java.awt.Color; import java.awt.Component; diff --git a/client/src/main/java/com/aapeli/colorgui/TabBarItem.java b/client/src/main/java/com/aapeli/colorgui/TabBarItem.java index c2a6c964..019a3ae2 100644 --- a/client/src/main/java/com/aapeli/colorgui/TabBarItem.java +++ b/client/src/main/java/com/aapeli/colorgui/TabBarItem.java @@ -1,8 +1,5 @@ package com.aapeli.colorgui; -import com.aapeli.colorgui.RadioButton; -import com.aapeli.colorgui.TabBar; - import java.awt.Component; import java.awt.Image; diff --git a/client/src/main/java/com/aapeli/multiuser/GlobalChatListener.java b/client/src/main/java/com/aapeli/multiuser/GlobalChatListener.java index a9ad84d3..df82d533 100644 --- a/client/src/main/java/com/aapeli/multiuser/GlobalChatListener.java +++ b/client/src/main/java/com/aapeli/multiuser/GlobalChatListener.java @@ -1,7 +1,5 @@ package com.aapeli.multiuser; -import com.aapeli.multiuser.ChatListener; - public interface GlobalChatListener extends ChatListener { void localUserSay(int var1, String var2); diff --git a/client/src/main/java/com/aapeli/tools/EncodedXmlReader.java b/client/src/main/java/com/aapeli/tools/EncodedXmlReader.java index 9ed1ace9..78c2ad6b 100644 --- a/client/src/main/java/com/aapeli/tools/EncodedXmlReader.java +++ b/client/src/main/java/com/aapeli/tools/EncodedXmlReader.java @@ -1,6 +1,10 @@ package com.aapeli.tools; -import java.io.*; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.PushbackInputStream; import java.net.URL; public class EncodedXmlReader { diff --git a/client/src/main/java/org/moparforia/client/Game.java b/client/src/main/java/org/moparforia/client/Game.java index a61a7572..8ebe455f 100644 --- a/client/src/main/java/org/moparforia/client/Game.java +++ b/client/src/main/java/org/moparforia/client/Game.java @@ -2,7 +2,7 @@ import agolf.AGolf; -import javax.swing.*; +import javax.swing.JFrame; import java.applet.Applet; import java.applet.AppletContext; import java.applet.AppletStub; diff --git a/client/src/main/java/org/moparforia/client/Launcher.java b/client/src/main/java/org/moparforia/client/Launcher.java index 7c237c36..c4b20ba4 100644 --- a/client/src/main/java/org/moparforia/client/Launcher.java +++ b/client/src/main/java/org/moparforia/client/Launcher.java @@ -1,12 +1,20 @@ package org.moparforia.client; import com.aapeli.multiuser.UsernameValidator; +import org.moparforia.shared.ManifestVersionProvider; import picocli.CommandLine; -import org.moparforia.shared.ManifestVersionProvider; import javax.imageio.ImageIO; -import javax.swing.*; -import java.awt.*; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JPasswordField; +import javax.swing.JSpinner; +import javax.swing.JTextField; +import javax.swing.SpinnerNumberModel; +import java.awt.GridLayout; +import java.awt.Image; import java.io.IOException; import java.text.ParseException; import java.util.concurrent.Callable; diff --git a/client/src/main/java/org/moparforia/client/MD5Checksum.java b/client/src/main/java/org/moparforia/client/MD5Checksum.java index 250dc9a1..82b231de 100644 --- a/client/src/main/java/org/moparforia/client/MD5Checksum.java +++ b/client/src/main/java/org/moparforia/client/MD5Checksum.java @@ -1,6 +1,7 @@ package org.moparforia.client; -import java.io.*; +import java.io.FileInputStream; +import java.io.InputStream; import java.security.MessageDigest; public class MD5Checksum { diff --git a/client/src/main/java/org/moparforia/client/TrackDumper.java b/client/src/main/java/org/moparforia/client/TrackDumper.java index ad1680a7..5cc9e583 100644 --- a/client/src/main/java/org/moparforia/client/TrackDumper.java +++ b/client/src/main/java/org/moparforia/client/TrackDumper.java @@ -1,6 +1,7 @@ package org.moparforia.client; -import org.moparforia.client.trackdump.*; +import org.moparforia.client.trackdump.ConnListener; +import org.moparforia.client.trackdump.Connection; import java.io.File; import java.io.FileOutputStream; diff --git a/client/src/main/java/org/moparforia/client/recordz.java b/client/src/main/java/org/moparforia/client/recordz.java index 2a14877e..953d0f58 100644 --- a/client/src/main/java/org/moparforia/client/recordz.java +++ b/client/src/main/java/org/moparforia/client/recordz.java @@ -1,6 +1,10 @@ package org.moparforia.client; -import java.io.*; +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileReader; +import java.io.FileWriter; import java.util.ArrayList; public class recordz { diff --git a/client/src/main/java/org/moparforia/client/trackdump/Connection.java b/client/src/main/java/org/moparforia/client/trackdump/Connection.java index bc9df0ac..0090bb0d 100644 --- a/client/src/main/java/org/moparforia/client/trackdump/Connection.java +++ b/client/src/main/java/org/moparforia/client/trackdump/Connection.java @@ -1,6 +1,14 @@ package org.moparforia.client.trackdump; -import java.io.*; +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.InterruptedIOException; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.UnsupportedEncodingException; import java.net.Socket; import java.util.Vector; diff --git a/client/src/test/java/org/moparforia/client/LauncherCLITest.java b/client/src/test/java/org/moparforia/client/LauncherCLITest.java index 81fb0069..c0d7e069 100644 --- a/client/src/test/java/org/moparforia/client/LauncherCLITest.java +++ b/client/src/test/java/org/moparforia/client/LauncherCLITest.java @@ -7,13 +7,24 @@ import org.mockito.junit.jupiter.MockitoExtension; import picocli.CommandLine; -import javax.swing.*; +import javax.swing.JFrame; import java.io.PrintWriter; import java.io.StringWriter; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.anyBoolean; +import static org.mockito.Mockito.anyInt; +import static org.mockito.Mockito.anyString; +import static org.mockito.Mockito.clearInvocations; +import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.doCallRealMethod; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.withSettings; /** * Tests that CLI parsing works as expected, it doesn't test the main method, but it tests the picocli annotations From 2ebcf63643061764b66ba71278018b0d2baf3d40 Mon Sep 17 00:00:00 2001 From: Sten Laane <21343173+StenAL@users.noreply.github.com> Date: Tue, 28 May 2024 12:57:00 +0300 Subject: [PATCH 6/6] Client: Convert UsernameValidator line separators from CRLF to LF All other files in the client project use LF line endings. Done with `find client -type f | xargs dos2unix` --- .../aapeli/multiuser/UsernameValidator.java | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/client/src/main/java/com/aapeli/multiuser/UsernameValidator.java b/client/src/main/java/com/aapeli/multiuser/UsernameValidator.java index 78848f14..8d79f101 100644 --- a/client/src/main/java/com/aapeli/multiuser/UsernameValidator.java +++ b/client/src/main/java/com/aapeli/multiuser/UsernameValidator.java @@ -1,13 +1,13 @@ -package com.aapeli.multiuser; - -import java.util.regex.Pattern; - -public class UsernameValidator { - public static Pattern INVALID_VALID_USERNAME_PATTERN = Pattern.compile("[^a-zA-Z0-9 ]"); - - public static boolean isValidUsername(String username) { - boolean invalid = INVALID_VALID_USERNAME_PATTERN.matcher(username).find() || username.trim().isEmpty(); - return !invalid; - - } -} +package com.aapeli.multiuser; + +import java.util.regex.Pattern; + +public class UsernameValidator { + public static Pattern INVALID_VALID_USERNAME_PATTERN = Pattern.compile("[^a-zA-Z0-9 ]"); + + public static boolean isValidUsername(String username) { + boolean invalid = INVALID_VALID_USERNAME_PATTERN.matcher(username).find() || username.trim().isEmpty(); + return !invalid; + + } +}