diff --git a/README.md b/README.md index 28d1d78b..28c0fba2 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ The Java Applet-based Minigolf Client was one of the most popular multiplayer ga ### Reimplementation - Commented out any communication with original Playforia.net servers -- Use local Map store instead of database +- Use local map store instead of database - Added ability to pass IP of server to client - Ability to play on a single computer and hosting a game for up to 4 players in your home network - Removed bad words and custom tracks @@ -37,7 +37,7 @@ The Java Applet-based Minigolf Client was one of the most popular multiplayer ga - Clone this repo: `git clone git@github.com:PhilippvK/playforia-minigolf.git` - Install Java Development Kit 17 (https://adoptium.net/en-GB/temurin/releases/) - Install Apache `maven` for building: https://maven.apache.org/install.html -- *Optional:* Install IntelliJ IDEA Java IDE (https://www.jetbrains.com/idea/download/) and import this reposiory as project +- *Optional:* Install IntelliJ IDEA Java IDE (https://www.jetbrains.com/idea/download/) and import this repository as project ### Building @@ -67,11 +67,18 @@ We provide an experimental Dockerfile for easy hosting of the server application Running the Editor is quite straightforward as it can be started like expected: `java -jar editor.jar` ### CLI options -Both client and server include CLI options for hostname (`-ip`), port (`-p`) settings. To learn about all the available setting you can include help with `-h` parameter. +Common CLI options for both the client and the server: +- `-ip` to set the hostname +- `-p` to set the port +- `-h` to learn about all the available options -To use custom tracks instead of the default set of bundled tracks, use the `--tracks-dir` option when starting the server and point it to where your tracks are located. +Server CLI options: +- `--tracks-dir` to use custom tracks instead of the default set of bundled tracks -If you want to enable debugging messages, add `--verbose` to the list of arguments. +Client CLI options: +- `--verbose` to enable debug logging +- `--norandom` to disable randomization for shots +- `--username` to set username from CLI and skip inputting it ## Compatibility @@ -117,4 +124,4 @@ Tested: Have fun. -If you miss the good old times before Playforia.net went down, Minigolf probably was one of your favourite games. I hope you will have some fun in the single player or with friends with this little crappy piece of oldschool software! +If you miss the good old times before Playforia.net went down, Minigolf probably was one of your favourite games. I hope you will have some fun in the single player or with friends with this little crappy piece of oldschool software! diff --git a/client/src/main/java/agolf/GameApplet.java b/client/src/main/java/agolf/GameApplet.java index 5c99d09e..cf9f31d6 100644 --- a/client/src/main/java/agolf/GameApplet.java +++ b/client/src/main/java/agolf/GameApplet.java @@ -115,12 +115,12 @@ protected int method32() { return this.anInt3769; } - public void setGameState(int var1) {// setGameState..maybe? - this.setGameState(var1, 0, 0); + public void setGameState(int state) { + this.setGameState(state, 0, 0); } - protected void setGameState(int var1, int var2) { - this.setGameState(var1, var2, 0); + protected void setGameState(int state, int lobbyId) { + this.setGameState(state, lobbyId, 0); } protected void setGameState(int panelActive, int lobbyId, int lobbyExtra) { @@ -140,9 +140,14 @@ protected void setGameState(int panelActive, int lobbyId, int lobbyExtra) { //System.out.println(hasSession() + " " + gameContainer.synchronizedTrackTestMode.get()); if (Launcher.isUsingCustomServer()) { - TrackTestLoginPanel var4 = new TrackTestLoginPanel(this, super.appletWidth, super.appletHeight); - var4.setLocation(0, 0); - this.addToContent(var4); + String username = param.getUsername(); + if (username == null) { + TrackTestLoginPanel loginPanel = new TrackTestLoginPanel(this, super.appletWidth, super.appletHeight); + loginPanel.setLocation(0, 0); + this.addToContent(loginPanel); + } else { + this.trackTestLogin(username, ""); + } } else if (this.hasSession()) { super.param.noGuestAutoLogin(); this.gameContainer.connection.writeData("login\t" + super.param.getSession()); diff --git a/client/src/main/java/agolf/TrackTestLoginPanel.java b/client/src/main/java/agolf/TrackTestLoginPanel.java index c290dade..4c16e53e 100644 --- a/client/src/main/java/agolf/TrackTestLoginPanel.java +++ b/client/src/main/java/agolf/TrackTestLoginPanel.java @@ -1,8 +1,9 @@ package agolf; +import com.aapeli.multiuser.UsernameValidator; + import java.awt.*; import java.awt.event.*; -import java.util.regex.Pattern; class TrackTestLoginPanel extends Panel implements ActionListener, KeyListener { @@ -13,7 +14,6 @@ class TrackTestLoginPanel extends Panel implements ActionListener, KeyListener { private TextField textFieldPassword; private Button buttonOk; private Label labelError; - private Pattern pattern; private Label labelName; private Label labelName2; private Label labelPassword; @@ -24,7 +24,6 @@ protected TrackTestLoginPanel(GameApplet gameApplet, int width, int height) { this.width = width; this.height = height; this.setSize(width, height); - pattern = Pattern.compile("[^a-zA-Z0-9 ]"); this.create(); } @@ -51,18 +50,6 @@ public void actionPerformed(ActionEvent evt) { } public void keyPressed(KeyEvent evt) { - if(evt.getKeyCode() == KeyEvent.VK_ENTER && buttonOk.isEnabled()) { - actionPerformed(null); - return; - } - boolean found = pattern.matcher(textFieldName.getText()).find() || textFieldName.getText().trim().equals(""); - if(found) { - labelError.setVisible(true); - buttonOk.setEnabled(false); - } else { - labelError.setVisible(false); - buttonOk.setEnabled(true); - } } private void create() { @@ -74,16 +61,19 @@ private void create() { textFieldName.addKeyListener(this); this.add(this.textFieldName); textFieldName.requestFocus(); + this.textFieldPassword = new TextField("");//("(password)"); this.textFieldPassword.setBounds(this.width / 2 - 75, this.height / 2 - 10, 150, 25); this.textFieldPassword.setBackground(Color.white); this.textFieldPassword.setForeground(Color.black); textFieldPassword.setEchoChar('*'); //this.add(this.textFieldPassword); //Don't show this field + this.buttonOk = new Button("OK"); this.buttonOk.setBounds(this.width / 2 - 75, this.height / 2 + 50, 75, 25); this.buttonOk.addActionListener(this); this.add(this.buttonOk); + labelError = new Label("Only spaces, alphabetical and numerical characters are allowed"); labelError.setBounds(width / 2 - 75, height / 2 - 35, 400, 25); labelError.setForeground(Color.red); @@ -110,5 +100,17 @@ public void keyTyped(KeyEvent e) { } public void keyReleased(KeyEvent e) { + if(e.getKeyCode() == KeyEvent.VK_ENTER && buttonOk.isEnabled()) { + actionPerformed(null); + return; + } + boolean validUsername = UsernameValidator.isValidUsername(textFieldName.getText()); + if (validUsername) { + labelError.setVisible(false); + buttonOk.setEnabled(true); + } else { + labelError.setVisible(true); + buttonOk.setEnabled(false); + } } } diff --git a/client/src/main/java/agolf/game/GameChatPanel.java b/client/src/main/java/agolf/game/ChatPanel.java similarity index 97% rename from client/src/main/java/agolf/game/GameChatPanel.java rename to client/src/main/java/agolf/game/ChatPanel.java index fe7e68a6..1ecfab02 100644 --- a/client/src/main/java/agolf/game/GameChatPanel.java +++ b/client/src/main/java/agolf/game/ChatPanel.java @@ -17,7 +17,7 @@ import java.awt.event.KeyEvent; import java.awt.event.KeyListener; -class GameChatPanel extends Panel implements KeyListener, ActionListener { +class ChatPanel extends Panel implements KeyListener, ActionListener { private static final int[] anIntArray330 = new int[]{3, 1, 4, 2}; private GameContainer gameContainer; @@ -30,7 +30,7 @@ class GameChatPanel extends Panel implements KeyListener, ActionListener { private boolean created; - protected GameChatPanel(GameContainer gameContainer, int width, int height, int gameExtra) { + protected ChatPanel(GameContainer gameContainer, int width, int height, int gameExtra) { this.gameContainer = gameContainer; this.width = width; this.height = height; diff --git a/client/src/main/java/agolf/game/GameControlPanel.java b/client/src/main/java/agolf/game/GameControlPanel.java index 6cd0b660..bc177715 100644 --- a/client/src/main/java/agolf/game/GameControlPanel.java +++ b/client/src/main/java/agolf/game/GameControlPanel.java @@ -17,7 +17,7 @@ class GameControlPanel extends Panel implements ActionListener, ItemListener { private GameContainer gameContainer; - private GamePlayerInfoPanel aGamePlayerInfoPanel__341; + private PlayerInfoPanel playerInfoPanel; private int anInt342; private int anInt343; private int playerCount; @@ -29,9 +29,9 @@ class GameControlPanel extends Panel implements ActionListener, ItemListener { private boolean skipButtonVisible; - protected GameControlPanel(GameContainer var1, GamePlayerInfoPanel var2, int var3, int var4) { + protected GameControlPanel(GameContainer var1, PlayerInfoPanel var2, int var3, int var4) { this.gameContainer = var1; - this.aGamePlayerInfoPanel__341 = var2; + this.playerInfoPanel = var2; this.anInt342 = var3; this.anInt343 = var4; this.setSize(var3, var4); @@ -68,7 +68,7 @@ public void actionPerformed(ActionEvent event) { this.setVisible(false); this.remove(this.buttonNewGame); this.setVisible(true); - this.aGamePlayerInfoPanel__341.readyForNewGameLocal(); + this.playerInfoPanel.readyForNewGameLocal(); this.gameContainer.gamePanel.requestNewGame(); } else if (source == this.buttonBack) { this.buttonBack.removeActionListener(this); diff --git a/client/src/main/java/agolf/game/GamePanel.java b/client/src/main/java/agolf/game/GamePanel.java index 46b74549..dba1d769 100644 --- a/client/src/main/java/agolf/game/GamePanel.java +++ b/client/src/main/java/agolf/game/GamePanel.java @@ -15,10 +15,10 @@ public class GamePanel extends Panel { private GameContainer gameContainer; private int width; private int height; - private GamePlayerInfoPanel gamePlayerInfoPanel; + private PlayerInfoPanel playerInfoPanel; private GameCanvas gameCanvas; - private GameChatPanel gameChatPanel; - private GameTrackInfoPanel gameTrackInfoPanel; + private ChatPanel chatPanel; + private TrackInfoPanel trackInfoPanel; private GameControlPanel gameControlPanel; protected int state; private int playerCount; @@ -81,8 +81,8 @@ public void handlePacket(String[] args) { } this.addMultiPlayerPanels(mode); - this.gamePlayerInfoPanel.init(this.playerCount, trackCount, maxStrokes, strokeTimeout, trackScoring); - this.gameTrackInfoPanel.setNumTracks(trackCount); + this.playerInfoPanel.init(this.playerCount, trackCount, maxStrokes, strokeTimeout, trackScoring); + this.trackInfoPanel.setNumTracks(trackCount); this.gameControlPanel.setPlayerCount(this.playerCount); this.gameCanvas.init(this.playerCount, waterEvent, collision); if (mode == 2) { @@ -131,8 +131,8 @@ public void handlePacket(String[] args) { settings = settings + ", " + (trackCategory == 0 ? "official" : (trackCategory == 1 ? "custom" : "unknown")) + " maps"; }*/ - this.gameChatPanel.addMessage(this.gameContainer.textManager.getGame("GameChat_GameName", gameName)); - this.gameChatPanel.addMessage(this.gameContainer.textManager.getGame("GameChat_GameSettings", settings)); + this.chatPanel.addMessage(this.gameContainer.textManager.getGame("GameChat_GameName", gameName)); + this.chatPanel.addMessage(this.gameContainer.textManager.getGame("GameChat_GameSettings", settings)); } } else if (args[1].equals("scoringmulti")) { @@ -143,7 +143,7 @@ public void handlePacket(String[] args) { trackScoresMultipliers[track] = Integer.parseInt(args[2 + track]); } - this.gamePlayerInfoPanel.setTrackScoresMultipliers(trackScoresMultipliers); + this.playerInfoPanel.setTrackScoresMultipliers(trackScoresMultipliers); } else if (args[1].equals("players")) { int len = (args.length - 2) / 3; int playerCountIndex = 2; @@ -151,8 +151,8 @@ public void handlePacket(String[] args) { for (int trackTypes = 0; trackTypes < len; ++trackTypes) { int playerCount = Integer.parseInt(args[playerCountIndex]);//todo lol why u inside the loop tho String clan = args[playerCountIndex + 2].equals("-") ? null : args[playerCountIndex + 2]; - this.gamePlayerInfoPanel.addPlayer(playerCount, args[playerCountIndex + 1], clan, false); - this.gameChatPanel.setUserColour(args[playerCountIndex + 1], playerCount); + this.playerInfoPanel.addPlayer(playerCount, args[playerCountIndex + 1], clan, false); + this.chatPanel.setUserColour(args[playerCountIndex + 1], playerCount); playerCountIndex += 3; } @@ -160,33 +160,33 @@ public void handlePacket(String[] args) { else if (args[1].equals("owninfo")) { int currentPlayerID = Integer.parseInt(args[2]); String currentPlayerClan = args[4].equals("-") ? null : args[4]; - this.gamePlayerInfoPanel.addPlayer(currentPlayerID, args[3], currentPlayerClan, true); - this.gameChatPanel.setUserColour(args[3], currentPlayerID); + this.playerInfoPanel.addPlayer(currentPlayerID, args[3], currentPlayerClan, true); + this.chatPanel.setUserColour(args[3], currentPlayerID); this.aLong364 = System.currentTimeMillis(); } else if (args[1].equals("join")) { int playerId = Integer.parseInt(args[2]); String playerClan = args[4].equals("-") ? null : args[4]; - this.gamePlayerInfoPanel.addPlayer(playerId, args[3], playerClan, false); - this.gameChatPanel.setUserColour(args[3], playerId); + this.playerInfoPanel.addPlayer(playerId, args[3], playerClan, false); + this.chatPanel.setUserColour(args[3], playerId); if (this.playerCount != 2 || playerId != 1) { - this.gameChatPanel.addMessage(playerClan != null ? this.gameContainer.textManager.getGame("GameChat_JoinClan", args[3], playerClan) : this.gameContainer.textManager.getGame("GameChat_Join", args[3])); + this.chatPanel.addMessage(playerClan != null ? this.gameContainer.textManager.getGame("GameChat_JoinClan", args[3], playerClan) : this.gameContainer.textManager.getGame("GameChat_Join", args[3])); } } else if (args[1].equals("part")) { // player left game int playerId = Integer.parseInt(args[2]); - boolean changed = this.gamePlayerInfoPanel.setPlayerPartStatus(playerId, Integer.parseInt(args[3])); + boolean changed = this.playerInfoPanel.setPlayerPartStatus(playerId, Integer.parseInt(args[3])); if (changed) { this.gameControlPanel.method329(); } - String playerName = this.gamePlayerInfoPanel.playerNames[playerId]; - this.gameChatPanel.addMessage(this.gameContainer.textManager.getGame("GameChat_Part", playerName)); - this.gameChatPanel.removeUserColour(playerName); + String playerName = this.playerInfoPanel.playerNames[playerId]; + this.chatPanel.addMessage(this.gameContainer.textManager.getGame("GameChat_Part", playerName)); + this.chatPanel.removeUserColour(playerName); this.gameControlPanel.refreshBackButton(); } else if (args[1].equals("say")) { int playerId = Integer.parseInt(args[2]); - this.gameChatPanel.addSay(playerId, this.gamePlayerInfoPanel.playerNames[playerId], args[3], false); + this.chatPanel.addSay(playerId, this.playerInfoPanel.playerNames[playerId], args[3], false); } else if (args[1].equals("cr")) { // get results to compare track score against StringTokenizer tokenizer = new StringTokenizer(args[2], ","); int tracks = tokenizer.countTokens(); @@ -202,7 +202,7 @@ else if (args[1].equals("part")) { // player left game } } - this.gamePlayerInfoPanel.initResultsComparison(comparisonScores); + this.playerInfoPanel.initResultsComparison(comparisonScores); } else if (args[1].equals("start")) { if (this.playerCount > 1) { if (this.aBoolean363) { @@ -211,7 +211,7 @@ else if (args[1].equals("part")) { // player left game //this.requestFocus();//todo this is annoying as fuck } - this.gameContainer.gameApplet.showPlayerList(this.gamePlayerInfoPanel.getPlayerNames()); + this.gameContainer.gameApplet.showPlayerList(this.playerInfoPanel.getPlayerNames()); } else { this.gameContainer.gameApplet.removePlayerListWinnders(); } @@ -219,8 +219,8 @@ else if (args[1].equals("part")) { // player left game this.aBoolean363 = false; this.gameCanvas.createMap(16777216); - this.gamePlayerInfoPanel.reset(); - this.gameTrackInfoPanel.resetCurrentTrack(); + this.playerInfoPanel.reset(); + this.trackInfoPanel.resetCurrentTrack(); this.setState(1); } else if (args[1].equals("starttrack")) { @@ -307,36 +307,37 @@ else if (args[1].equals("starttrack")) { String[] trackInformation = this.gameCanvas.generateTrackInformation(); int[][] trackStats = this.gameCanvas.generateTrackStatistics(); - this.gameTrackInfoPanel.parseTrackInfoStats(trackInformation[0], trackInformation[1], trackStats[0], trackStats[1], trackInformation[2], trackInformation[3], trackTestMode1, trackTestMode2, this.gameCanvas.method134()); + this.trackInfoPanel.parseTrackInfoStats(trackInformation[0], trackInformation[1], trackStats[0], trackStats[1], trackInformation[2], trackInformation[3], trackTestMode1, trackTestMode2, this.gameCanvas.method134()); - int trackScoreMultiplier = this.gamePlayerInfoPanel.startNextTrack(); + int trackScoreMultiplier = this.playerInfoPanel.startNextTrack(); if (trackScoreMultiplier > 1) { - this.gameChatPanel.addMessage(gameContainer.textManager.getGame("GameChat_ScoreMultiNotify", trackScoreMultiplier)); + this.chatPanel.addMessage(gameContainer.textManager.getGame("GameChat_ScoreMultiNotify", trackScoreMultiplier)); } this.gameControlPanel.displaySkipButton(); // checks if you can skip on first shot if (this.gameContainer.synchronizedTrackTestMode.get()) { - this.gameChatPanel.printSpecialSettingstoTextArea(this.gameCanvas.getTrackComment(), this.gameCanvas.getTrackSettings(), this.gameCanvas.method120()); + this.chatPanel.printSpecialSettingstoTextArea(this.gameCanvas.getTrackComment(), this.gameCanvas.getTrackSettings(), this.gameCanvas.method120()); } } else if (args[1].equals("startturn")) { this.isWaitingForTurnStart = false; int playerId = Integer.parseInt(args[2]); - boolean canPlay = this.gamePlayerInfoPanel.startTurn(playerId); + boolean canPlay = this.playerInfoPanel.startTurn(playerId); //canPlay = true; - this.gameCanvas.startTurn(playerId, canPlay, !this.gameChatPanel.haveFocus()); + this.gameCanvas.startTurn(playerId, canPlay, !this.chatPanel.haveFocus()); if (!this.isSinglePlayerGame) { - int trackCount = this.gamePlayerInfoPanel.method377(); - if (trackCount >= 10 || trackCount >= this.gameTrackInfoPanel.method385()) { + int trackCount = this.playerInfoPanel.method377(); + if (trackCount >= 10 || trackCount >= this.trackInfoPanel.method385()) { this.gameControlPanel.showSkipButton(); } } } else if (args[1].equals("beginstroke")) { int playerId = Integer.parseInt(args[2]); - this.gamePlayerInfoPanel.strokeStartedOrEnded(playerId, false); + this.playerInfoPanel.strokeStartedOrEnded(playerId, false); this.gameContainer.soundManager.playGameMove(); + this.playerInfoPanel.stopTimer(); this.gameCanvas.decodeCoords(playerId, false, args[3]); } else if (args[1].equals("changescore")) { @@ -347,19 +348,19 @@ else if (args[1].equals("starttrack")) { trackScores[trackCount] = Integer.parseInt(args[3 + trackCount]); } - this.gamePlayerInfoPanel.setScores(Integer.parseInt(args[2]), trackScores); + this.playerInfoPanel.setScores(Integer.parseInt(args[2]), trackScores); } else if (args[1].equals("voteskip")) { - this.gamePlayerInfoPanel.voteSkip(Integer.parseInt(args[2])); + this.playerInfoPanel.voteSkip(Integer.parseInt(args[2])); } else if (args[1].equals("resetvoteskip")) { - this.gamePlayerInfoPanel.voteSkipReset(); - if (!this.gameCanvas.getSynchronizedBool(this.gamePlayerInfoPanel.playerId)) { + this.playerInfoPanel.voteSkipReset(); + if (!this.gameCanvas.getSynchronizedBool(this.playerInfoPanel.playerId)) { this.gameControlPanel.showSkipButton(); } } else if (args[1].equals("rfng")) { - this.gamePlayerInfoPanel.readyForNewGame(Integer.parseInt(args[2])); + this.playerInfoPanel.readyForNewGame(Integer.parseInt(args[2])); } else if(args[1].equals("end")) { this.gameCanvas.endGame(); @@ -373,10 +374,10 @@ else if(args[1].equals("end")) { isWinner[i] = gameOutcome[i] == 1; } - this.gamePlayerInfoPanel.setGameOutcome(gameOutcome); + this.playerInfoPanel.setGameOutcome(gameOutcome); this.gameContainer.gameApplet.showPlayerListWinners(isWinner); } else { - this.gamePlayerInfoPanel.setGameOutcome(null); + this.playerInfoPanel.setGameOutcome(null); } this.setState(2);// game state? @@ -391,12 +392,12 @@ else if(args[1].equals("end")) { protected void sendChatMessage(String message) { String var2 = "say\t" + message; this.gameContainer.connection.writeData("game\t" + var2); - this.gameChatPanel.addSay(this.gamePlayerInfoPanel.playerId, this.gamePlayerInfoPanel.playerNames[this.gamePlayerInfoPanel.playerId], message, true); + this.chatPanel.addSay(this.playerInfoPanel.playerId, this.playerInfoPanel.playerNames[this.playerInfoPanel.playerId], message, true); } protected void setBeginStroke(int playerId, int x, int y, int shootingMode) { - this.gameTrackInfoPanel.method384(); - this.gamePlayerInfoPanel.strokeStartedOrEnded(playerId, false); + this.trackInfoPanel.method384(); + this.playerInfoPanel.strokeStartedOrEnded(playerId, false); String data = "beginstroke\t" + this.encodeCoords(x, y, shootingMode); this.gameContainer.connection.writeData("game\t" + data); this.gameContainer.soundManager.playGameMove(); @@ -405,7 +406,7 @@ protected void setBeginStroke(int playerId, int x, int y, int shootingMode) { protected void method336() { String var1 = this.gameCanvas.method142(); if (var1 != null) { - this.gamePlayerInfoPanel.strokeStartedOrEnded(0, false); + this.playerInfoPanel.strokeStartedOrEnded(0, false); String var2 = "beginstroke\t" + var1; this.gameContainer.connection.writeData("game\t" + var2); this.gameCanvas.decodeCoords(0, true, var1); @@ -413,7 +414,7 @@ protected void method336() { } protected boolean isValidPlayerID(int player) { - return this.gamePlayerInfoPanel.isOverStrokeLimit(player); + return this.playerInfoPanel.isOverStrokeLimit(player); } protected void sendEndStroke(int playerid, SynchronizedBool[] settings, int var3) { @@ -421,7 +422,7 @@ protected void sendEndStroke(int playerid, SynchronizedBool[] settings, int var3 for (int index = 0; index < settings.length; ++index) { if (var3 == index && !settings[index].get()) { - this.gamePlayerInfoPanel.strokeStartedOrEnded(index, true); + this.playerInfoPanel.strokeStartedOrEnded(index, true); data = data + "p"; } else { data = data + (settings[index].get() ? "t" : "f"); @@ -434,8 +435,8 @@ protected void sendEndStroke(int playerid, SynchronizedBool[] settings, int var3 protected boolean skipButtonPressed(boolean isSinglePlayer) { if (this.state == 1) { if (!isSinglePlayer) { - this.gamePlayerInfoPanel.voteSkip(); - if (this.gamePlayerInfoPanel.shouldSkipTrack() && this.gameCanvas.method137()) { + this.playerInfoPanel.voteSkip(); + if (this.playerInfoPanel.shouldSkipTrack() && this.gameCanvas.method137()) { this.gameCanvas.restartGame(); } @@ -445,7 +446,7 @@ protected boolean skipButtonPressed(boolean isSinglePlayer) { if (this.gameCanvas.method137()) { this.gameCanvas.restartGame(); - this.gamePlayerInfoPanel.method372(); + this.playerInfoPanel.method372(); this.gameContainer.connection.writeData("game\tskip"); return true; } @@ -464,7 +465,7 @@ protected void requestNewGame() { protected void leaveGame() { this.gameCanvas.restartGame(); - this.gamePlayerInfoPanel.stopTimer(); + this.playerInfoPanel.stopTimer(); this.gameContainer.gameApplet.setGameState(0); this.gameContainer.connection.writeData("game\tback"); this.gameContainer.gameApplet.removePlayerList(); @@ -490,7 +491,7 @@ protected boolean maxFps() { } protected String[] getPlayerName(int playerId) { - return this.gamePlayerInfoPanel.getPlayerName(playerId); + return this.playerInfoPanel.getPlayerName(playerId); } protected void setPlayerNamesDisplayMode(int mode) { @@ -498,7 +499,7 @@ protected void setPlayerNamesDisplayMode(int mode) { } public void broadcastMessage(String message) { - this.gameChatPanel.addBroadcastMessage(message); + this.chatPanel.addBroadcastMessage(message); } protected boolean tryStroke(boolean didTimeout) { @@ -513,7 +514,7 @@ protected boolean tryStroke(boolean didTimeout) { if (didTimeout) { this.gameCanvas.doZeroLengthStroke(); } else { - this.gamePlayerInfoPanel.stopTimer(); + this.playerInfoPanel.stopTimer(); } return true; @@ -522,13 +523,13 @@ protected boolean tryStroke(boolean didTimeout) { private void create(Image image) { if (this.gameContainer.gameApplet.syncIsValidSite.get()) { this.setLayout(null); - this.gamePlayerInfoPanel = new GamePlayerInfoPanel(this.gameContainer, 735, 60); - this.gamePlayerInfoPanel.setLocation(0, 0); - this.add(this.gamePlayerInfoPanel); + this.playerInfoPanel = new PlayerInfoPanel(this.gameContainer, 735, 60); + this.playerInfoPanel.setLocation(0, 0); + this.add(this.playerInfoPanel); this.gameCanvas = new GameCanvas(this.gameContainer, image); this.gameCanvas.setLocation(0, 65); this.add(this.gameCanvas); - this.gameControlPanel = new GameControlPanel(this.gameContainer, this.gamePlayerInfoPanel, 95, 80); + this.gameControlPanel = new GameControlPanel(this.gameContainer, this.playerInfoPanel, 95, 80); this.gameControlPanel.setLocation(this.width - 95, 445); this.add(this.gameControlPanel); } @@ -538,12 +539,12 @@ private void addMultiPlayerPanels(int mode) { if (this.gameContainer.gameApplet.syncIsValidSite.get()) { this.setVisible(false); int var2 = mode > 0 ? 265 : 400; - this.gameChatPanel = new GameChatPanel(this.gameContainer, this.width - 100 - 5 - var2 - 5, 80, mode); - this.gameChatPanel.setLocation(0, 445); - this.add(this.gameChatPanel); - this.gameTrackInfoPanel = new GameTrackInfoPanel(this.gameContainer, var2, 80, mode == 0); - this.gameTrackInfoPanel.setLocation(this.width - 100 - 5 - var2, 445); - this.add(this.gameTrackInfoPanel); + this.chatPanel = new ChatPanel(this.gameContainer, this.width - 100 - 5 - var2 - 5, 80, mode); + this.chatPanel.setLocation(0, 445); + this.add(this.chatPanel); + this.trackInfoPanel = new TrackInfoPanel(this.gameContainer, var2, 80, mode == 0); + this.trackInfoPanel.setLocation(this.width - 100 - 5 - var2, 445); + this.add(this.trackInfoPanel); this.setVisible(true); } } @@ -551,7 +552,7 @@ private void addMultiPlayerPanels(int mode) { private void setState(int state) { if (state != this.state) { this.state = state; - this.gamePlayerInfoPanel.setState(state); + this.playerInfoPanel.setState(state); this.gameControlPanel.setState(state); } } diff --git a/client/src/main/java/agolf/game/GamePlayerInfoPanel.java b/client/src/main/java/agolf/game/PlayerInfoPanel.java similarity index 94% rename from client/src/main/java/agolf/game/GamePlayerInfoPanel.java rename to client/src/main/java/agolf/game/PlayerInfoPanel.java index dca01dbc..f4c5d185 100644 --- a/client/src/main/java/agolf/game/GamePlayerInfoPanel.java +++ b/client/src/main/java/agolf/game/PlayerInfoPanel.java @@ -15,7 +15,7 @@ import java.awt.event.MouseEvent; import java.awt.event.MouseListener; -class GamePlayerInfoPanel extends Panel implements ItemListener, MouseListener { +class PlayerInfoPanel extends Panel implements ItemListener, MouseListener { private static final Font fontDialog12 = new Font("Dialog", Font.PLAIN, 12); private static final Font fontDialog12b = new Font("Dialog", Font.BOLD, 12); @@ -55,17 +55,17 @@ class GamePlayerInfoPanel extends Panel implements ItemListener, MouseListener { private Choicer compareResultsChoicer; private Image image; private Graphics graphics; - private GamePlayerInfoPanelTimerThread timerThread; - private int currentTimeForShot; + private TimerThread timerThread; + private int timeRemainingForShot; // seconds - protected GamePlayerInfoPanel(GameContainer gameContainer, int width, int height) { + protected PlayerInfoPanel(GameContainer gameContainer, int width, int height) { this.gameContainer = gameContainer; this.width = width; this.height = height; this.setSize(width, height); this.setLayout(null); - this.currentTimeForShot = -1; + this.timeRemainingForShot = -1; this.initialized = false; this.trackScoresMultipliers = null; this.resultsToCompareScoreAgainst = null; @@ -190,18 +190,20 @@ public void update(Graphics g) { statusMessage = "GamePlayerInfo_WaitingPlayer"; } - String timeRemaining = null; + // draw "Your turn" or "Currently playing" next to player whose turn it is + String timeRemaining = ""; if (this.playerCount > 1 && this.activePlayerId == player) { if (this.activePlayerId == this.playerId) { statusMessage = "GamePlayerInfo_OwnTurn"; - if (this.timerThread != null && this.currentTimeForShot > 0 && (this.strokeTimeout > 0 || this.strokeTimeout == 0 && this.currentTimeForShot <= 30)) { - timeRemaining = " (" + this.gameContainer.textManager.getTime(this.currentTimeForShot) + ")"; - } } else { statusMessage = "GamePlayerInfo_PlayerTurn"; } + if (this.timerThread != null && this.timeRemainingForShot > 0 && this.strokeTimeout > 0) { + timeRemaining = " (" + this.gameContainer.textManager.getTime(this.timeRemainingForShot) + ")"; + } } + if (this.gameOutcome != null) { if (this.gameOutcome[player] == 1) { statusMessage = "GamePlayerInfo_Winner"; @@ -211,7 +213,7 @@ public void update(Graphics g) { } if (statusMessage != null) { - this.graphics.drawString(this.gameContainer.textManager.getGame(statusMessage) + (timeRemaining != null ? timeRemaining : ""), 130 + this.trackCount * 20 + 15 + 40 + 40, yOffset); + this.graphics.drawString(this.gameContainer.textManager.getGame(statusMessage) + timeRemaining, 130 + this.trackCount * 20 + 15 + 40 + 40, yOffset); } String extraMessage = null; @@ -388,12 +390,11 @@ protected boolean isOverStrokeLimit(int player) { protected boolean startTurn(int playerId) { this.activePlayerId = playerId; - int timeout = this.strokeTimeout > 0 ? this.strokeTimeout : 180; - if (this.playerCount > 1 && playerId == this.playerId) { + if (this.playerCount > 1) { this.stopTimer(); - this.currentTimeForShot = timeout; - this.timerThread = new GamePlayerInfoPanelTimerThread(this); + this.timeRemainingForShot = this.strokeTimeout > 0 ? this.strokeTimeout : 180; + this.timerThread = new TimerThread(this); } this.repaint(); @@ -577,10 +578,12 @@ private int[] getScoreDifferences() { } protected boolean run() { - --this.currentTimeForShot; + --this.timeRemainingForShot; this.repaint(); - if (this.currentTimeForShot <= 0) { - this.gameContainer.gamePanel.tryStroke(true); + if (this.timeRemainingForShot <= 0) { + if (this.activePlayerId == this.playerId) { + this.gameContainer.gamePanel.tryStroke(true); + } this.stopTimer(); return false; } else { diff --git a/client/src/main/java/agolf/game/GamePlayerInfoPanelTimerThread.java b/client/src/main/java/agolf/game/TimerThread.java similarity index 57% rename from client/src/main/java/agolf/game/GamePlayerInfoPanelTimerThread.java rename to client/src/main/java/agolf/game/TimerThread.java index 7fc923c9..61d74ba7 100644 --- a/client/src/main/java/agolf/game/GamePlayerInfoPanelTimerThread.java +++ b/client/src/main/java/agolf/game/TimerThread.java @@ -2,14 +2,14 @@ import com.aapeli.tools.Tools; -class GamePlayerInfoPanelTimerThread implements Runnable { +class TimerThread implements Runnable { - private final GamePlayerInfoPanel gamePlayerInfoPanel; + private final PlayerInfoPanel playerInfoPanel; private boolean running; - protected GamePlayerInfoPanelTimerThread(GamePlayerInfoPanel gamePlayerInfoPanel) { - this.gamePlayerInfoPanel = gamePlayerInfoPanel; + protected TimerThread(PlayerInfoPanel playerInfoPanel) { + this.playerInfoPanel = playerInfoPanel; this.running = true; Thread thread = new Thread(this); thread.setDaemon(true); @@ -20,7 +20,7 @@ public void run() { do { Tools.sleep(1000L); if (this.running) { - this.running = this.gamePlayerInfoPanel.run(); + this.running = this.playerInfoPanel.run(); } } while (this.running); diff --git a/client/src/main/java/agolf/game/GameTrackInfoPanel.java b/client/src/main/java/agolf/game/TrackInfoPanel.java similarity index 99% rename from client/src/main/java/agolf/game/GameTrackInfoPanel.java rename to client/src/main/java/agolf/game/TrackInfoPanel.java index 2a147a85..60ae643c 100644 --- a/client/src/main/java/agolf/game/GameTrackInfoPanel.java +++ b/client/src/main/java/agolf/game/TrackInfoPanel.java @@ -13,7 +13,7 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -class GameTrackInfoPanel extends Panel implements ActionListener { +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); @@ -59,7 +59,7 @@ class GameTrackInfoPanel extends Panel implements ActionListener { private boolean created; - protected GameTrackInfoPanel(GameContainer gameContainer, int width, int height, boolean var4) { + protected TrackInfoPanel(GameContainer gameContainer, int width, int height, boolean var4) { this.gameContainer = gameContainer; this.width = width; this.height = height; diff --git a/client/src/main/java/com/aapeli/applet/AApplet.java b/client/src/main/java/com/aapeli/applet/AApplet.java index e7072edc..8b14a123 100644 --- a/client/src/main/java/com/aapeli/applet/AApplet.java +++ b/client/src/main/java/com/aapeli/applet/AApplet.java @@ -109,7 +109,7 @@ public void destroy() { try { this.destroyApplet(); - } catch (Exception var2) { + } catch (Exception e) { ; } @@ -169,8 +169,8 @@ public void update(Graphics var1) { if (this.splashImage != null) { this.appletGraphics.drawImage(this.splashImage, 0, 0, this); } else { - Color var2 = this.getBackground(); - this.appletGraphics.setColor(var2); + Color backgroundColor = this.getBackground(); + this.appletGraphics.setColor(backgroundColor); this.appletGraphics.fillRect(0, 0, this.appletWidth, this.appletHeight); if (this.imageManager != null && this.aString2547 != null) { Image var3 = this.imageManager.getIfAvailable(this.aString2547); @@ -181,47 +181,47 @@ public void update(Graphics var1) { if (this.textManager != null) { this.appletGraphics.setColor(this.getForeground()); - Color var6 = this.aBoolean2554 ? var2 : null; + Color color = this.aBoolean2554 ? backgroundColor : null; if (this.endState == END_ERROR_CONNECTION) { byte var4 = -20; this.appletGraphics.setFont(fontDialog15); - StringDraw.drawOutlinedString(this.appletGraphics, var6, this.textManager.getShared("Message_CE_ConnectionError"), 40, 80 + var4, -1); + StringDraw.drawOutlinedString(this.appletGraphics, color, this.textManager.getShared("Message_CE_ConnectionError"), 40, 80 + var4, -1); this.appletGraphics.setFont(fontDialog12); - StringDraw.drawOutlinedString(this.appletGraphics, var6, this.textManager.getShared("Message_CE_PossibleReasons"), 40, 125 + var4, -1); + StringDraw.drawOutlinedString(this.appletGraphics, color, this.textManager.getShared("Message_CE_PossibleReasons"), 40, 125 + var4, -1); if (!this.aBoolean2557) { this.appletGraphics.setFont(fontDialog12); - StringDraw.drawOutlinedString(this.appletGraphics, var6, "- " + this.textManager.getShared("Message_CE0_1_Short"), 40, 160 + var4, -1); + StringDraw.drawOutlinedString(this.appletGraphics, color, "- " + this.textManager.getShared("Message_CE0_1_Short"), 40, 160 + var4, -1); this.appletGraphics.setFont(fontDialog11); - StringDraw.drawOutlinedStringWithMaxWidth(this.appletGraphics, var6, this.textManager.getShared("Message_CE0_1_Long", this.param.getServerIp(), "" + this.param.getServerPort()), 50, 180 + var4, -1, this.appletWidth - 50 - 50); + StringDraw.drawOutlinedStringWithMaxWidth(this.appletGraphics, color, this.textManager.getShared("Message_CE0_1_Long", this.param.getServerIp(), "" + this.param.getServerPort()), 50, 180 + var4, -1, this.appletWidth - 50 - 50); this.appletGraphics.setFont(fontDialog12); - StringDraw.drawOutlinedString(this.appletGraphics, var6, "- " + this.textManager.getShared("Message_CE0_2_Short"), 40, 245 + var4, -1); + StringDraw.drawOutlinedString(this.appletGraphics, color, "- " + this.textManager.getShared("Message_CE0_2_Short"), 40, 245 + var4, -1); this.appletGraphics.setFont(fontDialog11); - StringDraw.drawOutlinedStringWithMaxWidth(this.appletGraphics, var6, this.textManager.getShared("Message_CE0_2_Long"), 50, 265 + var4, -1, this.appletWidth - 50 - 50); + StringDraw.drawOutlinedStringWithMaxWidth(this.appletGraphics, color, this.textManager.getShared("Message_CE0_2_Long"), 50, 265 + var4, -1, this.appletWidth - 50 - 50); this.appletGraphics.setFont(fontDialog12); - StringDraw.drawOutlinedString(this.appletGraphics, var6, "- " + this.textManager.getShared("Message_CE0_3_Short"), 40, 305 + var4, -1); + StringDraw.drawOutlinedString(this.appletGraphics, color, "- " + this.textManager.getShared("Message_CE0_3_Short"), 40, 305 + var4, -1); this.appletGraphics.setFont(fontDialog11); - StringDraw.drawOutlinedStringWithMaxWidth(this.appletGraphics, var6, this.textManager.getShared("Message_CE0_3_Long"), 50, 325 + var4, -1, this.appletWidth - 50 - 50); + StringDraw.drawOutlinedStringWithMaxWidth(this.appletGraphics, color, this.textManager.getShared("Message_CE0_3_Long"), 50, 325 + var4, -1, this.appletWidth - 50 - 50); } else { this.appletGraphics.setFont(fontDialog12); - StringDraw.drawOutlinedString(this.appletGraphics, var6, "- " + this.textManager.getShared("Message_CE1_1_Short"), 40, 160 + var4, -1); + StringDraw.drawOutlinedString(this.appletGraphics, color, "- " + this.textManager.getShared("Message_CE1_1_Short"), 40, 160 + var4, -1); this.appletGraphics.setFont(fontDialog11); - StringDraw.drawOutlinedStringWithMaxWidth(this.appletGraphics, var6, this.textManager.getShared("Message_CE1_1_Long"), 50, 180 + var4, -1, this.appletWidth - 50 - 50); + StringDraw.drawOutlinedStringWithMaxWidth(this.appletGraphics, color, this.textManager.getShared("Message_CE1_1_Long"), 50, 180 + var4, -1, this.appletWidth - 50 - 50); this.appletGraphics.setFont(fontDialog12); - StringDraw.drawOutlinedString(this.appletGraphics, var6, "- " + this.textManager.getShared("Message_CE1_2_Short"), 40, 235 + var4, -1); + StringDraw.drawOutlinedString(this.appletGraphics, color, "- " + this.textManager.getShared("Message_CE1_2_Short"), 40, 235 + var4, -1); this.appletGraphics.setFont(fontDialog11); - StringDraw.drawOutlinedStringWithMaxWidth(this.appletGraphics, var6, this.textManager.getShared("Message_CE1_2_Long"), 50, 255 + var4, -1, this.appletWidth - 50 - 50); + StringDraw.drawOutlinedStringWithMaxWidth(this.appletGraphics, color, this.textManager.getShared("Message_CE1_2_Long"), 50, 255 + var4, -1, this.appletWidth - 50 - 50); this.appletGraphics.setFont(fontDialog12); - StringDraw.drawOutlinedString(this.appletGraphics, var6, "- " + this.textManager.getShared("Message_CE1_3_Short"), 40, 305 + var4, -1); + StringDraw.drawOutlinedString(this.appletGraphics, color, "- " + this.textManager.getShared("Message_CE1_3_Short"), 40, 305 + var4, -1); this.appletGraphics.setFont(fontDialog11); - StringDraw.drawOutlinedStringWithMaxWidth(this.appletGraphics, var6, this.textManager.getShared("Message_CE1_3_Long"), 50, 325 + var4, -1, this.appletWidth - 50 - 50); + StringDraw.drawOutlinedStringWithMaxWidth(this.appletGraphics, color, this.textManager.getShared("Message_CE1_3_Long"), 50, 325 + var4, -1, this.appletWidth - 50 - 50); } } else if (this.endState == END_THROWABLE) { this.appletGraphics.setFont(fontDialog15); - StringDraw.drawOutlinedString(this.appletGraphics, var6, this.textManager.getShared("Message_PE_ProgramError"), 50, 100, -1); + StringDraw.drawOutlinedString(this.appletGraphics, color, this.textManager.getShared("Message_PE_ProgramError"), 50, 100, -1); this.appletGraphics.setFont(fontDialog12); - StringDraw.drawOutlinedStringWithMaxWidth(this.appletGraphics, var6, this.textManager.getShared("Message_PE_GameClosed"), 50, 150, -1, this.appletWidth - 70 - 50); + StringDraw.drawOutlinedStringWithMaxWidth(this.appletGraphics, color, this.textManager.getShared("Message_PE_GameClosed"), 50, 150, -1, this.appletWidth - 70 - 50); this.appletGraphics.setFont(fontDialog12b); - StringDraw.drawOutlinedString(this.appletGraphics, var6, this.textManager.getShared("Message_PE_ErrorDesc", this.aThrowable2553.toString()), 50, 235, -1); + StringDraw.drawOutlinedString(this.appletGraphics, color, this.textManager.getShared("Message_PE_ErrorDesc", this.aThrowable2553.toString()), 50, 235, -1); } else { String endText = this.textManager.getShared("Message_WaitWhile"); String endTextHelp = null; @@ -261,21 +261,21 @@ public void update(Graphics var1) { this.appletGraphics.setFont(fontDialog15); if (this.endTextLocation == TEXT_CENTER) { - StringDraw.drawOutlinedString(this.appletGraphics, var6, endText, this.appletWidth / 2, this.appletHeight / 2 - 10, 0); + StringDraw.drawOutlinedString(this.appletGraphics, color, endText, this.appletWidth / 2, this.appletHeight / 2 - 10, 0); } else if (this.endTextLocation == TEXT_LOWERLEFT) { - StringDraw.drawOutlinedString(this.appletGraphics, var6, endText, this.appletWidth / 12, this.appletHeight - 120, -1); + StringDraw.drawOutlinedString(this.appletGraphics, color, endText, this.appletWidth / 12, this.appletHeight - 120, -1); } else if (this.endTextLocation == TEXT_LOWERMIDDLE) { - StringDraw.drawOutlinedString(this.appletGraphics, var6, endText, this.appletWidth / 2, this.appletHeight - 120, 0); + StringDraw.drawOutlinedString(this.appletGraphics, color, endText, this.appletWidth / 2, this.appletHeight - 120, 0); } if (endTextHelp != null) { this.appletGraphics.setFont(fontDialog12); if (this.endTextLocation == TEXT_CENTER) { - StringDraw.drawOutlinedStringWithMaxWidth(this.appletGraphics, var6, endTextHelp, this.appletWidth / 2, this.appletHeight / 2 + 30, 0, (int) ((double) this.appletWidth * 0.8D)); + StringDraw.drawOutlinedStringWithMaxWidth(this.appletGraphics, color, endTextHelp, this.appletWidth / 2, this.appletHeight / 2 + 30, 0, (int) ((double) this.appletWidth * 0.8D)); } else if (this.endTextLocation == TEXT_LOWERLEFT) { - StringDraw.drawOutlinedStringWithMaxWidth(this.appletGraphics, var6, endTextHelp, this.appletWidth / 12, this.appletHeight - 80, -1, (int) ((double) this.appletWidth * 0.6D)); + StringDraw.drawOutlinedStringWithMaxWidth(this.appletGraphics, color, endTextHelp, this.appletWidth / 12, this.appletHeight - 80, -1, (int) ((double) this.appletWidth * 0.6D)); } else if (this.endTextLocation == TEXT_LOWERMIDDLE) { - StringDraw.drawOutlinedStringWithMaxWidth(this.appletGraphics, var6, endTextHelp, this.appletWidth / 2, this.appletHeight - 80, 0, (int) ((double) this.appletWidth * 0.5D)); + StringDraw.drawOutlinedStringWithMaxWidth(this.appletGraphics, color, endTextHelp, this.appletWidth / 2, this.appletHeight - 80, 0, (int) ((double) this.appletWidth * 0.5D)); } } } @@ -522,18 +522,18 @@ public void run() { } } - public void actionPerformed(ActionEvent var1) { - if (var1.getSource() == this.retryCanvas) { + public void actionPerformed(ActionEvent action) { + if (action.getSource() == this.retryCanvas) { try { - String var2 = this.getDocumentBase().toString(); - if (var2.indexOf(63) == -1) { - var2 = var2 + "?retry=1"; - } else if (var2.indexOf("retry=") == -1) { - var2 = var2 + "&retry=1"; + String url = this.getDocumentBase().toString(); + if (url.indexOf('?') == -1) { + url = url + "?retry=1"; + } else if (!url.contains("retry=")) { + url = url + "&retry=1"; } - this.getAppletContext().showDocument(new URL(var2)); - } catch (Exception var3) { + this.getAppletContext().showDocument(new URL(url)); + } catch (Exception e) { this.retryCanvas.setVisible(false); } } @@ -569,19 +569,19 @@ public void setTextOutline(boolean var1) { this.repaint(); } - public void setEndState(int var1) { + public void setEndState(int state) { if (this.endState == 0) { - this.endState = var1; + this.endState = state; this.removeLoadingPanel(); if (this.contentPanel != null) { this.contentPanel.dispose(); } - if (var1 == END_ERROR_CONNECTION) { + if (state == END_ERROR_CONNECTION) { this.retryCanvas = new RetryCanvas(this.textManager.getShared("Message_CE_RetryButton"), 120, 20, this); this.retryCanvas.setLocation(40, 360); this.add(this.retryCanvas); - } else if (var1 == END_THROWABLE) { + } else if (state == END_THROWABLE) { this.retryCanvas = new RetryCanvas(this.textManager.getShared("Message_PE_RetryButton"), 120, 20, this); this.retryCanvas.setLocation(50, 360); this.add(this.retryCanvas); diff --git a/client/src/main/java/com/aapeli/applet/RetryCanvas.java b/client/src/main/java/com/aapeli/applet/RetryCanvas.java index 0a75d138..86155510 100644 --- a/client/src/main/java/com/aapeli/applet/RetryCanvas.java +++ b/client/src/main/java/com/aapeli/applet/RetryCanvas.java @@ -13,172 +13,173 @@ class RetryCanvas extends Canvas implements MouseMotionListener, MouseListener { - private static final Color aColor128 = new Color(64, 64, 224); - private static final Color aColor129 = new Color(224, 224, 255); - private static final Font aFont130 = new Font("Dialog", 0, 12); - private Color aColor131; - private Color aColor132; - private Color aColor133; + private static final Color backgroundColor = new Color(64, 64, 224); + private static final Color textColor = new Color(224, 224, 255); + private static final Font dialog12 = new Font("Dialog", Font.PLAIN, 12); + private Color backgroundBrighter; + private Color backgroundBrightest; + private Color backgroundDarker; private Color aColor134; - private String aString135; - private boolean aBoolean136; - private boolean aBoolean137; - private ActionListener anActionListener138; - private int anInt139; - private int anInt140; - private Image anImage141; - private Graphics aGraphics142; - private static final String aString143 = "Dialog"; - - - protected RetryCanvas(String var1, int var2, int var3, ActionListener var4) { - this.setBackground(aColor128); - this.setForeground(aColor129); - this.anInt139 = var2; - this.anInt140 = var3; - this.setSize(var2, var3); - this.setFont(aFont130); - this.aString135 = var1; - this.anActionListener138 = var4; - this.aBoolean136 = this.aBoolean137 = false; + private String message; + private boolean hovered; + private boolean mousePressed; + private ActionListener listener; + private int canvasWidth; + private int canvasHeight; + private Image image; + private Graphics graphics; + + protected RetryCanvas(String message, int canvasWidth, int canvasHeight, ActionListener listener) { + this.setBackground(backgroundColor); + this.setForeground(textColor); + this.canvasWidth = canvasWidth; + this.canvasHeight = canvasHeight; + this.setSize(canvasWidth, canvasHeight); + this.setFont(dialog12); + this.message = message; + this.listener = listener; + this.hovered = false; + this.mousePressed = false; this.addMouseMotionListener(this); this.addMouseListener(this); } public void addNotify() { super.addNotify(); - this.aBoolean136 = this.aBoolean137 = false; + this.hovered = false; + this.mousePressed = false; this.repaint(); } - public void paint(Graphics var1) { - this.update(var1); + public void paint(Graphics graphics) { + this.update(graphics); } - public void update(Graphics var1) { - if (this.anImage141 == null) { - this.anImage141 = this.createImage(this.anInt139, this.anInt140); - this.aGraphics142 = this.anImage141.getGraphics(); + public void update(Graphics graphics) { + if (this.image == null) { + this.image = this.createImage(this.canvasWidth, this.canvasHeight); + this.graphics = this.image.getGraphics(); } - boolean var2 = this.aBoolean136; - Color var3 = var2 ? this.aColor131 : aColor128; - this.method220(this.aGraphics142, var3, this.anInt139, this.anInt140); + boolean hovered = this.hovered; + Color background = hovered ? this.backgroundBrighter : backgroundColor; + this.method220(this.graphics, background, this.canvasWidth, this.canvasHeight); if (this.aColor134 != null) { - this.aGraphics142.setColor(this.aColor134); + this.graphics.setColor(this.aColor134); } - this.method221(this.aGraphics142, this.anInt139, this.anInt140); - this.aGraphics142.setColor(aColor129); - this.aGraphics142.setFont(aFont130); - this.aGraphics142.drawString(this.aString135, this.anInt139 / 2 - this.getFontMetrics(aFont130).stringWidth(this.aString135) / 2, this.anInt140 / 2 + aFont130.getSize() * 3 / 8 + 1); - var1.drawImage(this.anImage141, 0, 0, this); + this.drawButton(this.graphics, this.canvasWidth, this.canvasHeight); + this.graphics.setColor(textColor); + this.graphics.setFont(dialog12); + this.graphics.drawString(this.message, this.canvasWidth / 2 - this.getFontMetrics(dialog12).stringWidth(this.message) / 2, this.canvasHeight / 2 + dialog12.getSize() * 3 / 8 + 1); + graphics.drawImage(this.image, 0, 0, this); } - public void setBackground(Color var1) { - super.setBackground(var1); - this.aColor131 = this.method218(var1, 32); - this.aColor132 = this.method218(var1, 48); - this.aColor133 = this.method218(var1, -48); + public void setBackground(Color color) { + super.setBackground(color); + this.backgroundBrighter = this.translateColor(color, 32); + this.backgroundBrightest = this.translateColor(color, 48); + this.backgroundDarker = this.translateColor(color, -48); this.repaint(); } - public void mouseEntered(MouseEvent var1) { - this.aBoolean136 = true; + public void mouseEntered(MouseEvent e) { + this.hovered = true; this.repaint(); } - public void mouseExited(MouseEvent var1) { - this.aBoolean136 = this.aBoolean137 = false; + public void mouseExited(MouseEvent e) { + this.hovered = false; + this.mousePressed = false; this.repaint(); } - public void mousePressed(MouseEvent var1) { - this.aBoolean137 = true; + public void mousePressed(MouseEvent e) { + this.mousePressed = true; this.repaint(); } - public void mouseReleased(MouseEvent var1) { - boolean var2 = this.aBoolean137; - this.aBoolean137 = false; + public void mouseReleased(MouseEvent e) { + boolean wasPressed = this.mousePressed; + this.mousePressed = false; this.repaint(); - if (var2) { - ActionEvent var3 = new ActionEvent(this, 1001, this.aString135); - this.anActionListener138.actionPerformed(var3); + if (wasPressed) { + ActionEvent action = new ActionEvent(this, 1001, this.message); + this.listener.actionPerformed(action); } } - public void mouseClicked(MouseEvent var1) { + public void mouseClicked(MouseEvent e) { } - public void mouseMoved(MouseEvent var1) { + public void mouseMoved(MouseEvent e) { } - public void mouseDragged(MouseEvent var1) { + public void mouseDragged(MouseEvent e) { } - private Color method218(Color var1, int var2) { - int var3 = this.method219(var1.getRed(), var2); - int var4 = this.method219(var1.getGreen(), var2); - int var5 = this.method219(var1.getBlue(), var2); - return new Color(var3, var4, var5); + private Color translateColor(Color color, int offset) { + int r = this.translateColor(color.getRed(), offset); + int g = this.translateColor(color.getGreen(), offset); + int b = this.translateColor(color.getBlue(), offset); + return new Color(r, g, b); } - private int method219(int var1, int var2) { - var1 += var2; - if (var1 < 0) { - var1 = 0; - } else if (var1 > 255) { - var1 = 255; + private int translateColor(int base, int offset) { + base += offset; + if (base < 0) { + base = 0; + } else if (base > 255) { + base = 255; } - return var1; + return base; } - private void method220(Graphics var1, Color var2, int var3, int var4) { - int var5 = var2.getRed(); - int var6 = var2.getGreen(); - int var7 = var2.getBlue(); - int var8 = var5; - int var9 = var6; - int var10 = var7; + private void method220(Graphics graphics, Color background, int width, int height) { + int baseR = background.getRed(); + int baseG = background.getGreen(); + int baseB = background.getBlue(); + int r = baseR; + int g = baseG; + int b = baseB; - int var11; - for (var11 = var4 / 2; var11 >= 0; --var11) { - var1.setColor(new Color(var8, var9, var10)); - var1.drawLine(0, var11, var3 - 1, var11); - var8 = this.method219(var8, 3); - var9 = this.method219(var9, 3); - var10 = this.method219(var10, 3); + int y; + for (y = height / 2; y >= 0; --y) { + graphics.setColor(new Color(r, g, b)); + graphics.drawLine(0, y, width - 1, y); + r = this.translateColor(r, 3); + g = this.translateColor(g, 3); + b = this.translateColor(b, 3); } - var8 = var5; - var9 = var6; - var10 = var7; + r = baseR; + g = baseG; + b = baseB; - for (var11 = var4 / 2 + 1; var11 < var4; ++var11) { - var8 = this.method219(var8, -3); - var9 = this.method219(var9, -3); - var10 = this.method219(var10, -3); - var1.setColor(new Color(var8, var9, var10)); - var1.drawLine(0, var11, var3 - 1, var11); + for (y = height / 2 + 1; y < height; ++y) { + r = this.translateColor(r, -3); + g = this.translateColor(g, -3); + b = this.translateColor(b, -3); + graphics.setColor(new Color(r, g, b)); + graphics.drawLine(0, y, width - 1, y); } } - private void method221(Graphics var1, int var2, int var3) { + private void drawButton(Graphics graphics, int width, int height) { if (this.aColor134 == null) { - var1.setColor(!this.aBoolean137 ? this.aColor133 : this.aColor132); + graphics.setColor(!this.mousePressed ? this.backgroundDarker : this.backgroundBrightest); } - var1.drawRect(0, 0, var2 - 1, var3 - 1); + graphics.drawRect(0, 0, width - 1, height - 1); if (this.aColor134 == null) { - var1.setColor(!this.aBoolean137 ? this.aColor132 : this.aColor133); + graphics.setColor(!this.mousePressed ? this.backgroundBrightest : this.backgroundDarker); } - var1.drawLine(0, 0, var2 - 1, 0); - var1.drawLine(0, 0, 0, var3 - 1); + graphics.drawLine(0, 0, width - 1, 0); + graphics.drawLine(0, 0, 0, height - 1); } } diff --git a/client/src/main/java/com/aapeli/client/Parameters.java b/client/src/main/java/com/aapeli/client/Parameters.java index 2769d973..7c1eb06a 100644 --- a/client/src/main/java/com/aapeli/client/Parameters.java +++ b/client/src/main/java/com/aapeli/client/Parameters.java @@ -26,6 +26,7 @@ public final class Parameters { private String translationLanguage; private String chatLang; private String siteName; + private String username; private String sessionLocale; private String session; private String welcomeMessage; @@ -121,6 +122,10 @@ public String getTranslationLang() { return this.translationLanguage; } + public String getUsername() { + return this.username; + } + public String getChatLang() { return this.chatLang != null ? this.chatLang : this.translationLanguage; } @@ -485,6 +490,7 @@ private void init() { this.subgame = this.getParameter("subgame"); this.ticket = this.getParameter("ticket"); this.json = this.getParameter("json"); + this.username = this.getParameter("username"); if (this.json != null) { this.json = Tools.replaceFirst(this.json, "\'%o\'", "%o"); if (!this.json.toLowerCase().startsWith("javascript:")) { diff --git a/client/src/main/java/com/aapeli/multiuser/UsernameValidator.java b/client/src/main/java/com/aapeli/multiuser/UsernameValidator.java new file mode 100644 index 00000000..78848f14 --- /dev/null +++ b/client/src/main/java/com/aapeli/multiuser/UsernameValidator.java @@ -0,0 +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; + + } +} diff --git a/client/src/main/java/org/moparforia/client/Game.java b/client/src/main/java/org/moparforia/client/Game.java index 1f943d32..b42fb154 100644 --- a/client/src/main/java/org/moparforia/client/Game.java +++ b/client/src/main/java/org/moparforia/client/Game.java @@ -14,11 +14,11 @@ public class Game { private static final int WIDTH = 735; private static final int HEIGHT = 525; - public Game(JFrame frame, String server, int port, String lang, boolean verbose, boolean norandom) { + public Game(JFrame frame, String server, int port, String lang, String username, boolean verbose, boolean norandom) { Applet game = new AGolf(); - game.setStub(new Stub(server, lang, port, verbose, norandom)); + game.setStub(new Stub(server, lang, username, port, verbose, norandom)); game.setSize(WIDTH, HEIGHT); game.init(); game.start(); @@ -33,13 +33,13 @@ class Stub implements AppletStub { private final Map params; private String server; - public Stub(String server, String lang, int port, boolean verbose, boolean norandom) { + public Stub(String server, String lang, String username, int port, boolean verbose, boolean norandom) { if (server.indexOf(':') == -1) { // is ipv4 this.server = server; } else { // is ipv6 this.server = "[" + server + "]"; } - params = new HashMap(); + params = new HashMap<>(); params.put("initmessage", "Loading game..."); params.put("ld_page", "javascript:Playray.Notify.delegate({ jvm: { version: '%v', vendor: '%w', t1: '%r', t2: '%f' } })"); params.put("image", "/appletloader_playforia.gif"); @@ -73,6 +73,7 @@ public Stub(String server, String lang, int port, boolean verbose, boolean noran params.put("sharedLocalizationUrl", ""); params.put("verbose", Boolean.toString(verbose)); params.put("norandom", Boolean.toString(norandom)); + params.put("username", username); //if(serverBox.isSelected()) //params.put("tracktestmode", "true"); diff --git a/client/src/main/java/org/moparforia/client/Launcher.java b/client/src/main/java/org/moparforia/client/Launcher.java index 12a251d9..7c237c36 100644 --- a/client/src/main/java/org/moparforia/client/Launcher.java +++ b/client/src/main/java/org/moparforia/client/Launcher.java @@ -1,5 +1,6 @@ package org.moparforia.client; +import com.aapeli.multiuser.UsernameValidator; import picocli.CommandLine; import org.moparforia.shared.ManifestVersionProvider; @@ -17,7 +18,7 @@ mixinStandardHelpOptions = true, versionProvider = ManifestVersionProvider.class ) -public class Launcher implements Callable { +public class Launcher implements Callable { public static final String DEFAULT_SERVER = "127.0.0.1"; public static final int DEFAULT_PORT = 4242; @@ -38,6 +39,10 @@ public class Launcher implements Callable { defaultValue = "en_us") private Language lang; + @CommandLine.Option(names = {"--username", "-u"}, + description = "Sets the username to use when connecting to the server") + private String username; + @CommandLine.Option(names = {"--verbose", "-v"}, description = "Set if you want verbose information") private static boolean verbose = false; @@ -114,7 +119,7 @@ private String[] login(JFrame frame) { } @Override - public Void call() throws Exception{ + public Integer call() throws Exception{ JFrame frame = createFrame(); if (hostname.isEmpty() || port == 0) { // Determine which of these was actually false @@ -122,12 +127,18 @@ public Void call() throws Exception{ int temp_port = port == 0 ? DEFAULT_PORT : port; if (!showSettingDialog(frame, temp_hostname, temp_port)) { System.err.println("Server needs to be specified for minigolf to run"); - System.exit(1); - return null; + return 1; + } + } + + if (username != null) { + if (!UsernameValidator.isValidUsername(username)) { + System.err.println("Invalid username: Only spaces, alphabetical and numerical characters are allowed"); + return 2; } } - launchGame(frame, hostname, port, lang, verbose, norandom); + launchGame(frame, hostname, port, lang, username, verbose, norandom); return null; } @@ -139,8 +150,8 @@ public JFrame createFrame() throws IOException { return frame; } - public Game launchGame(JFrame frame, String hostname, int port, Language lang, boolean verbose, boolean norandom) { - return new Game(frame, hostname, port, lang.toString(), verbose, norandom); + public Game launchGame(JFrame frame, String hostname, int port, Language lang, String username, boolean verbose, boolean norandom) { + return new Game(frame, hostname, port, lang.toString(), username, verbose, norandom); } public Image loadIcon() throws IOException { diff --git a/client/src/test/java/org/moparforia/client/LauncherCLITest.java b/client/src/test/java/org/moparforia/client/LauncherCLITest.java index 592a941d..68dffce1 100644 --- a/client/src/test/java/org/moparforia/client/LauncherCLITest.java +++ b/client/src/test/java/org/moparforia/client/LauncherCLITest.java @@ -8,10 +8,8 @@ import picocli.CommandLine; import javax.swing.*; -import java.io.IOException; import java.io.PrintWriter; import java.io.StringWriter; -import java.text.ParseException; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals; @@ -84,6 +82,7 @@ void testValidLang() { eq(Launcher.DEFAULT_SERVER), eq(Launcher.DEFAULT_PORT), eq(Launcher.Language.EN_US), + any(), anyBoolean(), anyBoolean()); @@ -92,32 +91,59 @@ void testValidLang() { eq(Launcher.DEFAULT_SERVER), eq(Launcher.DEFAULT_PORT), eq(Launcher.Language.FI_FI), + any(), + anyBoolean(), + anyBoolean()); + } + + @Test + void testValidUsername() { + assertEquals(0, cmd.execute("-u", "user")); + verify(launcher).launchGame(any(), + eq(Launcher.DEFAULT_SERVER), + eq(Launcher.DEFAULT_PORT), + any(), + eq("user"), + anyBoolean(), + anyBoolean()); + assertEquals(0, cmd.execute("--username=user2")); + verify(launcher).launchGame(any(), + eq(Launcher.DEFAULT_SERVER), + eq(Launcher.DEFAULT_PORT), + any(), + eq("user2"), anyBoolean(), anyBoolean()); } + @Test + void testInvalidUsername() { + assertEquals(2, cmd.execute("-u", "[/.]")); + assertEquals(2, cmd.execute("--username=' '")); + } + @Test void testValidPortAndHostname() { assertEquals(0, cmd.execute("-p", "1111", "-ip", "128.128.128.128")); - verify(launcher).launchGame(any(), eq("128.128.128.128"), eq(1111), any(), anyBoolean(), anyBoolean()); + verify(launcher).launchGame(any(), eq("128.128.128.128"), eq(1111), any(), any(), anyBoolean(), anyBoolean()); assertEquals(0, cmd.execute("-p=2222", "-ip=127.127.127.127")); - verify(launcher).launchGame(any(), eq("127.127.127.127"), eq(2222), any(), anyBoolean(), anyBoolean()); + verify(launcher).launchGame(any(), eq("127.127.127.127"), eq(2222), any(), any(), anyBoolean(), anyBoolean()); assertEquals(0, cmd.execute("-p=3333", "-ip=126.126.126.126")); - verify(launcher).launchGame(any(), eq("126.126.126.126"), eq(3333), any(), anyBoolean(), anyBoolean()); + verify(launcher).launchGame(any(), eq("126.126.126.126"), eq(3333), any(), any(), anyBoolean(), anyBoolean()); } @Test void testOnlyPort() { assertEquals(0, cmd.execute("-p", "1111")); - verify(launcher).launchGame(any(), eq(Launcher.DEFAULT_SERVER), eq(1111), any(), anyBoolean(), anyBoolean()); + verify(launcher).launchGame(any(), eq(Launcher.DEFAULT_SERVER), eq(1111), any(), any(), anyBoolean(), anyBoolean()); } @Test void testOnlyHostname() { assertEquals(0, cmd.execute("-ip", "127.127.127.127")); - verify(launcher).launchGame(any(), eq("127.127.127.127"), eq(Launcher.DEFAULT_PORT), any(), anyBoolean(), + verify(launcher).launchGame(any(), eq("127.127.127.127"), eq(Launcher.DEFAULT_PORT), any(), any(), anyBoolean(), anyBoolean()); } @@ -129,6 +155,7 @@ void testDefaultValues() { eq(Launcher.DEFAULT_SERVER), eq(Launcher.DEFAULT_PORT), eq(Launcher.Language.EN_US), + eq(null), eq(false), eq(false) ); diff --git a/doc/uml/org.moparforia.client.svg b/doc/uml/org.moparforia.client.svg index 6f7c90a0..6e021be1 100644 --- a/doc/uml/org.moparforia.client.svg +++ b/doc/uml/org.moparforia.client.svg @@ -19,12 +19,12 @@ class agolf.TrackTestLoginPanel-->ConfirmButtonactionListener : java.awt.event.ActionListenercolourBackground : java.awt.ColorcolourBackgroundBrighter : java.awt.ColorcolourBackgroundBrightest : java.awt.ColorcolourBackgroundDarker : java.awt.ColorcolourBlack : java.awt.ColorcolourForeground : java.awt.ColorcolourWhite : java.awt.Colorfont : java.awt.FontfontDialog12 : java.awt.FontfontMetrics : java.awt.FontMetricsfontSize : intmouseDown : booleanmouseHover : booleanstate : inttext : StringtextConfirm : StringaddNotify () : voidfireAction () : voidmouseClicked ( paramMouseEvent1 : java.awt.event.MouseEvent ) : voidmouseDragged ( paramMouseEvent1 : java.awt.event.MouseEvent ) : voidmouseEntered ( paramMouseEvent1 : java.awt.event.MouseEvent ) : voidmouseExited ( paramMouseEvent1 : java.awt.event.MouseEvent ) : voidmouseMoved ( paramMouseEvent1 : java.awt.event.MouseEvent ) : voidmousePressed ( paramMouseEvent1 : java.awt.event.MouseEvent ) : voidmouseReleased ( paramMouseEvent1 : java.awt.event.MouseEvent ) : voidpaint ( paramGraphics1 : java.awt.Graphics ) : voidsaturate ( paramColor1 : java.awt.Color , paramint2 : int ) : java.awt.ColorsetBackground ( paramColor1 : java.awt.Color ) : voidsetForeground ( paramColor1 : java.awt.Color ) : voidupdate ( paramGraphics1 : java.awt.Graphics ) : voidGameBackgroundCanvasaBooleanArray98 : [ZaColor75 : java.awt.ColoraGraphics85 : java.awt.GraphicsaStringArray100 : [Ljava.lang.String;aStringArray80 : [Ljava.lang.String;anInt99 : intanIntArray78 : [IanIntArray79 : [IanIntArrayArray97 : [[IbackgroundImg : java.awt.ImagedefaultTrackSettings : Stringimage : java.awt.ImageisSolidArrayIThink : [[BmapChars : StringtrackAdvertSize : inttrackAuthor : StringtrackComment : StringtrackFirstBest : StringtrackLastBest : StringtrackName : StringtrackRatings : [ItrackSettings : StringtrackSpecialSettings : [ZtrackStats : [ItrackTiles : [[IaddNotify () : voidcheckSolidTile ( paramint1 : int , paramint2 : int ) : voidcheckSolids () : voiddrawForegroundMap () : voiddrawMap ( paramint1 : int ) : voidexpandMap ( paramString1 : String ) : StringgenerateTrackInformation () : [Ljava.lang.String;generateTrackStatistics () : [[IgetTileAt ( paramint1 : int , paramint2 : int ) : java.awt.Imagemethod120 () : [Zmethod123 ( paramString1 : String , paramint2 : int ) : intmethod126 ( paramint1 : int , paramint2 : int ) : booleanmethod127 ( paramint1 : int , paramint2 : int ) : booleanmethod128 ( param[I1 : [I , paramint2 : int , paramint3 : int , paramint4 : int , paramint5 : int ) : voidmethod129 ( paramint1 : int , paramint2 : int , paramdouble3 : double ) : intpaint ( paramGraphics1 : java.awt.Graphics ) : voidparseMapCommands ( paramString1 : String ) : booleanparseMapInstruction ( paramString1 : String ) : booleanupdate ( paramGraphics1 : java.awt.Graphics ) : voidGameCanvasaBoolean2832 : booleanaBoolean2843 : booleanaBooleanArray2830 : [ZaBooleanArray2834 : [ZaColor2804 : java.awt.ColoraColor2805 : java.awt.ColoraDouble2798 : doubleaDouble2817 : doubleaDouble2818 : doubleaDouble2819 : doubleaDouble2820 : doubleaDoubleArray2821 : [DaDoubleArray2822 : [DaDoubleArray2828 : [DaDoubleArray2829 : [DaFont2803 : java.awt.FontaShortArrayArrayArray2825 : [[[SaString2835 : StringaSynchronizedBoolArray2831 : [Lagolf.SynchronizedBool;aThread2842 : ThreadaVectorArray2823 : [Ljava.util.Vector;aVectorArray2824 : [Ljava.util.Vector;allowCheating : booleananImage2840 : java.awt.ImageanImageArray2808 : [Ljava.awt.Image;anInt2799 : intanInt2809 : intanInt2810 : intanInt2811 : intanInt2816 : intanInt2833 : intanInt2838 : intanInt2839 : intanIntArray2837 : [IbackgroundColour : java.awt.ColorcolourAimLine : java.awt.ColorcurrentPlayerID : intcursorCrosshair : java.awt.CursorcursorDefault : java.awt.CursorgameState : intgraphics : java.awt.GraphicshackedX : doublehackedY : doubleisCheating : booleankeyCountMod4 : intmouseX : intmouseY : intplayerX : [DplayerY : [DdecodeCoords ( paramint1 : int , paramboolean2 : boolean , paramString3 : String ) : voiddoHackedStroke ( paramint1 : int , paramboolean2 : boolean , paramint3 : int , paramint4 : int , paramint5 : int ) : voiddoStroke ( paramint1 : int , paramboolean2 : boolean , paramint3 : int , paramint4 : int , paramint5 : int ) : voiddrawMap ( paramint1 : int ) : voiddrawTile ( paramint1 : int , paramint2 : int , paramGraphics3 : java.awt.Graphics , paramGraphics4 : java.awt.Graphics ) : voidendGame () : voidgetSynchronizedBool ( paramint1 : int ) : booleankeyPressed ( paramKeyEvent1 : java.awt.event.KeyEvent ) : void «synchronized»keyReleased ( paramKeyEvent1 : java.awt.event.KeyEvent ) : voidkeyTyped ( paramKeyEvent1 : java.awt.event.KeyEvent ) : voidmethod132 ( paramint1 : int , paramint2 : int , paramint3 : int ) : voidmethod134 () : booleanmethod135 ( paramint1 : int , paramboolean2 : boolean , paramboolean3 : boolean ) : voidmethod137 () : booleanmethod139 ( paramint1 : int ) : voidmethod142 () : Stringmethod145 ( paramint1 : int , paramboolean2 : boolean ) : voidmethod146 ( paramint1 : int , paramint2 : int , paramint3 : int ) : [Dmethod147 ( paramint1 : int , paramint2 : int ) : booleanmethod148 ( paramint1 : int , paramint2 : int ) : booleanmethod149 ( paramint1 : int , paramint2 : int , paramint3 : int ) : booleanmethod150 ( paramint1 : int , paramdouble2 : double ) : doublemethod151 ( paramint1 : int ) : doublemethod152 ( paramint1 : int , paramint2 : int , paramint3 : int , paramint4 : int , paramint5 : int , paramint6 : int , paramint7 : int , paramint8 : int , paramint9 : int , paramint10 : int , paramint11 : int , paramGraphics12 : java.awt.Graphics , paramGraphics13 : java.awt.Graphics ) : voidmethod153 ( paramint1 : int , paramint2 : int , paramint3 : int , paramint4 : int , paramGraphics5 : java.awt.Graphics , paramGraphics6 : java.awt.Graphics , paramint7 : int , paramint8 : int ) : doublemethod154 ( paramint1 : int , paramint2 : int , paramint3 : int , paramint4 : int ) : voidmethod155 ( paramboolean1 : boolean , paramint2 : int , paramint3 : int , paramint4 : int , paramGraphics5 : java.awt.Graphics , paramGraphics6 : java.awt.Graphics ) : voidmethod156 ( paramint1 : int , paramint2 : int , paramGraphics3 : java.awt.Graphics , paramGraphics4 : java.awt.Graphics , paramint5 : int , paramint6 : int , paramboolean7 : boolean ) : booleanmethod157 ( paramint1 : int , paramint2 : int ) : intmethod158 ( paramint1 : int , paramint2 : int , paramint3 : int , paramint4 : int , paramint5 : int , paramint6 : int , paramGraphics7 : java.awt.Graphics , paramGraphics8 : java.awt.Graphics , paramboolean9 : boolean , paramint10 : int ) : [Imethod159 ( paramint1 : int , paramint2 : int , paramGraphics3 : java.awt.Graphics , paramGraphics4 : java.awt.Graphics ) : voidmethod161 ( paramGraphics1 : java.awt.Graphics , paramint2 : int , paramdouble3 : double ) : voidmethod162 ( paramboolean1 : boolean ) : voidmethod163 ( paramGraphics1 : java.awt.Graphics , paramint2 : int , paramint3 : int , paramint4 : int , paramint5 : int ) : voidmethod164 ( paramint1 : int ) : voidmouseClicked ( paramMouseEvent1 : java.awt.event.MouseEvent ) : voidmouseDragged ( paramMouseEvent1 : java.awt.event.MouseEvent ) : voidmouseEntered ( paramMouseEvent1 : java.awt.event.MouseEvent ) : voidmouseExited ( paramMouseEvent1 : java.awt.event.MouseEvent ) : voidmouseMoved ( paramMouseEvent1 : java.awt.event.MouseEvent ) : voidmousePressed ( paramMouseEvent1 : java.awt.event.MouseEvent ) : void «synchronized»mouseReleased ( paramMouseEvent1 : java.awt.event.MouseEvent ) : voidparseMap ( paramString1 : String , paramString2 : String , paramint3 : int ) : booleanrestartGame () : voidrun () : voidstop () : voidupdate ( paramGraphics1 : java.awt.Graphics ) : voidGameChatPanelanIntArray330 : [IbuttonSay : com.aapeli.colorgui.ColorButtoncreated : booleangameExtra : intheight : inttextAreaChat : com.aapeli.multiuser.ChatTextAreatextFieldMessage : com.aapeli.client.InputTextFieldwidth : intactionPerformed ( paramActionEvent1 : java.awt.event.ActionEvent ) : voidaddBroadcastMessage ( paramString1 : String ) : voidaddMessage ( paramString1 : String ) : voidaddNotify () : voidaddSay ( paramint1 : int , paramString2 : String , paramString3 : String , paramboolean4 : boolean ) : voidcreate () : voidhaveFocus () : booleankeyPressed ( paramKeyEvent1 : java.awt.event.KeyEvent ) : voidkeyReleased ( paramKeyEvent1 : java.awt.event.KeyEvent ) : voidkeyTyped ( paramKeyEvent1 : java.awt.event.KeyEvent ) : voidmethod323 () : voidpaint ( paramGraphics1 : java.awt.Graphics ) : voidprintSpecialSettingstoTextArea ( paramString1 : String , paramString2 : String , param[Z3 : [Z ) : voidremoveUserColour ( paramString1 : String ) : voidsendMessage () : voidsetUserColour ( paramString1 : String , paramint2 : int ) : voidupdate ( paramGraphics1 : java.awt.Graphics ) : voidGameChatPanelanIntArray330 : [IbuttonSay : com.aapeli.colorgui.ColorButtoncreated : booleangameExtra : intheight : inttextAreaChat : com.aapeli.multiuser.ChatTextAreatextFieldMessage : com.aapeli.client.InputTextFieldwidth : intactionPerformed ( paramActionEvent1 : java.awt.event.ActionEvent ) : voidaddBroadcastMessage ( paramString1 : String ) : voidaddMessage ( paramString1 : String ) : voidaddNotify () : voidaddSay ( paramint1 : int , paramString2 : String , paramString3 : String , paramboolean4 : boolean ) : voidcreate () : voidhaveFocus () : booleankeyPressed ( paramKeyEvent1 : java.awt.event.KeyEvent ) : voidkeyReleased ( paramKeyEvent1 : java.awt.event.KeyEvent ) : voidkeyTyped ( paramKeyEvent1 : java.awt.event.KeyEvent ) : voidmethod323 () : voidpaint ( paramGraphics1 : java.awt.Graphics ) : voidprintSpecialSettingstoTextArea ( paramString1 : String , paramString2 : String , param[Z3 : [Z ) : voidremoveUserColour ( paramString1 : String ) : voidsendMessage () : voidsetUserColour ( paramString1 : String , paramint2 : int ) : voidupdate ( paramGraphics1 : java.awt.Graphics ) : voidGameControlPanelaStringArray351 : [Ljava.lang.String;anInt342 : intanInt343 : intbuttonBack : com.aapeli.colorgui.ColorButtonbuttonNewGame : com.aapeli.colorgui.ColorButtonbuttonSkip : com.aapeli.colorgui.ColorButtoncheckboxMaxFps : java.awt.CheckboxchoicerNames : com.aapeli.colorgui.ChoicerplayerCount : intskipButtonVisible : booleanactionPerformed ( paramActionEvent1 : java.awt.event.ActionEvent ) : voidaddNotify () : voiddisplaySkipButton () : voidhideSkipButton () : voiditemStateChanged ( paramItemEvent1 : java.awt.event.ItemEvent ) : voidmaxFps () : booleanmethod327 ( paramint1 : int ) : voidmethod329 () : voidmethod330 () : voidpaint ( paramGraphics1 : java.awt.Graphics ) : voidshowSkipButton () : voidupdate ( paramGraphics1 : java.awt.Graphics ) : voidGamePanelaBoolean363 : booleanaLong364 : longanObject365 : Objectheight : intisSinglePlayerGame : booleanisWaitingForTurn : booleanplayerCount : intstate : intwidth : intaddMultiPlayerPanels ( paramint1 : int ) : voidaddNotify () : voidbroadcastMessage ( paramString1 : String ) : voidcanStroke ( paramboolean1 : boolean ) : booleancreate ( paramImage1 : java.awt.Image ) : voidencodeCoords ( paramint1 : int , paramint2 : int , paramint3 : int ) : StringgetPlayerInfo ( paramint1 : int ) : [Ljava.lang.String;hideSkipButton () : voidisValidPlayerID ( paramint1 : int ) : booleanmaxFps () : booleanmethod333 ( paramString;1 : [Ljava.lang.String; ) : voidmethod336 () : voidmethod339 ( paramboolean1 : boolean ) : booleanmethod342 () : voidmethod345 ( paramint1 : int ) : voidmethod348 ( paramint1 : int ) : voidpaint ( paramGraphics1 : java.awt.Graphics ) : voidrateTrack ( paramint1 : int , paramint2 : int ) : voidrequestNewGame () : voidrespondNewGame ( paramint1 : int , paramboolean2 : boolean ) : voidsendChatMessage ( paramString1 : String ) : voidsendEndStroke ( paramint1 : int , paramSynchronizedBool;2 : [Lagolf.SynchronizedBool; , paramint3 : int ) : voidsetBeginStroke ( paramint1 : int , paramint2 : int , paramint3 : int , paramint4 : int ) : voidupdate ( paramGraphics1 : java.awt.Graphics ) : voidGamePlayerInfoPanelaBoolean380 : booleanaBooleanArray396 : [ZaChoicer399 : com.aapeli.colorgui.ChoiceraColor371 : java.awt.ColoraColor372 : java.awt.ColoraColor373 : java.awt.ColoraColor374 : java.awt.ColoraColorArrayArray375 : [[Ljava.awt.Color;anInt376 : intanInt382 : intanInt383 : intanInt385 : intanInt386 : intanIntArray394 : [IanIntArray397 : [IanIntArrayArray398 : [[IcurrentPlayerId : intcurrentTimeForShot : intfontDialog10 : java.awt.FontfontDialog12 : java.awt.FontfontDialog12b : java.awt.FontgameOutcome : [Igraphics : java.awt.Graphicsheight : intimage : java.awt.ImageplayerClans : [Ljava.lang.String;playerCount : intplayerID : intplayerNames : [Ljava.lang.String;playerVotedToSkip : [ZplayersId : [Lagolf.SynchronizedInteger;strokeTimeout : inttrackStrokes : [[Lagolf.SynchronizedInteger;width : intaddNotify () : voidaddPlayer ( paramint1 : int , paramString2 : String , paramString3 : String , paramboolean4 : boolean ) : voidcanShoot ( paramint1 : int ) : booleangetPlayerInfo ( paramint1 : int ) : [Ljava.lang.String;itemStateChanged ( paramItemEvent1 : java.awt.event.ItemEvent ) : voidmethod355 ( paramint1 : int , paramint2 : int , paramint3 : int , paramint4 : int , paramint5 : int ) : voidmethod356 ( param[I1 : [I ) : voidmethod358 ( paramint1 : int , paramint2 : int ) : booleanmethod359 () : voidmethod360 () : intmethod361 ( paramint1 : int ) : booleanmethod363 ( paramint1 : int , paramboolean2 : boolean ) : voidmethod366 () : voidmethod371 ( paramint1 : int ) : voidmethod372 () : voidmethod374 () : [Ljava.lang.String;method375 ( param[[I1 : [[I ) : voidmethod376 () : booleanmethod377 () : intmethod379 () : [ImouseClicked ( paramMouseEvent1 : java.awt.event.MouseEvent ) : voidmouseEntered ( paramMouseEvent1 : java.awt.event.MouseEvent ) : voidmouseExited ( paramMouseEvent1 : java.awt.event.MouseEvent ) : voidmousePressed ( paramMouseEvent1 : java.awt.event.MouseEvent ) : voidmouseReleased ( paramMouseEvent1 : java.awt.event.MouseEvent ) : voidpaint ( paramGraphics1 : java.awt.Graphics ) : voidreadyForNewGame ( paramint1 : int ) : voidreadyForNewGameLocal () : voidrun () : booleansetScores ( paramint1 : int , param[I2 : [I ) : voidstop () : voidupdate ( paramGraphics1 : java.awt.Graphics ) : voidvoteSkip ( paramint1 : int ) : voidvoteSkipReset () : voidGamePlayerInfoPanelThreadrunning : booleanrun () : voidstopRunning () : voidGameTrackInfoPanelaBoolean436 : booleanaBoolean437 : booleanbuttonAccept : com.aapeli.colorgui.ColorButtonbuttonNoVote : com.aapeli.colorgui.ColorButtonbuttonR : com.aapeli.colorgui.ColorButtonbuttonReject : com.aapeli.colorgui.ColorButtonbuttonsVote : [Lcom.aapeli.colorgui.ColorButton;created : booleancurrentTrack : intfirstBestPlayerDate : StringfirstBestPlayerName : StringfontDialog11 : java.awt.FontfontDialog12 : java.awt.FontfontDialog14 : java.awt.FontfontSerif16 : java.awt.Fontgraphics : java.awt.GraphicshasNotRatedTrack : booleanheight : intimage : java.awt.ImagelastBestPlayerDate : StringlastBestPlayerName : StringnumTracks : intresultAverage : doubleresultBestNumStrokes : intresultBestPercent : doubleshowLongAvgResult : booleantrackAuthor : StringtrackAverageRating : doubletrackName : StringtrackPending : booleantrackRating : inttrackTotalRatings : intvoteColours : [Ljava.awt.Color;width : intactionPerformed ( paramActionEvent1 : java.awt.event.ActionEvent ) : voidaddNotify () : voidcreate () : voidmethod384 () : voidmethod385 () : intmethod388 ( paramboolean1 : boolean ) : voidmethod390 ( paramboolean1 : boolean ) : voidmethod391 ( paramboolean1 : boolean ) : voidpaint ( paramGraphics1 : java.awt.Graphics ) : voidparseBestPlayerInformation ( paramString1 : String ) : [Ljava.lang.String;parseTrackInfoStats ( paramString1 : String , paramString2 : String , param[I3 : [I , param[I4 : [I , paramString5 : String , paramString6 : String , paramboolean7 : boolean , paramboolean8 : boolean , paramboolean9 : boolean ) : voidresetCurrentTrack () : voidtoggleAcceptRejectButtons ( paramboolean1 : boolean ) : voidupdate ( paramGraphics1 : java.awt.Graphics ) : voidGamePlayerInfoPanelaBoolean380 : booleanaBooleanArray396 : [ZaChoicer399 : com.aapeli.colorgui.ChoiceraColor371 : java.awt.ColoraColor372 : java.awt.ColoraColor373 : java.awt.ColoraColor374 : java.awt.ColoraColorArrayArray375 : [[Ljava.awt.Color;anInt376 : intanInt382 : intanInt383 : intanInt385 : intanInt386 : intanIntArray394 : [IanIntArray397 : [IanIntArrayArray398 : [[IcurrentPlayerId : intcurrentTimeForShot : intfontDialog10 : java.awt.FontfontDialog12 : java.awt.FontfontDialog12b : java.awt.FontgameOutcome : [Igraphics : java.awt.Graphicsheight : intimage : java.awt.ImageplayerClans : [Ljava.lang.String;playerCount : intplayerID : intplayerNames : [Ljava.lang.String;playerVotedToSkip : [ZplayersId : [Lagolf.SynchronizedInteger;strokeTimeout : inttrackStrokes : [[Lagolf.SynchronizedInteger;width : intaddNotify () : voidaddPlayer ( paramint1 : int , paramString2 : String , paramString3 : String , paramboolean4 : boolean ) : voidcanShoot ( paramint1 : int ) : booleangetPlayerInfo ( paramint1 : int ) : [Ljava.lang.String;itemStateChanged ( paramItemEvent1 : java.awt.event.ItemEvent ) : voidmethod355 ( paramint1 : int , paramint2 : int , paramint3 : int , paramint4 : int , paramint5 : int ) : voidmethod356 ( param[I1 : [I ) : voidmethod358 ( paramint1 : int , paramint2 : int ) : booleanmethod359 () : voidmethod360 () : intmethod361 ( paramint1 : int ) : booleanmethod363 ( paramint1 : int , paramboolean2 : boolean ) : voidmethod366 () : voidmethod371 ( paramint1 : int ) : voidmethod372 () : voidmethod374 () : [Ljava.lang.String;method375 ( param[[I1 : [[I ) : voidmethod376 () : booleanmethod377 () : intmethod379 () : [ImouseClicked ( paramMouseEvent1 : java.awt.event.MouseEvent ) : voidmouseEntered ( paramMouseEvent1 : java.awt.event.MouseEvent ) : voidmouseExited ( paramMouseEvent1 : java.awt.event.MouseEvent ) : voidmousePressed ( paramMouseEvent1 : java.awt.event.MouseEvent ) : voidmouseReleased ( paramMouseEvent1 : java.awt.event.MouseEvent ) : voidpaint ( paramGraphics1 : java.awt.Graphics ) : voidreadyForNewGame ( paramint1 : int ) : voidreadyForNewGameLocal () : voidrun () : booleansetScores ( paramint1 : int , param[I2 : [I ) : voidstop () : voidupdate ( paramGraphics1 : java.awt.Graphics ) : voidvoteSkip ( paramint1 : int ) : voidvoteSkipReset () : voidGamePlayerInfoPanelThreadrunning : booleanrun () : voidstopRunning () : voidGameTrackInfoPanelaBoolean436 : booleanaBoolean437 : booleanbuttonAccept : com.aapeli.colorgui.ColorButtonbuttonNoVote : com.aapeli.colorgui.ColorButtonbuttonR : com.aapeli.colorgui.ColorButtonbuttonReject : com.aapeli.colorgui.ColorButtonbuttonsVote : [Lcom.aapeli.colorgui.ColorButton;created : booleancurrentTrack : intfirstBestPlayerDate : StringfirstBestPlayerName : StringfontDialog11 : java.awt.FontfontDialog12 : java.awt.FontfontDialog14 : java.awt.FontfontSerif16 : java.awt.Fontgraphics : java.awt.GraphicshasNotRatedTrack : booleanheight : intimage : java.awt.ImagelastBestPlayerDate : StringlastBestPlayerName : StringnumTracks : intresultAverage : doubleresultBestNumStrokes : intresultBestPercent : doubleshowLongAvgResult : booleantrackAuthor : StringtrackAverageRating : doubletrackName : StringtrackPending : booleantrackRating : inttrackTotalRatings : intvoteColours : [Ljava.awt.Color;width : intactionPerformed ( paramActionEvent1 : java.awt.event.ActionEvent ) : voidaddNotify () : voidcreate () : voidmethod384 () : voidmethod385 () : intmethod388 ( paramboolean1 : boolean ) : voidmethod390 ( paramboolean1 : boolean ) : voidmethod391 ( paramboolean1 : boolean ) : voidpaint ( paramGraphics1 : java.awt.Graphics ) : voidparseBestPlayerInformation ( paramString1 : String ) : [Ljava.lang.String;parseTrackInfoStats ( paramString1 : String , paramString2 : String , param[I3 : [I , param[I4 : [I , paramString5 : String , paramString6 : String , paramboolean7 : boolean , paramboolean8 : boolean , paramboolean9 : boolean ) : voidresetCurrentTrack () : voidtoggleAcceptRejectButtons ( paramboolean1 : boolean ) : voidupdate ( paramGraphics1 : java.awt.Graphics ) : voidHackedShotaBoolean2832 : booleanaBoolean2843 : booleanaBooleanArray2830 : [ZaBooleanArray2834 : [ZaDouble2798 : doubleaDouble2817 : doubleaDouble2818 : doubleaDouble2819 : doubleaDouble2820 : doubleaDoubleArray2821 : [DaDoubleArray2822 : [DaDoubleArray2828 : [DaDoubleArray2829 : [DaShortArrayArrayArray2825 : [[[SaSynchronizedBoolArray2831 : [Lagolf.SynchronizedBool;aVectorArray2823 : [Ljava.util.Vector;aVectorArray2824 : [Ljava.util.Vector;anInt2799 : intanInt2809 : intanInt2810 : intanInt2811 : intanInt2816 : intanInt2838 : intanInt2839 : intanIntArray2837 : [IcurrentPlayerID : intisSolidArrayIThink : [[BmapTiles : [[IplayerX : [DplayerY : [DgetHackedCoordintes () : [Dmethod145 ( paramint1 : int , paramboolean2 : boolean ) : voidmethod147 ( paramint1 : int , paramint2 : int ) : booleanmethod148 ( paramint1 : int , paramint2 : int ) : booleanmethod149 ( paramint1 : int , paramint2 : int , paramint3 : int ) : booleanmethod150 ( paramint1 : int , paramdouble2 : double ) : doublemethod151 ( paramint1 : int ) : doublemethod152 ( paramint1 : int , paramint2 : int , paramint3 : int , paramint4 : int , paramint5 : int , paramint6 : int , paramint7 : int , paramint8 : int , paramint9 : int , paramint10 : int , paramint11 : int ) : voidmethod153 ( paramint1 : int , paramint2 : int , paramint3 : int , paramint4 : int , paramint5 : int , paramint6 : int ) : doublemethod154 ( paramint1 : int , paramint2 : int , paramint3 : int , paramint4 : int ) : voidmethod155 ( paramboolean1 : boolean , paramint2 : int , paramint3 : int , paramint4 : int ) : voidmethod156 ( paramint1 : int , paramint2 : int , paramint3 : int , paramint4 : int , paramboolean5 : boolean ) : booleanmethod157 ( paramint1 : int , paramint2 : int ) : intmethod158 ( paramint1 : int , paramint2 : int , paramint3 : int , paramint4 : int , paramint5 : int , paramint6 : int , paramboolean7 : boolean , paramint8 : int ) : [Imethod159 ( paramint1 : int , paramint2 : int ) : voidmethod164 ( paramint1 : int ) : voidrun () : voidLobbyChatPanelaBoolean3712 : booleanaBoolean3713 : booleanaBoolean3714 : booleanlobbyId : intgetUser ( paramString1 : String , paramboolean2 : boolean ) : voidhandlePacket ( paramString;1 : [Ljava.lang.String; ) : booleanlocalUserAdminCommand ( paramString1 : String , paramString2 : String ) : voidlocalUserAdminCommand ( paramString1 : String , paramString2 : String , paramString3 : String ) : voidlocalUserSay ( paramString1 : String ) : voidlocalUserSay ( paramint1 : int , paramString2 : String ) : voidlocalUserSayPrivately ( paramString1 : String , paramString2 : String ) : voidLobbyControlPanelbuttonBack : com.aapeli.colorgui.ColorButtonbuttonMulti : com.aapeli.colorgui.ColorButtonbuttonQuit : com.aapeli.colorgui.ColorButtonbuttonSingle : com.aapeli.colorgui.ColorButtonheight : intwidth : intactionPerformed ( paramActionEvent1 : java.awt.event.ActionEvent ) : voidaddNotify () : voidcreate () : voidpaint ( paramGraphics1 : java.awt.Graphics ) : voidsetState ( paramint1 : int ) : voidupdate ( paramGraphics1 : java.awt.Graphics ) : voidgameContaineraSeed_2836gameContainergameContainergameContaineraGamePlayerInfoPanel__341aGamePlayerInfoPanel__341gameCanvasgameChatPanelgameChatPanelgameControlPanelgamePlayerInfoPanelgameTrackInfoPanelgameContainerpanelThreadgamePlayerInfoPanelgameContainerbuttonBackplayerInfoPanelgameTrackInfoPanelgameContainerpanelThreadplayerInfoPanelgameContainerbuttonBackaSeed_2836gameContainergameContainer