Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add and configure Maven Spotless plugin for formatting #124

Merged
merged 4 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This file keeps `git blame` clean.
# See https://docs.github.com/en/repositories/working-with-files/using-files/viewing-a-file#ignore-commits-in-the-blame-view

# Reformat the codebase with Spotless
6e262ce1d8d66ac83af70b557269f1ed584f7438
52 changes: 28 additions & 24 deletions client/pom.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<artifactId>client</artifactId>
<version>2.2.1.0-BETA</version>

<parent>
<groupId>org.moparforia</groupId>
<artifactId>playforia-minigolf</artifactId>
<version>2.2.1.0-BETA</version>
</parent>

<artifactId>client</artifactId>
<version>2.2.1.0-BETA</version>

<properties>
<project.mainClass>org.moparforia.client.Launcher</project.mainClass>
<project.name>Playforia Minigolf Client</project.name>
Expand Down Expand Up @@ -87,16 +87,16 @@
<version>1.9.0</version>
<executions>
<execution>
<id>download-osx-jre</id>
<phase>package</phase>
<goals>
<goal>wget</goal>
</goals>
<configuration>
<url>${project.jre.osx.link}</url>
<unpack>true</unpack>
<outputDirectory>${project.download.directory}</outputDirectory>
</configuration>
<id>download-osx-jre</id>
<goals>
<goal>wget</goal>
</goals>
<phase>package</phase>
<configuration>
<url>${project.jre.osx.link}</url>
<unpack>true</unpack>
<outputDirectory>${project.download.directory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
Expand All @@ -111,22 +111,22 @@
<generateDiskImageFile>true</generateDiskImageFile>
<jrePath>${project.download.directory}/${project.jre.osx.name}</jrePath>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-tools</artifactId>
<version>2.0</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>osx-build</id>
<phase>package</phase>
<goals>
<goal>bundle</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-tools</artifactId>
<version>2.0</version>
</dependency>
</dependencies>
</plugin>

<plugin>
Expand All @@ -135,10 +135,10 @@
<executions>
<execution>
<id>windows-build</id>
<phase>package</phase>
<goals>
<goal>launch4j</goal>
</goals>
<phase>package</phase>
<configuration>
<headerType>gui</headerType>
<jar>${project.build.directory}/${project.artifactId}-${project.version}.jar</jar>
Expand Down Expand Up @@ -170,8 +170,8 @@
</executions>
</plugin>
<plugin>
<artifactId>plantuml-generator-maven-plugin</artifactId>
<groupId>de.elnarion.maven</groupId>
<artifactId>plantuml-generator-maven-plugin</artifactId>
<version>2.4.1</version>
<executions>
<execution>
Expand All @@ -191,6 +191,10 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

Expand Down
1 change: 0 additions & 1 deletion client/src/main/java/agolf/AGolf.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ public class AGolf extends GameApplet {
public String getAppletInfo() {
return "-= AGolf =-\nCopyright (c) 2002-2012 Playforia (www.playforia.info)\nProgramming: Pasi Laaksonen\nGraphics: Janne Matilainen";
}

}
30 changes: 16 additions & 14 deletions client/src/main/java/agolf/GameApplet.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@
import com.aapeli.client.Parameters;
import com.aapeli.client.SoundManager;
import com.aapeli.client.TextManager;
import org.moparforia.client.Launcher;

import java.awt.Color;
import java.awt.Font;
import java.awt.Image;
import org.moparforia.client.Launcher;

public class GameApplet extends AApplet {

Expand All @@ -41,7 +40,6 @@ public class GameApplet extends AApplet {
private Image anImage3774;
private boolean verbose = false;


public void initApplet(Parameters parameters) {
this.syncIsValidSite = new SynchronizedBool(this.isValidSite());
this.setBackground(colourGameBackground);
Expand Down Expand Up @@ -71,7 +69,7 @@ public void defineImages(ImageManager imageManager, String var2) {
imageManager.defineImage("elements.gif");
imageManager.defineImage("special.gif");
imageManager.defineImage("balls.gif");
imageManager.defineSharedImage("ranking-icons.gif");// TODO
imageManager.defineSharedImage("ranking-icons.gif"); // TODO
imageManager.defineSharedImage("language-flags.png"); // TODO
imageManager.defineSharedImage("credit-background.jpg"); // TODO
imageManager.defineSharedImage("bigtext.gif"); // TODO
Expand All @@ -82,7 +80,6 @@ public void defineImages(ImageManager imageManager, String var2) {
imageManager.defineImage("ad" + i, this.gameContainer.adverts[i]);
}
}

}

public void createImages() {
Expand All @@ -95,12 +92,11 @@ public void connectToServer() {
if (!this.gameContainer.connection.openSocketConnection()) {
this.setEndState(END_ERROR_CONNECTION);
}

}

public void appletReady() {
this.gameContainer.autoPopup = new AutoPopups(this);
//this.setGameSettings(false, 0, false, true); // disabled Bad Word Filter!
// this.setGameSettings(false, 0, false, true); // disabled Bad Word Filter!
this.setGameSettings(false, 0, true, true); // enabled Bad Word Filter!
this.gameContainer.trackCollection = new TrackCollection();
this.anImage3774 = this.createImage(735, 375);
Expand Down Expand Up @@ -128,7 +124,8 @@ protected void setGameState(int state, int lobbyId) {
}

/**
* @param activePanel 0 == ?, 1 == login, 2 == lobby selection panel, 3 == in lobby, 4 == in game
* @param activePanel 0 == ?, 1 == login, 2 == lobby selection panel, 3 == in lobby, 4 == in
* game
* @param lobbyId game type, single player == 1, dual player == 2, multiplayer == 3
*/
protected void setGameState(int activePanel, int lobbyId, int lobbyExtra) {
Expand All @@ -145,12 +142,14 @@ protected void setGameState(int activePanel, int lobbyId, int lobbyExtra) {
} else {
this.aBoolean3773 = true;
}
//System.out.println(hasSession() + " " + gameContainer.synchronizedTrackTestMode.get());
// System.out.println(hasSession() + " " +
// gameContainer.synchronizedTrackTestMode.get());

if (Launcher.isUsingCustomServer()) {
String username = param.getUsername();
if (username == null) {
TrackTestLoginPanel loginPanel = new TrackTestLoginPanel(this, super.appletWidth, super.appletHeight);
TrackTestLoginPanel loginPanel =
new TrackTestLoginPanel(this, super.appletWidth, super.appletHeight);
loginPanel.setLocation(0, 0);
this.addToContent(loginPanel);
} else {
Expand All @@ -170,7 +169,8 @@ protected void setGameState(int activePanel, int lobbyId, int lobbyExtra) {

if (activePanel == 2) {
if (this.gameContainer.lobbySelectionPanel == null) {
this.gameContainer.lobbySelectionPanel = new LobbySelectPanel(this.gameContainer, super.appletWidth, super.appletHeight);
this.gameContainer.lobbySelectionPanel =
new LobbySelectPanel(this.gameContainer, super.appletWidth, super.appletHeight);
this.gameContainer.lobbySelectionPanel.setLocation(0, 0);
}

Expand Down Expand Up @@ -198,7 +198,8 @@ protected void setGameState(int activePanel, int lobbyId, int lobbyExtra) {
if (activePanel == 3) {
this.gameContainer.gamePanel = null;
if (this.gameContainer.lobbyPanel == null) {
this.gameContainer.lobbyPanel = new LobbyPanel(this.gameContainer, super.appletWidth, super.appletHeight);
this.gameContainer.lobbyPanel =
new LobbyPanel(this.gameContainer, super.appletWidth, super.appletHeight);
this.gameContainer.lobbyPanel.setLocation(0, 0);
}

Expand All @@ -214,13 +215,14 @@ protected void setGameState(int activePanel, int lobbyId, int lobbyExtra) {
}

if (activePanel == 4) {
this.gameContainer.gamePanel = new GamePanel(this.gameContainer, super.appletWidth, super.appletHeight, this.anImage3774);
this.gameContainer.gamePanel =
new GamePanel(this.gameContainer, super.appletWidth, super.appletHeight, this.anImage3774);
this.gameContainer.gamePanel.setLocation(0, 0);
this.addToContent(this.gameContainer.gamePanel);
}

if (activePanel == 5) {
//super.param.showQuitPage();
// super.param.showQuitPage();
System.exit(0);
} else {
this.contentReady();
Expand Down
4 changes: 1 addition & 3 deletions client/src/main/java/agolf/GameContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import com.aapeli.client.TextManager;
import com.aapeli.tools.Tools;

public class GameContainer {// some kind of a container for everything
public class GameContainer { // some kind of a container for everything

public GameApplet gameApplet;
public Parameters params;
Expand All @@ -33,7 +33,6 @@ public class GameContainer {// some kind of a container for everything
public GamePanel gamePanel;
public int graphicsQualityIndex;


public GameContainer(GameApplet gameApplet, Parameters params) {
this.gameApplet = gameApplet;
this.params = params;
Expand All @@ -50,7 +49,6 @@ protected void destroy() {
if (this.connection != null) {
this.connection.disconnect();
}

}

private void init() {
Expand Down
Loading