diff --git a/client/src/main/java/agolf/game/ChatPanel.java b/client/src/main/java/agolf/game/ChatPanel.java index 1ecfab02..761c7f0b 100644 --- a/client/src/main/java/agolf/game/ChatPanel.java +++ b/client/src/main/java/agolf/game/ChatPanel.java @@ -160,7 +160,7 @@ protected void addBroadcastMessage(String message) { } private void create() { - this.setLayout((LayoutManager) null); + 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.setLocation(0, 0); this.textFieldMessage = new InputTextField(this.gameContainer.textManager.getGame("GameChat_TypeHere"), 200, true); diff --git a/client/src/main/java/agolf/lobby/LobbyChatPanel.java b/client/src/main/java/agolf/lobby/LobbyChatPanel.java index 0944b5ed..ec116849 100644 --- a/client/src/main/java/agolf/lobby/LobbyChatPanel.java +++ b/client/src/main/java/agolf/lobby/LobbyChatPanel.java @@ -69,8 +69,8 @@ protected boolean handlePacket(String[] args) { aBoolean3714 = false;// ?? } } else { - super.gui_output.clear(); - super.gui_userlist.removeAllUsers(); + super.chatTextArea.clear(); + super.userList.removeAllUsers(); } int numSingleLobby = Integer.parseInt(args[2]); @@ -124,7 +124,7 @@ protected boolean handlePacket(String[] args) { message = this.gameContainer.textManager.getGame("LobbyChat_UsersInThisLobbyXX", lobbyUsers, ingameUsers); } - super.gui_output.addPlainMessage(message); + super.chatTextArea.addPlainMessage(message); message = null; if (this.lobbyId == 1 && (dualLobbyUsers >= 1 || multiLobbyUsers >= 1)) { message = "("; @@ -202,10 +202,10 @@ protected boolean handlePacket(String[] args) { } if (message != null) { - super.gui_output.addPlainMessage(message); + super.chatTextArea.addPlainMessage(message); } - super.gui_output.addLine(); + super.chatTextArea.addLine(); return true; } else if(args[1].equals("users")) { @@ -226,7 +226,7 @@ else if(args[1].equals("ownjoin")) { else if(args[1].equals("join") || args[1].equals("joinfromgame")) { String userData = this.userJoin(args[2]); if (!this.isNoJoinPartMessages()) { - super.gui_output.addJoinMessage(this.gameContainer.textManager.getGame("LobbyChat_User" + (args[1].equals("join") ? "Joined" : "ReturnedFromGame"), userData)); + super.chatTextArea.addJoinMessage(this.gameContainer.textManager.getGame("LobbyChat_User" + (args[1].equals("join") ? "Joined" : "ReturnedFromGame"), userData)); } return true; @@ -236,7 +236,7 @@ else if(args[1].equals("part")) { int reason = Integer.parseInt(args[3]); if(reason == 1 && this.lobbyId == 1) { if (!this.isNoGameMessages()) { - super.gui_output.addMessage(this.gameContainer.textManager.getGame("LobbyChat_UserStartedSp", args[2])); + super.chatTextArea.addMessage(this.gameContainer.textManager.getGame("LobbyChat_UserStartedSp", args[2])); } return true; @@ -250,13 +250,13 @@ else if(args[1].equals("part")) { var5 = this.gameContainer.textManager.getGame("LobbyChat_User" + reasons[reason], args[2], args[4]); } - super.gui_output.addMessage(var5); + super.chatTextArea.addMessage(var5); } return true; } else if(reason >= 4) { if (!this.isNoJoinPartMessages()) { - super.gui_output.addPartMessage(this.gameContainer.textManager.getGame("LobbyChat_UserLeft" + (reason == 5 ? "ConnectionProblem" : ""), args[2])); + super.chatTextArea.addPartMessage(this.gameContainer.textManager.getGame("LobbyChat_UserLeft" + (reason == 5 ? "ConnectionProblem" : ""), args[2])); } return true; @@ -266,7 +266,7 @@ else if(args[1].equals("part")) { } else if(args[1].equals("gsn")) { if (!this.isNoGameMessages()) { - super.gui_output.addMessage(this.gameContainer.textManager.getGame("LobbyChat_UsersStartedDp", args[2], args[3])); + super.chatTextArea.addMessage(this.gameContainer.textManager.getGame("LobbyChat_UsersStartedDp", args[2], args[3])); } return true; @@ -297,14 +297,14 @@ else if (args[1].equals("nc")) { protected void getUser(String name, boolean var2) { UserListItem var3; if (name != null) { - var3 = super.gui_userlist.getUser(name); + var3 = super.userList.getUser(name); if (var3 == null) { return; } } else { - var3 = super.gui_userlist.getLocalUser(); + var3 = super.userList.getLocalUser(); } - super.gui_userlist.setNotAcceptingChallenges(var3, var2); + super.userList.setNotAcceptingChallenges(var3, var2); } } diff --git a/client/src/main/java/agolf/lobby/LobbyControlPanel.java b/client/src/main/java/agolf/lobby/LobbyControlPanel.java index 11cdb51b..45cbceb7 100644 --- a/client/src/main/java/agolf/lobby/LobbyControlPanel.java +++ b/client/src/main/java/agolf/lobby/LobbyControlPanel.java @@ -6,7 +6,6 @@ import com.aapeli.colorgui.ColorButton; import java.awt.Graphics; -import java.awt.LayoutManager; import java.awt.Panel; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -14,8 +13,8 @@ class LobbyControlPanel extends Panel implements ActionListener { private GameContainer gameContainer; - private int height; private int width; + private int height; private ColorButton buttonBack; private ColorButton buttonSingle; //private ColorButton buttonDual; @@ -25,8 +24,8 @@ class LobbyControlPanel extends Panel implements ActionListener { protected LobbyControlPanel(GameContainer gameContainer, int width, int height) { this.gameContainer = gameContainer; - this.height = width; - this.width = height; + this.width = width; + this.height = height; this.setSize(width, height); this.create(); } @@ -36,13 +35,13 @@ public void addNotify() { this.repaint(); } - public void paint(Graphics var1) { - this.update(var1); + public void paint(Graphics graphics) { + this.update(graphics); } - public void update(Graphics var1) { - var1.setColor(GameApplet.colourGameBackground); - var1.fillRect(0, 0, this.height, this.width); + public void update(Graphics graphics) { + graphics.setColor(GameApplet.colourGameBackground); + graphics.fillRect(0, 0, this.width, this.height); } public void actionPerformed(ActionEvent evt) { @@ -98,15 +97,15 @@ protected void setState(int state) { } private void create() { - this.setLayout((LayoutManager) null); + this.setLayout(null); this.buttonBack = new ColorButton(this.gameContainer.textManager.getGame("LobbyControl_Main")); this.buttonBack.setBackground(GameApplet.colourButtonYellow); - this.buttonBack.setBounds(0, 0, this.height, 20); + this.buttonBack.setBounds(0, 0, this.width, 20); this.buttonBack.addActionListener(this); this.add(this.buttonBack); if (!this.gameContainer.disableSinglePlayer) { this.buttonSingle = new ColorButton(this.gameContainer.textManager.getGame("LobbyControl_Single")); - this.buttonSingle.setBounds(0, 27, this.height, 20); + this.buttonSingle.setBounds(0, 27, this.width, 20); this.buttonSingle.addActionListener(this); } @@ -117,11 +116,11 @@ private void create() { */ this.buttonMulti = new ColorButton(this.gameContainer.textManager.getGame("LobbyControl_Multi")); - this.buttonMulti.setBounds(0, 77, this.height, 20); + this.buttonMulti.setBounds(0, 77, this.width, 20); this.buttonMulti.addActionListener(this); this.buttonQuit = new ColorButton(this.gameContainer.textManager.getGame("LobbyControl_Quit")); this.buttonQuit.setBackground(GameApplet.colourButtonRed); - this.buttonQuit.setBounds(0, this.width - 20, this.height, 20); + this.buttonQuit.setBounds(0, this.height - 20, this.width, 20); this.buttonQuit.addActionListener(this); this.add(this.buttonQuit); } diff --git a/client/src/main/java/agolf/lobby/LobbyPanel.java b/client/src/main/java/agolf/lobby/LobbyPanel.java index 033b6c04..6358a5c5 100644 --- a/client/src/main/java/agolf/lobby/LobbyPanel.java +++ b/client/src/main/java/agolf/lobby/LobbyPanel.java @@ -6,8 +6,7 @@ import com.aapeli.multiuser.UserListItem; import org.moparforia.client.Launcher; -import java.awt.Graphics; -import java.awt.Panel; +import java.awt.*; public class LobbyPanel extends Panel { @@ -40,13 +39,13 @@ public void addNotify() { this.repaint(); } - public void paint(Graphics var1) { - this.update(var1); + public void paint(Graphics graphics) { + this.update(graphics); } - public void update(Graphics var1) { - var1.setColor(GameApplet.colourGameBackground); - var1.fillRect(0, 0, this.width, this.height); + public void update(Graphics graphics) { + graphics.setColor(GameApplet.colourGameBackground); + graphics.fillRect(0, 0, this.width, this.height); } public void selectLobby(int lobbyId, int lobbyExtra) { @@ -193,17 +192,17 @@ public void handlePacket(String[] args) { } - public void broadcastMessage(String var1) { + public void broadcastMessage(String message) { if (this.lobbyChatPanelSingle != null) { - this.lobbyChatPanelSingle.broadcastMessage(var1); + this.lobbyChatPanelSingle.broadcastMessage(message); } if (this.lobbyChatPanelDual != null) { - this.lobbyChatPanelDual.broadcastMessage(var1); + this.lobbyChatPanelDual.broadcastMessage(message); } if (this.lobbyChatPanelMulti != null) { - this.lobbyChatPanelMulti.broadcastMessage(var1); + this.lobbyChatPanelMulti.broadcastMessage(message); } } @@ -224,9 +223,9 @@ protected void getUser(String name, boolean var2) { this.lobbyChatPanelDual.getUser(name, var2); } - protected boolean isNotAcceptingChallenges(String var1) { - UserListItem var2 = this.lobbyChatPanelDual.gui_userlist.getUser(var1); - return var2 != null ? var2.isNotAcceptingChallenges() : true; + protected boolean isNotAcceptingChallenges(String user) { + UserListItem userItem = this.lobbyChatPanelDual.userList.getUser(user); + return userItem != null ? userItem.isNotAcceptingChallenges() : true; } protected Choicer addChoicerNumTracks(Panel container, int x, int y, int width, int height) { diff --git a/client/src/main/java/com/aapeli/client/UrlLabel.java b/client/src/main/java/com/aapeli/client/UrlLabel.java index 54f68fb6..18e698c3 100644 --- a/client/src/main/java/com/aapeli/client/UrlLabel.java +++ b/client/src/main/java/com/aapeli/client/UrlLabel.java @@ -1,7 +1,5 @@ package com.aapeli.client; -import com.aapeli.client.IPanel; - import java.applet.Applet; import java.awt.Color; import java.awt.Cursor; @@ -22,92 +20,92 @@ public class UrlLabel extends IPanel implements MouseListener { public static final int ALIGN_RIGHT = 1; public static final int TARGET_SAME = 0; public static final int TARGET_NEW = 1; - private static final String[] aStringArray3226 = new String[2]; - private static final Cursor aCursor3227; - private static final Cursor aCursor3228; - private static final Font aFont3229; - private Applet anApplet3230; - private Font aFont3231; - private URL anURL3232; - private String aString3233; - private String aString3234; - private String aString3235; - private int anInt3236; - private int anInt3237; - private int anInt3238; - private int anInt3239; - private Color aColor3240; - private Color aColor3241; - private Color aColor3242; - private Image anImage3243; - private int anInt3244; - private int anInt3245; - private String aString3246; + private static final String[] urlTargets = new String[2]; + private static final Cursor defaultCursor; + private static final Cursor handCursor; + private static final Font fontDialog11; + private Applet applet; + private Font currentFont; + private URL url; + private String text; + private String linkPlaceholderText; + private String suffix; + private int prefixWidth; + private int linkTextWidth; + private int textWidth; + private int alignment; + private Color backgroundColor; + private Color foregroundMainColor; + private Color foregroundSecondaryColor; + private Image backgroundImage; + private int backgroundImageOffsetX; + private int backgroundImageOffsetY; + private String urlTarget; private static final String aString3247 = "Dialog"; - public UrlLabel(Applet var1) { - this(var1, aFont3229, (String) null, (String) null); + public UrlLabel(Applet applet) { + this(applet, fontDialog11, null, null); } - public UrlLabel(Applet var1, String var2, String var3) { - this(var1, aFont3229, var2, var3); + public UrlLabel(Applet applet, String var2, String var3) { + this(applet, fontDialog11, var2, var3); } - public UrlLabel(Applet var1, Font var2, String var3, String var4) { - this.anApplet3230 = var1; - this.aColor3240 = null; - this.aColor3241 = Color.black; - this.aColor3242 = Color.blue; - this.anImage3243 = null; - this.anInt3239 = -1; - this.aString3246 = "_blank"; - this.aFont3231 = var2; + public UrlLabel(Applet applet, Font font, String var3, String var4) { + this.applet = applet; + this.backgroundColor = null; + this.foregroundMainColor = Color.black; + this.foregroundSecondaryColor = Color.blue; + this.backgroundImage = null; + this.alignment = -1; + this.urlTarget = "_blank"; + this.currentFont = font; this.setText(var3, var4); } - public UrlLabel(Applet var1, String var2, String var3, int var4, int var5) { - this(var1, aFont3229, var2, var3); - this.setSize(var4, var5); + public UrlLabel(Applet applet, String var2, String var3, int width, int height) { + this(applet, fontDialog11, var2, var3); + this.setSize(width, height); } - public void update(Graphics var1) { - Dimension var2 = this.getSize(); - int var3 = var2.width; - int var4 = var2.height; - if (this.anImage3243 != null) { - var1.drawImage(this.anImage3243, 0, 0, var3, var4, this.anInt3244, this.anInt3245, this.anInt3244 + var3, this.anInt3245 + var4, this); - } else if (!this.drawBackgroundImage(var1)) { - var1.setColor(this.aColor3240 != null ? this.aColor3240 : this.getBackground()); - var1.fillRect(0, 0, var3, var4); + public void update(Graphics graphics) { + Dimension size = this.getSize(); + int width = size.width; + int height = size.height; + if (this.backgroundImage != null) { + graphics.drawImage(this.backgroundImage, 0, 0, width, height, this.backgroundImageOffsetX, this.backgroundImageOffsetY, this.backgroundImageOffsetX + width, this.backgroundImageOffsetY + height, this); + } else if (!this.drawBackgroundImage(graphics)) { + graphics.setColor(this.backgroundColor != null ? this.backgroundColor : this.getBackground()); + graphics.fillRect(0, 0, width, height); } - if (this.aString3233 != null) { - int var5 = 2; - int var6 = this.aFont3231.getSize(); - int var7 = var4 / 2 + var6 * 3 / 8; - int var8 = var4 / 2 + var6 / 2; - if (this.anInt3239 == 0) { - var5 = var3 / 2 - this.anInt3238 / 2; + if (this.text != null) { + int x = 2; + int fontSize = this.currentFont.getSize(); + int y = height / 2 + fontSize * 3 / 8; + int var8 = height / 2 + fontSize / 2; + if (this.alignment == 0) { + x = width / 2 - this.textWidth / 2; } - if (this.anInt3239 == 1) { - var5 = var3 - 2 - this.anInt3238; + if (this.alignment == 1) { + x = width - 2 - this.textWidth; } - if (this.aString3234 != null && this.aString3235 != null) { - var1.setColor(this.aColor3242); - var1.drawLine(var5 + this.anInt3236, var8, var5 + this.anInt3236 + this.anInt3237, var8); + if (this.linkPlaceholderText != null && this.suffix != null) { + graphics.setColor(this.foregroundSecondaryColor); + graphics.drawLine(x + this.prefixWidth, var8, x + this.prefixWidth + this.linkTextWidth, var8); } - var1.setFont(this.aFont3231); - var1.setColor(this.aColor3241); - var1.drawString(this.aString3233, var5, var7); - if (this.aString3234 != null && this.aString3235 != null) { - var1.setColor(this.aColor3242); - var1.drawString(this.aString3234, var5 + this.anInt3236, var7); - var1.setColor(this.aColor3241); - var1.drawString(this.aString3235, var5 + this.anInt3236 + this.anInt3237, var7); + graphics.setFont(this.currentFont); + graphics.setColor(this.foregroundMainColor); + graphics.drawString(this.text, x, y); + if (this.linkPlaceholderText != null && this.suffix != null) { + graphics.setColor(this.foregroundSecondaryColor); + graphics.drawString(this.linkPlaceholderText, x + this.prefixWidth, y); + graphics.setColor(this.foregroundMainColor); + graphics.drawString(this.suffix, x + this.prefixWidth + this.linkTextWidth, y); } } @@ -123,99 +121,99 @@ public void mousePressed(MouseEvent var1) { } public void mouseReleased(MouseEvent var1) { - this.anApplet3230.getAppletContext().showDocument(this.anURL3232, this.aString3246); + this.applet.getAppletContext().showDocument(this.url, this.urlTarget); } public void mouseClicked(MouseEvent var1) { } - public void setText(String var1, String var2) { - if (var1 == null) { - this.aString3233 = this.aString3234 = this.aString3235 = null; - this.anURL3232 = null; - this.setCursor(aCursor3227); + public void setText(String text, String url) { + if (text == null) { + this.text = this.linkPlaceholderText = this.suffix = null; + this.url = null; + this.setCursor(defaultCursor); this.repaint(); } else { - this.anURL3232 = null; - if (var2 != null) { + this.url = null; + if (url != null) { try { - this.anURL3232 = new URL(var2); - } catch (MalformedURLException var6) { + this.url = new URL(url); + } catch (MalformedURLException e) { ; } } - FontMetrics var3 = this.anApplet3230.getFontMetrics(this.aFont3231); - int var4 = var1.indexOf(60); - int var5 = var1.indexOf(62); - if (this.anURL3232 != null && var4 != -1 && var5 >= var4) { - this.aString3233 = var1.substring(0, var4); - this.aString3234 = var1.substring(var4 + 1, var5); - this.aString3235 = var1.substring(var5 + 1); - this.anInt3236 = var3.stringWidth(this.aString3233); - this.anInt3237 = var3.stringWidth(this.aString3234); - this.anInt3238 = this.anInt3236 + this.anInt3237 + var3.stringWidth(this.aString3235); - this.setCursor(aCursor3228); + FontMetrics fontMetrics = this.applet.getFontMetrics(this.currentFont); + int linkTextStart = text.indexOf('<'); + int linkTextEnd = text.indexOf('>'); + if (this.url != null && linkTextStart != -1 && linkTextEnd >= linkTextStart) { + this.text = text.substring(0, linkTextStart); + this.linkPlaceholderText = text.substring(linkTextStart + 1, linkTextEnd); + this.suffix = text.substring(linkTextEnd + 1); + this.prefixWidth = fontMetrics.stringWidth(this.text); + this.linkTextWidth = fontMetrics.stringWidth(this.linkPlaceholderText); + this.textWidth = this.prefixWidth + this.linkTextWidth + fontMetrics.stringWidth(this.suffix); + this.setCursor(handCursor); this.removeMouseListener(this); this.addMouseListener(this); this.repaint(); } else { - this.aString3233 = var1; - this.anInt3238 = var3.stringWidth(this.aString3233); - this.aString3234 = this.aString3235 = null; - this.setCursor(aCursor3227); + this.text = text; + this.textWidth = fontMetrics.stringWidth(this.text); + this.linkPlaceholderText = this.suffix = null; + this.setCursor(defaultCursor); this.repaint(); } } } - public void setAlign(int var1) { - this.anInt3239 = var1; + public void setAlign(int alignment) { + this.alignment = alignment; this.repaint(); } - public void setForeground(Color var1) { - if (var1 != null) { - int var2 = var1.getRed(); - int var3 = var1.getGreen(); - int var4 = var1.getBlue(); - Color var5 = new Color((var2 * 3 + 0) / 4, (var3 * 3 + 0) / 4, (var4 * 3 + 255) / 4); - this.setForeground(var1, var5); + public void setForeground(Color color) { + if (color != null) { + int r = color.getRed(); + int g = color.getGreen(); + int b = color.getBlue(); + Color secondary = new Color((r * 3 + 0) / 4, (g * 3 + 0) / 4, (b * 3 + 255) / 4); + this.setForeground(color, secondary); } } public void setForeground(Color var1, Color var2) { - this.aColor3241 = var1; - this.aColor3242 = var2; + this.foregroundMainColor = var1; + this.foregroundSecondaryColor = var2; this.repaint(); } - public void setBackground(Color var1) { - this.aColor3240 = var1; + public void setBackground(Color color) { + this.backgroundColor = color; this.repaint(); } - public void setBackgroundImage(Image var1, int var2, int var3) { - this.anImage3243 = var1; - this.anInt3244 = var2; - this.anInt3245 = var3; + public void setBackgroundImage(Image image, int offsetX, int offsetY) { + this.backgroundImage = image; + this.backgroundImageOffsetX = offsetX; + this.backgroundImageOffsetY = offsetY; this.repaint(); } - public void setTarget(int var1) { - this.setTarget(aStringArray3226[var1]); + public void setTarget(int i) { + this.setTarget(urlTargets[i]); } - public void setTarget(String var1) { - this.aString3246 = var1; + public void setTarget(String target) { + this.urlTarget = target; } static { - aStringArray3226[0] = "_top"; - aStringArray3226[1] = "_blank"; - aCursor3227 = new Cursor(0); - aCursor3228 = new Cursor(12); - aFont3229 = new Font("Dialog", 0, 11); + urlTargets[0] = "_top"; + urlTargets[1] = "_blank"; + defaultCursor = new Cursor(Cursor.DEFAULT_CURSOR); + handCursor = new Cursor(Cursor.HAND_CURSOR); + fontDialog11 = new Font("Dialog", Font.PLAIN, 11); } private static char[] method822(String var0) { diff --git a/client/src/main/java/com/aapeli/multiuser/ChatBase.java b/client/src/main/java/com/aapeli/multiuser/ChatBase.java index 16c4e963..6b1544d6 100644 --- a/client/src/main/java/com/aapeli/multiuser/ChatBase.java +++ b/client/src/main/java/com/aapeli/multiuser/ChatBase.java @@ -17,7 +17,6 @@ import java.awt.Dimension; import java.awt.Graphics; import java.awt.Image; -import java.awt.LayoutManager; import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -30,8 +29,8 @@ public abstract class ChatBase extends IPanel implements ComponentListener, User public static final int CIDR_NONE = 0; public static final int CIDR_UNREG = 1; public static final int CIDR_UNCONF = 2; - private static final Color aColor2342; - private static boolean aBoolean2343; + private static final Color sayButtonColor; + private static boolean shouldDisplayChatInputHelp; public Parameters param; public TextManager textManager; public ImageManager imageManager; @@ -45,26 +44,26 @@ public abstract class ChatBase extends IPanel implements ComponentListener, User private int anInt2353; private int anInt2354; private String aString2355; - private int anInt2356; - public UserList gui_userlist; - public ChatTextArea gui_output; + private int chatDisabledStatus; + public UserList userList; + public ChatTextArea chatTextArea; public GlobalTextArea gui_globaloutput; - public InputTextField gui_input; - public Component gui_say; - public UrlLabel gui_idnote; + public InputTextField inputTextField; + public Component sayButton; + public UrlLabel signupMessage; private String aString2357; - private Vector chatListeners; + private Vector chatListeners; private Object synchronizedObject; - public ChatBase(Parameters var1, TextManager var2, ImageManager var3, BadWordFilter var4, boolean var5, boolean var6, int var7, int var8) { - this(var1, var2, var3, var4, true, true, var5, var6, false, var7, var8); + public ChatBase(Parameters parameters, TextManager textManager, ImageManager imageManager, BadWordFilter badWordFilter, boolean useSmallFont, boolean var6, int width, int height) { + this(parameters, textManager, imageManager, badWordFilter, true, true, useSmallFont, var6, false, width, height); } - public ChatBase(Parameters var1, TextManager var2, ImageManager var3, BadWordFilter var4, boolean var5, boolean var6, boolean var7, boolean var8, int var9, int var10) { - this(var1, var2, var3, var4, var5, var6, var7, var8, false, var9, var10); + public ChatBase(Parameters parameters, TextManager textManager, ImageManager imageManager, BadWordFilter badWordFilter, boolean var5, boolean var6, boolean useSmallFont, boolean var8, int width, int height) { + this(parameters, textManager, imageManager, badWordFilter, var5, var6, useSmallFont, var8, false, width, height); } - public ChatBase(Parameters params, TextManager textManager, ImageManager imageManager, BadWordFilter badWordFilter, boolean var5, boolean var6, boolean var7, boolean var8, boolean var9, int width, int height) { + public ChatBase(Parameters params, TextManager textManager, ImageManager imageManager, BadWordFilter badWordFilter, boolean var5, boolean var6, boolean useSmallFont, boolean var8, boolean shouldNotWriteWelcomeMessage, int width, int height) { this.param = params; this.textManager = textManager; this.imageManager = imageManager; @@ -75,10 +74,10 @@ public ChatBase(Parameters params, TextManager textManager, ImageManager imageMa this.height = height; this.setSize(width, height); this.aString2355 = null; - this.anInt2356 = 0; - this.method892(var5, var6, var7, var8, var9); + this.chatDisabledStatus = 0; + this.init(var5, var6, useSmallFont, var8, shouldNotWriteWelcomeMessage); this.addComponentListener(this); - this.chatListeners = new Vector(); + this.chatListeners = new Vector<>(); } public void update(Graphics g) { @@ -106,10 +105,10 @@ public void componentMoved(ComponentEvent var1) { } - public void componentResized(ComponentEvent var1) { - Dimension var2 = this.getSize(); - this.width = var2.width; - this.height = var2.height; + public void componentResized(ComponentEvent event) { + Dimension size = this.getSize(); + this.width = size.width; + this.height = size.height; this.resizeLayout(); } @@ -118,7 +117,7 @@ public void openPlayerCard(String var1) { } public void adminCommand(String var1, String var2) { - ChatListener[] var3 = this.method895(); + ChatListener[] var3 = this.getChatListenersCopy(); for (int var4 = 0; var4 < var3.length; ++var4) { var3[var4].localUserAdminCommand(var1, var2); @@ -127,7 +126,7 @@ public void adminCommand(String var1, String var2) { } public void adminCommand(String var1, String var2, String var3) { - ChatListener[] var4 = this.method895(); + ChatListener[] var4 = this.getChatListenersCopy(); for (int var5 = 0; var5 < var4.length; ++var5) { var4[var5].localUserAdminCommand(var1, var2, var3); @@ -135,15 +134,15 @@ public void adminCommand(String var1, String var2, String var3) { } - public void actionPerformed(ActionEvent var1) { - if (var1.getSource() == this.gui_say) { - this.method893(); + public void actionPerformed(ActionEvent event) { + if (event.getSource() == this.sayButton) { + this.sendMessage(); } } public void startedTyping() { - this.aString2357 = this.method894(); + this.aString2357 = this.getMessageRecipient(); } public void clearedField() { @@ -151,32 +150,32 @@ public void clearedField() { } public void enterPressed() { - this.method893(); + this.sendMessage(); } public static UrlLabel setInputByCIDR(int var0, Container var1, InputTextField var2, Component var3, UrlLabel var4, TextManager var5, Parameters var6) { - return method891(var0, var1, var2, var3, var4, var5.getShared("Chat_NoGuestChatAndRegNote"), var5.getShared("Chat_NoUnconfirmedChatNote"), var6); + return getSignupMessage(var0, var1, var2, var3, var4, var5.getShared("Chat_NoGuestChatAndRegNote"), var5.getShared("Chat_NoUnconfirmedChatNote"), var6); } public void setBackground(Color var1) { - if (this.gui_userlist != null) { - this.gui_userlist.setBackground(var1); + if (this.userList != null) { + this.userList.setBackground(var1); } - if (this.gui_idnote != null) { - this.gui_idnote.setBackground(var1); + if (this.signupMessage != null) { + this.signupMessage.setBackground(var1); } this.repaint(); } public void setForeground(Color var1) { - if (this.gui_userlist != null) { - this.gui_userlist.setForeground(var1); + if (this.userList != null) { + this.userList.setForeground(var1); } - if (this.gui_idnote != null) { - this.gui_idnote.setForeground(var1); + if (this.signupMessage != null) { + this.signupMessage.setForeground(var1); } } @@ -188,8 +187,8 @@ public void setBackgroundImage(Image var1, int var2, int var3) { Point var4 = this.getLocation(); this.anInt2353 = var4.x; this.anInt2354 = var4.y; - Point var5 = this.gui_userlist.getLocation(); - this.gui_userlist.setBackgroundImage(var1, var2 + var5.x, var3 + var5.y); + Point var5 = this.userList.getLocation(); + this.userList.setBackgroundImage(var1, var2 + var5.x, var3 + var5.y); this.repaint(); } @@ -202,14 +201,14 @@ public void removeChatListener(ChatListener var1) { } public void setMessageMaximumLength(int var1) { - this.gui_input.setTextMaximumLength(var1); + this.inputTextField.setTextMaximumLength(var1); } public void clearOutput() { Object var1 = this.synchronizedObject; synchronized (this.synchronizedObject) { if (this.gui_globaloutput == null) { - this.gui_output.clear(); + this.chatTextArea.clear(); } else { this.gui_globaloutput.clear(); } @@ -218,27 +217,27 @@ public void clearOutput() { } public void enablePopUp(boolean isModerator, boolean isAdmin) { - this.gui_userlist.enablePopUp(isModerator, isAdmin); + this.userList.enablePopUp(isModerator, isAdmin); } public void addPlainMessage(String var1) { - this.gui_output.addPlainMessage(var1); + this.chatTextArea.addPlainMessage(var1); } public void addMessage(String var1) { - this.gui_output.addMessage(var1); + this.chatTextArea.addMessage(var1); } public void addHighlightMessage(String var1) { - this.gui_output.addHighlightMessage(var1); + this.chatTextArea.addHighlightMessage(var1); } public void addErrorMessage(String var1) { - this.gui_output.addErrorMessage(var1); + this.chatTextArea.addErrorMessage(var1); } public void addLine() { - this.gui_output.addLine(); + this.chatTextArea.addLine(); } public int setFullUserList(String[] list) { @@ -246,14 +245,14 @@ public int setFullUserList(String[] list) { } public int setFullUserList(String[] list, int var2) { - this.gui_userlist.removeAllUsers(); - int var3 = list.length; + this.userList.removeAllUsers(); + int l = list.length; - for (int var4 = 0; var4 < var3; ++var4) { - this.addToUserList(list[var4], var2 == var4); + for (int i = 0; i < l; ++i) { + this.addToUserList(list[i], var2 == i); } - return var3; + return l; } public String localUserJoin(String var1) { @@ -263,7 +262,7 @@ public String localUserJoin(String var1) { public void userSay(String var1, String var2) { if (!this.isUserIgnored(var1)) { - this.gui_output.addSay(var1, var2); + this.chatTextArea.addSay(var1, var2); } } @@ -277,7 +276,7 @@ public void userSay(int var1, String var2, String var3) { public void userSayPrivately(String var1, String var2) { if (!this.isUserIgnored(var1)) { - this.gui_output.addSayPrivately(var1, this.aString2355, var2); + this.chatTextArea.addSayPrivately(var1, this.aString2355, var2); } } @@ -286,7 +285,7 @@ public void sheriffSay(String var1) { Object var2 = this.synchronizedObject; synchronized (this.synchronizedObject) { if (this.gui_globaloutput == null) { - this.gui_output.addSheriffSay(var1); + this.chatTextArea.addSheriffSay(var1); } else { this.gui_globaloutput.method918(var1); } @@ -317,14 +316,14 @@ public void serverSay(String var1) { } if (var4.length() > 1) { - if ((var12.equals("ServerSay_SheriffGaveWarning") || var12.equals("ServerSay_SheriffMutedUser") || var12.equals("ServerSay_SheriffUnMutedUser")) && var3 != null && !this.gui_userlist.isUser(var3)) { + if ((var12.equals("ServerSay_SheriffGaveWarning") || var12.equals("ServerSay_SheriffMutedUser") || var12.equals("ServerSay_SheriffUnMutedUser")) && var3 != null && !this.userList.isUser(var3)) { return; } Object var13 = this.synchronizedObject; synchronized (this.synchronizedObject) { if (this.gui_globaloutput == null) { - this.gui_output.addLocalizedServerSay(var4); + this.chatTextArea.addLocalizedServerSay(var4); } else { this.gui_globaloutput.method920(var4); } @@ -335,7 +334,7 @@ public void serverSay(String var1) { Object var2 = this.synchronizedObject; synchronized (this.synchronizedObject) { if (this.gui_globaloutput == null) { - this.gui_output.addServerSay(var1); + this.chatTextArea.addServerSay(var1); } else { this.gui_globaloutput.method919(var1); } @@ -344,13 +343,13 @@ public void serverSay(String var1) { } } - public void broadcastMessage(String var1) { + public void broadcastMessage(String message) { Object var2 = this.synchronizedObject; synchronized (this.synchronizedObject) { if (this.gui_globaloutput == null) { - this.gui_output.addBroadcastMessage(var1); + this.chatTextArea.addBroadcastMessage(message); } else { - this.gui_globaloutput.method921(var1); + this.gui_globaloutput.method921(message); } } @@ -361,28 +360,28 @@ public boolean isUserInLobby(String var1) { } public boolean isUserInChat(String var1) { - return this.gui_userlist.getUser(var1) != null; + return this.userList.getUser(var1) != null; } - public boolean isUserIgnored(String var1) { - UserListItem var2 = this.gui_userlist.getUser(var1); - return var2 == null ? true : var2.isIgnore(); + public boolean isUserIgnored(String user) { + UserListItem userItem = this.userList.getUser(user); + return userItem == null ? true : userItem.isIgnore(); } public UserList getUserList() { - return this.gui_userlist; + return this.userList; } public boolean useRoundButtons() { Object var1 = this.synchronizedObject; synchronized (this.synchronizedObject) { - if (this.gui_say instanceof RoundButton) { + if (this.sayButton instanceof RoundButton) { return false; } else { - RoundButton var2 = this.copyColorButtonToRoundButton(this.gui_say); - var2.setVisible(this.gui_say.isVisible()); - this.gui_say = var2; - this.gui_userlist.usePixelRoundedButtonsAndCheckBoxes(); + RoundButton var2 = this.copyColorButtonToRoundButton(this.sayButton); + var2.setVisible(this.sayButton.isVisible()); + this.sayButton = var2; + this.userList.usePixelRoundedButtonsAndCheckBoxes(); return true; } } @@ -392,22 +391,22 @@ public void setOutputToGlobal(int var1) { Object var2 = this.synchronizedObject; synchronized (this.synchronizedObject) { if (this.gui_globaloutput == null) { - Point var3 = this.gui_output.getLocation(); - this.remove(this.gui_output); - this.gui_globaloutput = new GlobalTextArea(this, this.gui_output, var1); + Point var3 = this.chatTextArea.getLocation(); + this.remove(this.chatTextArea); + this.gui_globaloutput = new GlobalTextArea(this, this.chatTextArea, var1); this.gui_globaloutput.setLocation(var3.x, var3.y); this.add(this.gui_globaloutput); } } } - public void disableChatInput(int var1) { - this.anInt2356 = var1; - this.method896(); + public void disableChatInput(int status) { + this.chatDisabledStatus = status; + this.paintSignupMessage(); } public boolean isTyping() { - return this.gui_input.isTyping(); + return this.inputTextField.isTyping(); } public abstract void resizeLayout(); @@ -417,7 +416,7 @@ public String addToUserList(String var1, boolean var2) { } public UserListItem addToUserListNew(String var1, boolean var2) { - UserListItem var3 = this.gui_userlist.addUser(var1, var2); + UserListItem var3 = this.userList.addUser(var1, var2); if (var2) { this.aString2355 = var3.getNick(); } @@ -453,14 +452,14 @@ public String getConfirmationNeededText() { } public void setCurrentOutput(ChatTextArea var1) { - this.gui_output = var1; + this.chatTextArea = var1; } protected void method889(UserListItem var1, String var2) { Object var3 = this.synchronizedObject; synchronized (this.synchronizedObject) { if (this.gui_globaloutput == null) { - this.gui_output.addMessage(var2); + this.chatTextArea.addMessage(var2); } else { this.gui_globaloutput.method917(var1.getLanguage(), var2); } @@ -472,7 +471,7 @@ protected void method890(UserListItem var1, UserListItem var2, String var3) { Object var4 = this.synchronizedObject; synchronized (this.synchronizedObject) { if (this.gui_globaloutput == null) { - this.gui_output.addMessage(var3); + this.chatTextArea.addMessage(var3); } else { int var5 = var1.getLanguage(); int var6 = var2.getLanguage(); @@ -485,95 +484,95 @@ protected void method890(UserListItem var1, UserListItem var2, String var3) { } } - private static UrlLabel method891(int var0, Container var1, InputTextField var2, Component var3, UrlLabel var4, String var5, String var6, Parameters var7) { - if (var0 == 0) { - if (var4 != null) { - var4.setVisible(false); + private static UrlLabel getSignupMessage(int chatDisabledStatus, Container container, InputTextField inputTextField, Component sayButton, UrlLabel signupMessage, String registrationNeededText, String confirmationNeededText, Parameters parameters) { + if (chatDisabledStatus == 0) { + if (signupMessage != null) { + signupMessage.setVisible(false); } - var2.setVisible(true); - var3.setVisible(true); - return var4; + inputTextField.setVisible(true); + sayButton.setVisible(true); + return signupMessage; } else { - if (var4 == null) { - var4 = new UrlLabel(var7.getApplet()); - Point var8 = var2.getLocation(); - Point var9 = var3.getLocation(); - Dimension var10 = var3.getSize(); - var4.setBounds(var8.x, var8.y, var9.x + var10.width - var8.x, var9.y + var10.height - var8.y); - var4.setBackground(var1.getBackground()); - var4.setForeground(var1.getForeground()); - var1.add(var4); + if (signupMessage == null) { + signupMessage = new UrlLabel(parameters.getApplet()); + Point inputFieldLocation = inputTextField.getLocation(); + Point sayButtonLocation = sayButton.getLocation(); + Dimension sayButtonSize = sayButton.getSize(); + signupMessage.setBounds(inputFieldLocation.x, inputFieldLocation.y, sayButtonLocation.x + sayButtonSize.width - inputFieldLocation.x, sayButtonLocation.y + sayButtonSize.height - inputFieldLocation.y); + signupMessage.setBackground(container.getBackground()); + signupMessage.setForeground(container.getForeground()); + container.add(signupMessage); } - var2.setVisible(false); - var3.setVisible(false); - if (var0 == 1) { - var4.setText(var5, var7.getRegisterPage()); - var4.setTarget(0); - } else if (var0 == 2) { - var4.setText(var6, (String) null); + inputTextField.setVisible(false); + sayButton.setVisible(false); + if (chatDisabledStatus == 1) { + signupMessage.setText(registrationNeededText, parameters.getRegisterPage()); + signupMessage.setTarget(0); + } else if (chatDisabledStatus == 2) { + signupMessage.setText(confirmationNeededText, null); } else { - var4.setText((String) null, (String) null); + signupMessage.setText(null, null); } - var4.setVisible(true); - return var4; + signupMessage.setVisible(true); + return signupMessage; } } - private void method892(boolean var1, boolean var2, boolean var3, boolean var4, boolean var5) { - this.setLayout((LayoutManager) null); - this.gui_output = new ChatTextArea(this.textManager, this.badWordFilter, 200, 100, var3 ? ChatTextArea.SMALL_FONT : ChatTextArea.DEFAULT_FONT); - if (aBoolean2343 && !var5) { - this.gui_output.addWelcomeMessage(this.textManager.getShared("Chat_Welcome")); + private void init(boolean var1, boolean var2, boolean useSmallFont, boolean var4, boolean shouldNotWriteWelcomeMessage) { + this.setLayout(null); + this.chatTextArea = new ChatTextArea(this.textManager, this.badWordFilter, 200, 100, useSmallFont ? ChatTextArea.SMALL_FONT : ChatTextArea.DEFAULT_FONT); + if (shouldDisplayChatInputHelp && !shouldNotWriteWelcomeMessage) { + this.chatTextArea.addWelcomeMessage(this.textManager.getShared("Chat_Welcome")); } - this.add(this.gui_output); - if (aBoolean2343) { - this.gui_input = new InputTextField(this.textManager.getShared("Chat_InputHelp"), 200, true); - aBoolean2343 = false; + this.add(this.chatTextArea); + if (shouldDisplayChatInputHelp) { + this.inputTextField = new InputTextField(this.textManager.getShared("Chat_InputHelp"), 200, true); + shouldDisplayChatInputHelp = false; } else { - this.gui_input = new InputTextField(200, true); + this.inputTextField = new InputTextField(200, true); } - this.gui_input.addInputTextFieldListener(this); - this.add(this.gui_input); - ColorButton var6 = new ColorButton(this.textManager.getShared("Chat_SayButton")); - var6.setBackground(aColor2342); - var6.addActionListener(this); - this.add(var6); - this.gui_say = var6; - this.gui_userlist = new UserList(this, this.textManager, this.imageManager, !var4, var1, var2); - this.gui_userlist.setChatReference(this); - this.add(this.gui_userlist); - this.gui_idnote = new UrlLabel(this.param.getApplet()); - this.add(this.gui_idnote); - this.method896(); - } - - private void method893() { + this.inputTextField.addInputTextFieldListener(this); + this.add(this.inputTextField); + ColorButton sayButton = new ColorButton(this.textManager.getShared("Chat_SayButton")); + sayButton.setBackground(sayButtonColor); + sayButton.addActionListener(this); + this.add(sayButton); + this.sayButton = sayButton; + this.userList = new UserList(this, this.textManager, this.imageManager, !var4, var1, var2); + this.userList.setChatReference(this); + this.add(this.userList); + this.signupMessage = new UrlLabel(this.param.getApplet()); + this.add(this.signupMessage); + this.paintSignupMessage(); + } + + private void sendMessage() { if (this.aString2355 != null) { - String var1 = this.gui_input.getText().trim(); - if (var1.length() != 0) { - if (!this.floodProtection.isOkToSay(var1)) { - this.gui_output.addFloodMessage(); + String message = this.inputTextField.getText().trim(); + if (message.length() != 0) { + if (!this.floodProtection.isOkToSay(message)) { + this.chatTextArea.addFloodMessage(); } else { - String var2 = this.method894(); + String var2 = this.getMessageRecipient(); String var3 = this.aString2357; this.aString2357 = null; if (var2 == null && var3 != null && !this.isUserInChat(var3)) { - this.gui_output.addPrivateMessageUserLeftMessage(var3); + this.chatTextArea.addPrivateMessageUserLeftMessage(var3); } else { - var1 = this.gui_input.getInputText(); - if (var1.length() > 0) { - ChatListener[] var4 = this.method895(); + message = this.inputTextField.getInputText(); + if (message.length() > 0) { + ChatListener[] var4 = this.getChatListenersCopy(); if (var2 != null) { for (int var10 = 0; var10 < var4.length; ++var10) { - var4[var10].localUserSayPrivately(var2, var1); + var4[var10].localUserSayPrivately(var2, message); } - this.gui_output.addOwnSayPrivately(this.aString2355, var2, var1); + this.chatTextArea.addOwnSayPrivately(this.aString2355, var2, message); return; } @@ -582,18 +581,18 @@ private void method893() { int var6; if (this.gui_globaloutput == null) { for (var6 = 0; var6 < var4.length; ++var6) { - var4[var6].localUserSay(var1); + var4[var6].localUserSay(message); } } else { var6 = this.gui_globaloutput.method914(); for (int var7 = 0; var7 < var4.length; ++var7) { - ((GlobalChatListener) ((GlobalChatListener) var4[var7])).localUserSay(var6, var1); + ((GlobalChatListener) ((GlobalChatListener) var4[var7])).localUserSay(var6, message); } } } - this.gui_output.addOwnSay(this.aString2355, var1); + this.chatTextArea.addOwnSay(this.aString2355, message); } } @@ -602,28 +601,28 @@ private void method893() { } } - private String method894() { - UserListItem var1 = this.gui_userlist.getSelectedUser(); - return var1 != null && var1.isPrivately() ? var1.getNick() : null; + private String getMessageRecipient() { + UserListItem user = this.userList.getSelectedUser(); + return user != null && user.isPrivately() ? user.getNick() : null; } - private ChatListener[] method895() { - int var1 = this.chatListeners.size(); - ChatListener[] var2 = new ChatListener[var1]; + private ChatListener[] getChatListenersCopy() { + int chatListenersCount = this.chatListeners.size(); + ChatListener[] chatListeners = new ChatListener[chatListenersCount]; - for (int var3 = 0; var3 < var1; ++var3) { - var2[var3] = (ChatListener) ((ChatListener) this.chatListeners.elementAt(var3)); + for (int i = 0; i < chatListenersCount; ++i) { + chatListeners[i] = this.chatListeners.elementAt(i); } - return var2; + return chatListeners; } - private void method896() { - this.gui_idnote = method891(this.anInt2356, this, this.gui_input, this.gui_say, this.gui_idnote, this.getRegisterationNeededText(), this.getConfirmationNeededText(), this.param); + private void paintSignupMessage() { + this.signupMessage = getSignupMessage(this.chatDisabledStatus, this, this.inputTextField, this.sayButton, this.signupMessage, this.getRegisterationNeededText(), this.getConfirmationNeededText(), this.param); } static { - aColor2342 = new Color(144, 144, 224); - aBoolean2343 = true; + sayButtonColor = new Color(144, 144, 224); + shouldDisplayChatInputHelp = true; } } diff --git a/client/src/main/java/com/aapeli/multiuser/ChatLobby.java b/client/src/main/java/com/aapeli/multiuser/ChatLobby.java index 410cb169..5df9d9e1 100644 --- a/client/src/main/java/com/aapeli/multiuser/ChatLobby.java +++ b/client/src/main/java/com/aapeli/multiuser/ChatLobby.java @@ -12,71 +12,71 @@ public class ChatLobby extends ChatBase { - private ColorCheckbox aColorCheckbox3664; - private ColorCheckbox aColorCheckbox3665; - private boolean aBoolean3666; + private ColorCheckbox noJoinAndPartMessagesCheckbox; + private ColorCheckbox noGameMessagesChatbox; + private boolean shouldMuteMessagesIfUserListSet; - public ChatLobby(Parameters var1, TextManager var2, ImageManager var3, BadWordFilter var4, int var5, int var6) { - this(var1, var2, var3, var4, false, false, var5, var6); + public ChatLobby(Parameters parameters, TextManager textManager, ImageManager imageManager, BadWordFilter badWordFilter, int width, int height) { + this(parameters, textManager, imageManager, badWordFilter, false, false, width, height); } - public ChatLobby(Parameters var1, TextManager var2, ImageManager var3, BadWordFilter var4, boolean var5, int var6, int var7) { - this(var1, var2, var3, var4, var5, false, var6, var7); + public ChatLobby(Parameters parameters, TextManager textManager, ImageManager imageManager, BadWordFilter badWordFilter, boolean useSmallFont, int width, int height) { + this(parameters, textManager, imageManager, badWordFilter, useSmallFont, false, width, height); } - public ChatLobby(Parameters var1, TextManager var2, ImageManager var3, BadWordFilter var4, boolean var5, boolean var6, int var7, int var8) { - super(var1, var2, var3, var4, var5, var6, var7, var8); - this.method905(); + public ChatLobby(Parameters parameters, TextManager textManager, ImageManager imageManager, BadWordFilter badWordFilter, boolean useSmallFont, boolean var6, int width, int height) { + super(parameters, textManager, imageManager, badWordFilter, useSmallFont, var6, width, height); + this.createSettingsCheckBoxes(); this.resizeLayout(); - this.aBoolean3666 = true; + this.shouldMuteMessagesIfUserListSet = true; } public void setBackground(Color var1) { super.setBackground(var1); - if (this.aColorCheckbox3664 != null) { - this.aColorCheckbox3664.setBackground(var1); + if (this.noJoinAndPartMessagesCheckbox != null) { + this.noJoinAndPartMessagesCheckbox.setBackground(var1); } - if (this.aColorCheckbox3665 != null) { - this.aColorCheckbox3665.setBackground(var1); + if (this.noGameMessagesChatbox != null) { + this.noGameMessagesChatbox.setBackground(var1); } } public void setForeground(Color var1) { super.setForeground(var1); - if (this.aColorCheckbox3664 != null) { - this.aColorCheckbox3664.setForeground(var1); + if (this.noJoinAndPartMessagesCheckbox != null) { + this.noJoinAndPartMessagesCheckbox.setForeground(var1); } - if (this.aColorCheckbox3665 != null) { - this.aColorCheckbox3665.setForeground(var1); + if (this.noGameMessagesChatbox != null) { + this.noGameMessagesChatbox.setForeground(var1); } } public void setBackgroundImage(Image var1, int var2, int var3) { super.setBackgroundImage(var1, var2, var3); - Point var4 = this.aColorCheckbox3664.getLocation(); - Point var5 = this.aColorCheckbox3665.getLocation(); - this.aColorCheckbox3664.setBackgroundImage(var1, var2 + var4.x, var3 + var4.y); - this.aColorCheckbox3665.setBackgroundImage(var1, var2 + var5.x, var3 + var5.y); + Point var4 = this.noJoinAndPartMessagesCheckbox.getLocation(); + Point var5 = this.noGameMessagesChatbox.getLocation(); + this.noJoinAndPartMessagesCheckbox.setBackgroundImage(var1, var2 + var4.x, var3 + var4.y); + this.noGameMessagesChatbox.setBackgroundImage(var1, var2 + var5.x, var3 + var5.y); } public int setFullUserList(String[] list) { - int var2 = super.setFullUserList(list); - if (this.aBoolean3666) { - if (var2 >= 30) { - this.aColorCheckbox3664.setState(true); - if (var2 >= 40) { - this.aColorCheckbox3665.setState(true); + int users = super.setFullUserList(list); + if (this.shouldMuteMessagesIfUserListSet) { + if (users >= 30) { + this.noJoinAndPartMessagesCheckbox.setState(true); + if (users >= 40) { + this.noGameMessagesChatbox.setState(true); } } - this.aBoolean3666 = false; + this.shouldMuteMessagesIfUserListSet = false; } - return var2; + return users; } public String userJoin(String var1) { @@ -85,7 +85,7 @@ public String userJoin(String var1) { public String userJoin(String var1, boolean var2) { UserListItem var3 = this.addToUserListNew(var1, false); - if (!this.aColorCheckbox3664.getState()) { + if (!this.noJoinAndPartMessagesCheckbox.getState()) { this.method889(var3, super.textManager.getShared("Chat_Lobby_User" + (var2 ? "ReturnedFromGame" : "Joined"), var3.getNick())); } @@ -93,45 +93,45 @@ public String userJoin(String var1, boolean var2) { } public void userLeft(String var1) { - super.gui_userlist.removeUser(var1); + super.userList.removeUser(var1); } public void userLeft(String var1, boolean var2) { - UserListItem var3 = super.gui_userlist.removeUserNew(var1); - if (var3 != null && !this.aColorCheckbox3664.getState()) { + UserListItem var3 = super.userList.removeUserNew(var1); + if (var3 != null && !this.noJoinAndPartMessagesCheckbox.getState()) { this.method889(var3, super.textManager.getShared("Chat_Lobby_UserLeft" + (var2 ? "ConnectionProblem" : ""), var1)); } } public void userLeftCreatedGame(String var1, String var2) { - UserListItem var3 = super.gui_userlist.removeUserNew(var1); - if (var3 != null && !this.aColorCheckbox3665.getState()) { + UserListItem var3 = super.userList.removeUserNew(var1); + if (var3 != null && !this.noGameMessagesChatbox.getState()) { this.method889(var3, super.textManager.getShared("Chat_Lobby_UserCreatedGame", var1, var2)); } } public void userLeftJoinedGame(String var1, String var2) { - UserListItem var3 = super.gui_userlist.removeUserNew(var1); - if (var3 != null && !this.aColorCheckbox3665.getState()) { + UserListItem var3 = super.userList.removeUserNew(var1); + if (var3 != null && !this.noGameMessagesChatbox.getState()) { this.method889(var3, super.textManager.getShared("Chat_Lobby_UserJoinedGame", var1, var2)); } } public void userLeftWatchingGame(String var1, String var2) { - UserListItem var3 = super.gui_userlist.removeUserNew(var1); - if (var3 != null && !this.aColorCheckbox3665.getState()) { + UserListItem var3 = super.userList.removeUserNew(var1); + if (var3 != null && !this.noGameMessagesChatbox.getState()) { this.method889(var3, super.textManager.getShared("Chat_Lobby_UserWathicngGame", var1, var2)); } } public void usersLeftStartedGame(String var1, String var2, String var3) { - UserListItem var4 = super.gui_userlist.removeUserNew(var1); - UserListItem var5 = super.gui_userlist.removeUserNew(var2); - if (var4 != null && var5 != null && !this.aColorCheckbox3665.getState()) { + UserListItem var4 = super.userList.removeUserNew(var1); + UserListItem var5 = super.userList.removeUserNew(var2); + if (var4 != null && var5 != null && !this.noGameMessagesChatbox.getState()) { String var6; if (var3 != null) { var6 = super.textManager.getShared("Chat_Lobby_UsersStartedGame", var1, var2, var3); @@ -149,15 +149,15 @@ public void usersLeftStartedGame(String var1, String var2) { } public UserListItem getSelectedUserForChallenge() { - UserListItem var1 = super.gui_userlist.getSelectedUser(); + UserListItem var1 = super.userList.getSelectedUser(); if (var1 == null) { - super.gui_output.addMessage(super.textManager.getShared("Chat_Lobby_CantChallengeNone")); + super.chatTextArea.addMessage(super.textManager.getShared("Chat_Lobby_CantChallengeNone")); } else { if (!var1.isLocal()) { return var1; } - super.gui_output.addMessage(super.textManager.getShared("Chat_Lobby_CantChallengeSelf")); + super.chatTextArea.addMessage(super.textManager.getShared("Chat_Lobby_CantChallengeSelf")); } return null; @@ -169,52 +169,52 @@ public String getSelectedNickForChallenge() { } public boolean[] getCheckBoxStates() { - boolean[] var1 = new boolean[]{this.aColorCheckbox3664.getState(), this.aColorCheckbox3665.getState()}; + boolean[] var1 = new boolean[]{this.noJoinAndPartMessagesCheckbox.getState(), this.noGameMessagesChatbox.getState()}; return var1; } public void setCheckBoxStates(boolean var1, boolean var2) { - this.aColorCheckbox3664.setState(var1); - this.aColorCheckbox3665.setState(var2); + this.noJoinAndPartMessagesCheckbox.setState(var1); + this.noGameMessagesChatbox.setState(var2); } public boolean isNoJoinPartMessages() { - return this.aColorCheckbox3664.getState(); + return this.noJoinAndPartMessagesCheckbox.getState(); } public boolean isNoGameMessages() { - return this.aColorCheckbox3665.getState(); + return this.noGameMessagesChatbox.getState(); } public synchronized boolean useRoundButtons() { if (!super.useRoundButtons()) { return false; } else { - this.aColorCheckbox3664.setBoxPixelRoundedCorners(true); - this.aColorCheckbox3665.setBoxPixelRoundedCorners(true); + this.noJoinAndPartMessagesCheckbox.setBoxPixelRoundedCorners(true); + this.noGameMessagesChatbox.setBoxPixelRoundedCorners(true); return true; } } public void resizeLayout() { - int var1 = super.width / 5; - if (var1 < 100) { - var1 = 100; + int width = super.width / 5; + if (width < 100) { + width = 100; } - if (var1 > 150) { - var1 = 150; + if (width > 150) { + width = 150; } double var2 = ((double) super.height - 100.0D) / 100.0D; - int var4 = (int) (20.0D + var2 * 5.0D); + int height = (int) (20.0D + var2 * 5.0D); int var5 = (int) (15.0D + var2 * 5.0D); - if (var4 < 20) { - var4 = 20; + if (height < 20) { + height = 20; } - if (var4 > 25) { - var4 = 25; + if (height > 25) { + height = 25; } if (var5 < 15) { @@ -225,8 +225,8 @@ public void resizeLayout() { var5 = 20; } - int var6 = super.width - 0 - 3 - var1 - 0; - int var7 = super.height - 0 - var5 - 3 - var4 - 2 - 0; + int var6 = super.width - 0 - 3 - width - 0; + int var7 = super.height - 0 - var5 - 3 - height - 2 - 0; int var8 = (int) (50.0D + ((double) var6 - 200.0D) / 300.0D * 70.0D); if (var8 < 50) { var8 = 50; @@ -238,29 +238,29 @@ public void resizeLayout() { int var9 = var6 - 1 - var8; int var10 = (var6 - 2) / 2; - super.gui_userlist.setBounds(0, 0, var1, super.height - 0 - 0); + super.userList.setBounds(0, 0, width, super.height - 0 - 0); synchronized (this) { if (super.gui_globaloutput == null) { - super.gui_output.setBounds(0 + var1 + 3, 0, var6, var7); + super.chatTextArea.setBounds(0 + width + 3, 0, var6, var7); } else { - super.gui_globaloutput.setBounds(0 + var1 + 3, 0, var6, var7); + super.gui_globaloutput.setBounds(0 + width + 3, 0, var6, var7); } } - int var11 = 0 + var1 + 3; - int var12 = 0 + var7 + 2; - super.gui_input.setBounds(var11, var12, var9, var4); - int var13 = 0 + var1 + 3 + var9 + 1; - super.gui_say.setBounds(var13, 0 + var7 + 2, var8, var4); - this.aColorCheckbox3664.setBounds(0 + var1 + 3, super.height - 0 - var5, var10, var5); - this.aColorCheckbox3665.setBounds(0 + var1 + 3 + var10 + 2, super.height - 0 - var5, var10, var5); - super.gui_idnote.setBounds(var11, var12, var13 - var11 + var8, var4); + int x = 0 + width + 3; + int y = 0 + var7 + 2; + super.inputTextField.setBounds(x, y, var9, height); + int var13 = 0 + width + 3 + var9 + 1; + super.sayButton.setBounds(var13, 0 + var7 + 2, var8, height); + this.noJoinAndPartMessagesCheckbox.setBounds(0 + width + 3, super.height - 0 - var5, var10, var5); + this.noGameMessagesChatbox.setBounds(0 + width + 3 + var10 + 2, super.height - 0 - var5, var10, var5); + super.signupMessage.setBounds(x, y, var13 - x + var8, height); } - private void method905() { - this.aColorCheckbox3664 = new ColorCheckbox(super.textManager.getShared("Chat_Lobby_NoJoinPartMessages")); - this.add(this.aColorCheckbox3664); - this.aColorCheckbox3665 = new ColorCheckbox(super.textManager.getShared("Chat_Lobby_NoGameMessages")); - this.add(this.aColorCheckbox3665); + private void createSettingsCheckBoxes() { + this.noJoinAndPartMessagesCheckbox = new ColorCheckbox(super.textManager.getShared("Chat_Lobby_NoJoinPartMessages")); + this.add(this.noJoinAndPartMessagesCheckbox); + this.noGameMessagesChatbox = new ColorCheckbox(super.textManager.getShared("Chat_Lobby_NoGameMessages")); + this.add(this.noGameMessagesChatbox); } } diff --git a/client/src/main/java/com/aapeli/multiuser/UserList.java b/client/src/main/java/com/aapeli/multiuser/UserList.java index d290f135..c9ee6c7f 100644 --- a/client/src/main/java/com/aapeli/multiuser/UserList.java +++ b/client/src/main/java/com/aapeli/multiuser/UserList.java @@ -45,10 +45,10 @@ public class UserList extends IPanel implements ComponentListener, ItemListener, private static final Color aColor3456; private static final Color aColor3457; private UserListHandler anUserListHandler3458; - private TextManager aTextManager3459; - private ImageManager anImageManager3460; - private int anInt3461; - private int anInt3462; + private TextManager textManager; + private ImageManager imageManager; + private int width; + private int height; private Image[] anImageArray3463; private boolean aBoolean3464; private ColorList aColorList3465; @@ -93,24 +93,24 @@ public class UserList extends IPanel implements ComponentListener, ItemListener, private Hashtable aHashtable3504; - public UserList(UserListHandler var1, TextManager var2, ImageManager var3, boolean var4, boolean var5, boolean var6) { - this(var1, var2, var3, var4, var5, var6, 100, 200); + public UserList(UserListHandler handler, TextManager textManager, ImageManager imageManager, boolean var4, boolean var5, boolean var6) { + this(handler, textManager, imageManager, var4, var5, var6, 100, 200); } - public UserList(UserListHandler hndlr, TextManager var2, ImageManager var3, boolean var4, boolean var5, boolean var6, int var7, int var8) { - this.anUserListHandler3458 = hndlr; - this.aTextManager3459 = var2; - this.anImageManager3460 = var3; - this.anInt3461 = var7; - this.anInt3462 = var8; - this.setSize(var7, var8); + public UserList(UserListHandler handler, TextManager textManager, ImageManager imageManager, boolean var4, boolean var5, boolean var6, int width, int height) { + this.anUserListHandler3458 = handler; + this.textManager = textManager; + this.imageManager = imageManager; + this.width = width; + this.height = height; + this.setSize(width, height); this.aBoolean3464 = var4; this.method931(var5, var6); this.setBackground(aColor3453); this.setForeground(aColor3454); if (var4) { - Image var9 = var3.getShared("ranking-icons.gif"); - this.anImageArray3463 = var3.separateImages(var9, 14); + Image var9 = imageManager.getShared("ranking-icons.gif"); + this.anImageArray3463 = imageManager.separateImages(var9, 14); } this.isSheriff = false; @@ -118,7 +118,7 @@ public UserList(UserListHandler hndlr, TextManager var2, ImageManager var3, bool this.aVector3497 = new Vector(); this.aVector3498 = new Vector(); this.aBoolean3499 = this.aBoolean3500 = true; - this.aLanguages3503 = new Languages(var2, var3); + this.aLanguages3503 = new Languages(textManager, imageManager); this.aHashtable3504 = new Hashtable(); this.addComponentListener(this); } @@ -134,7 +134,7 @@ public void paint(Graphics var1) { public void update(Graphics var1) { if (this.anImage3470 != null) { - var1.drawImage(this.anImage3470, 0, 0, this.anInt3461, this.anInt3462, this.anInt3472, this.anInt3473, this.anInt3472 + this.anInt3461, this.anInt3473 + this.anInt3462, this); + var1.drawImage(this.anImage3470, 0, 0, this.width, this.height, this.anInt3472, this.anInt3473, this.anInt3472 + this.width, this.anInt3473 + this.height, this); } else { this.drawBackground(var1); } @@ -160,24 +160,24 @@ public void componentMoved(ComponentEvent var1) { public void componentResized(ComponentEvent var1) { Dimension var2 = this.getSize(); - this.anInt3461 = var2.width; - this.anInt3462 = var2.height; + this.width = var2.width; + this.height = var2.height; boolean var3 = this.aColorCheckbox3466 != null; boolean var4 = this.aColorCheckbox3467 != null; if (this.aBoolean3464) { this.aColorButton_Sub1_3468.setSize(17, 11); - this.aColorButton_Sub1_3469.setSize(this.anInt3461 - 17, 11); + this.aColorButton_Sub1_3469.setSize(this.width - 17, 11); } - int var5 = this.anInt3461; - int var6 = this.anInt3462 - (var4 ? 18 : 0) - (var3 ? 18 : 0) - (!var4 && !var3 ? 0 : 2) - (this.aBoolean3464 ? 11 : 0); + int var5 = this.width; + int var6 = this.height - (var4 ? 18 : 0) - (var3 ? 18 : 0) - (!var4 && !var3 ? 0 : 2) - (this.aBoolean3464 ? 11 : 0); this.aColorList3465.setBounds(0, this.aBoolean3464 ? 11 : 0, var5, var6); if (var3) { - this.aColorCheckbox3466.setBounds(0, this.anInt3462 - 18 - (var4 ? 18 : 0), this.anInt3461, 18); + this.aColorCheckbox3466.setBounds(0, this.height - 18 - (var4 ? 18 : 0), this.width, 18); } if (var4) { - this.aColorCheckbox3467.setBounds(0, this.anInt3462 - 18, this.anInt3461, 18); + this.aColorCheckbox3467.setBounds(0, this.height - 18, this.width, 18); } this.componentMoved(var1); @@ -272,7 +272,7 @@ public void actionPerformed(ActionEvent var1) { this.method929(4, (String) null); } else if (var2 == this.aMenuItem3491) { CopyChatFrame var4 = new CopyChatFrame(); - var4.create(this.anImageManager3460.getApplet(), (ColorTextArea) (this.aChatBase3502 != null ? this.aChatBase3502.gui_output : this.aColorTextArea3501)); + var4.create(this.imageManager.getApplet(), (ColorTextArea) (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) { @@ -442,7 +442,7 @@ public UserListItem addUser(String userData, boolean userIsLocal, int var3) { } if (!avatarUrl.equals("-")) { - listItem.loadAvatar(avatarUrl, this.anImageManager3460, this.aColorList3465); + listItem.loadAvatar(avatarUrl, this.imageManager, this.aColorList3465); } return listItem; @@ -461,7 +461,7 @@ public void addUser(UserListItem var1) { String var3 = var1.getNick(); if (var1.isSheriff() && this.aBoolean3499) { - var3 = var3 + " " + this.aTextManager3459.getShared("UserList_Sheriff"); + var3 = var3 + " " + this.textManager.getShared("UserList_Sheriff"); } ColorListItem var4 = new ColorListItem(this.method933(var1), this.method930(var1), var1.isRegistered(), var3, var1, false); @@ -663,7 +663,7 @@ private void showSheriffMenu(UserListItem var1, int var2, int var3) { } this.aPopupMenu3479 = new PopupMenu(); - this.aMenuItem3480 = this.method927(this.aPopupMenu3479, this.aTextManager3459.getShared("UserList_OpenPlayerCard")); + this.aMenuItem3480 = this.method927(this.aPopupMenu3479, this.textManager.getShared("UserList_OpenPlayerCard")); this.aMenuItem3480.setEnabled(var1.isRegistered() || var1.method1826() != null); if (this.aColorCheckbox3466 != null || this.aColorCheckbox3467 != null) { this.aPopupMenu3479.addSeparator(); @@ -735,8 +735,8 @@ private void method929(int var1, String var2) { this.aStaffActionFrame__3496.windowClosing((WindowEvent) null); } - this.aStaffActionFrame__3496 = new StaffActionFrame(this.aTextManager3459, this.anUserListHandler3458, var1, var2); - this.aStaffActionFrame__3496.method251(this.anImageManager3460.getApplet(), this.adminStatus > 0); + this.aStaffActionFrame__3496 = new StaffActionFrame(this.textManager, this.anUserListHandler3458, var1, var2); + this.aStaffActionFrame__3496.method251(this.imageManager.getApplet(), this.adminStatus > 0); } private Color method930(UserListItem var1) { @@ -750,24 +750,24 @@ private Color method930(UserListItem var1) { } private void method931(boolean var1, boolean var2) { - this.setLayout((LayoutManager) null); + this.setLayout(null); if (this.aBoolean3464) { - this.aColorButton_Sub1_3468 = new ColorButton_Sub1(this.aTextManager3459.getShared("UserList_SortByRanking")); + this.aColorButton_Sub1_3468 = new ColorButton_Sub1(this.textManager.getShared("UserList_SortByRanking")); this.aColorButton_Sub1_3468.setBounds(0, 0, 17, 11); this.aColorButton_Sub1_3468.setFont(aFont3455); this.aColorButton_Sub1_3468.setBackground(aColor3456); this.aColorButton_Sub1_3468.addActionListener(this); this.add(this.aColorButton_Sub1_3468); - this.aColorButton_Sub1_3469 = new ColorButton_Sub1(this.aTextManager3459.getShared("UserList_SortByNick")); - this.aColorButton_Sub1_3469.setBounds(17, 0, this.anInt3461 - 17, 11); + this.aColorButton_Sub1_3469 = new ColorButton_Sub1(this.textManager.getShared("UserList_SortByNick")); + this.aColorButton_Sub1_3469.setBounds(17, 0, this.width - 17, 11); this.aColorButton_Sub1_3469.setFont(aFont3455); this.aColorButton_Sub1_3469.setBackground(aColor3457); this.aColorButton_Sub1_3469.addActionListener(this); this.add(this.aColorButton_Sub1_3469); } - int var3 = this.anInt3461; - int var4 = this.anInt3462 - (var2 ? 18 : 0) - (var1 ? 18 : 0) - (!var2 && !var1 ? 0 : 2) - (this.aBoolean3464 ? 11 : 0); + int var3 = this.width; + int var4 = this.height - (var2 ? 18 : 0) - (var1 ? 18 : 0) - (!var2 && !var1 ? 0 : 2) - (this.aBoolean3464 ? 11 : 0); if (this.aBoolean3464) { this.aColorList3465 = new ColorList(var3, var4, 11, 11); } else { @@ -780,15 +780,15 @@ private void method931(boolean var1, boolean var2) { this.add(this.aColorList3465); this.setSorting(1); if (var1) { - this.aColorCheckbox3466 = new ColorCheckbox(this.aTextManager3459.getShared("UserList_Privately")); - this.aColorCheckbox3466.setBounds(0, this.anInt3462 - 18 - (var2 ? 18 : 0), this.anInt3461, 18); + this.aColorCheckbox3466 = new ColorCheckbox(this.textManager.getShared("UserList_Privately")); + this.aColorCheckbox3466.setBounds(0, this.height - 18 - (var2 ? 18 : 0), this.width, 18); this.aColorCheckbox3466.addItemListener(this); this.add(this.aColorCheckbox3466); } if (var2) { - this.aColorCheckbox3467 = new ColorCheckbox(this.aTextManager3459.getShared("UserList_Ignore")); - this.aColorCheckbox3467.setBounds(0, this.anInt3462 - 18, this.anInt3461, 18); + this.aColorCheckbox3467 = new ColorCheckbox(this.textManager.getShared("UserList_Ignore")); + this.aColorCheckbox3467.setBounds(0, this.height - 18, this.width, 18); this.aColorCheckbox3467.addItemListener(this); this.add(this.aColorCheckbox3467); } @@ -853,12 +853,12 @@ private boolean openProfilePage(UserListItem var1) { return false; } else { try { - String var3 = this.aTextManager3459.getParameters().getParameter("guestinfotarget"); + String var3 = this.textManager.getParameters().getParameter("guestinfotarget"); if (var3 == null) { var3 = "_blank"; } - this.anImageManager3460.getApplet().getAppletContext().showDocument(new URL(var2), var3); + this.imageManager.getApplet().getAppletContext().showDocument(new URL(var2), var3); } catch (Exception var4) { ; } @@ -929,7 +929,7 @@ private UserListItem method937(String var1, boolean var2, int var3) { } if (!var16.equals("-")) { - var14.loadAvatar(Tools.changeFromSaveable(var16), this.anImageManager3460, this.aColorList3465); + var14.loadAvatar(Tools.changeFromSaveable(var16), this.imageManager, this.aColorList3465); } }