Skip to content

Commit dfe07a6

Browse files
committed
[ANY] IDEA Code clean
1 parent 74b84d3 commit dfe07a6

19 files changed

Lines changed: 62 additions & 65 deletions

File tree

build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ group = "com.gravitlauncher.launcher"
88
version = "5.7.0-SNAPSHOT"
99

1010

11-
val myVersion = version;
11+
val myVersion = version
1212
subprojects {
1313
apply(plugin = "java")
1414
apply(plugin = "java-library")
1515

16-
project.version = myVersion;
16+
project.version = myVersion
1717

1818
java {
1919
withSourcesJar()

components/launcher-api/src/main/java/pro/gravit/launcher/base/profiles/ClientProfile.java

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -20,51 +20,51 @@ public final class ClientProfile implements Comparable<ClientProfile>, ProfileFe
2020
private static final FileNameMatcher ASSET_MATCHER = new FileNameMatcher(
2121
new String[0], new String[]{"indexes", "objects"}, new String[0]);
2222
@LauncherNetworkAPI
23-
private String title;
23+
private final String title;
2424
@LauncherNetworkAPI
25-
private UUID uuid;
25+
private final UUID uuid;
2626
@LauncherNetworkAPI
27-
private Version version;
27+
private final Version version;
2828
@LauncherNetworkAPI
29-
private String info;
29+
private final String info;
3030
@LauncherNetworkAPI
31-
private String dir;
31+
private final String dir;
3232
@LauncherNetworkAPI
33-
private int sortIndex;
33+
private final int sortIndex;
3434
@LauncherNetworkAPI
35-
private String assetIndex;
35+
private final String assetIndex;
3636
@LauncherNetworkAPI
37-
private String assetDir;
37+
private final String assetDir;
3838
// Updater and client watch service
3939
@LauncherNetworkAPI
40-
private List<String> update;
40+
private final List<String> update;
4141
@LauncherNetworkAPI
42-
private List<String> updateExclusions;
42+
private final List<String> updateExclusions;
4343
@LauncherNetworkAPI
44-
private List<String> updateVerify;
44+
private final List<String> updateVerify;
4545
@LauncherNetworkAPI
46-
private Set<OptionalFile> updateOptional;
46+
private final Set<OptionalFile> updateOptional;
4747
@LauncherNetworkAPI
48-
private List<String> jvmArgs;
48+
private final List<String> jvmArgs;
4949
@LauncherNetworkAPI
50-
private List<String> classPath;
50+
private final List<String> classPath;
5151
@LauncherNetworkAPI
52-
private List<String> altClassPath;
52+
private final List<String> altClassPath;
5353
@LauncherNetworkAPI
54-
private List<String> clientArgs;
54+
private final List<String> clientArgs;
5555
@LauncherNetworkAPI
56-
private List<String> compatClasses;
56+
private final List<String> compatClasses;
5757
@LauncherNetworkAPI
58-
private List<String> loadNatives;
58+
private final List<String> loadNatives;
5959
@LauncherNetworkAPI
60-
private Map<String, String> properties;
60+
private final Map<String, String> properties;
6161
@LauncherNetworkAPI
62-
private List<ServerProfile> servers;
62+
private final List<ServerProfile> servers;
6363
@LauncherNetworkAPI
64-
private ClassLoaderConfig classLoaderConfig;
64+
private final ClassLoaderConfig classLoaderConfig;
6565

6666
@LauncherNetworkAPI
67-
private List<CompatibilityFlags> flags;
67+
private final List<CompatibilityFlags> flags;
6868
@LauncherNetworkAPI
6969
private int recommendJavaVersion = 8;
7070
@LauncherNetworkAPI
@@ -74,14 +74,14 @@ public final class ClientProfile implements Comparable<ClientProfile>, ProfileFe
7474
@LauncherNetworkAPI
7575
private ProfileDefaultSettings settings = new ProfileDefaultSettings();
7676
@LauncherNetworkAPI
77-
private boolean limited;
77+
private final boolean limited;
7878
// Client launcher
7979
@LauncherNetworkAPI
80-
private String mainClass;
80+
private final String mainClass;
8181
@LauncherNetworkAPI
82-
private String mainModule;
82+
private final String mainModule;
8383
@LauncherNetworkAPI
84-
private LaunchOptions.ModuleConf moduleConf;
84+
private final LaunchOptions.ModuleConf moduleConf;
8585

8686
public ClientProfile(String title, UUID uuid, Version version, String info, String dir, int sortIndex, String assetIndex, String assetDir, List<String> update, List<String> updateExclusions, List<String> updateVerify, Set<OptionalFile> updateOptional, List<String> jvmArgs, List<String> classPath, List<String> altClassPath, List<String> clientArgs, List<String> compatClasses, List<String> loadNatives, Map<String, String> properties, List<ServerProfile> servers, ClassLoaderConfig classLoaderConfig, List<CompatibilityFlags> flags, int recommendJavaVersion, int minJavaVersion, int maxJavaVersion, ProfileDefaultSettings settings, boolean limited, String mainClass, String mainModule, LaunchOptions.ModuleConf moduleConf) {
8787
this.title = title;

components/launcher-api/src/main/java/pro/gravit/launcher/base/request/RequestFeatureAPIImpl.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,15 @@ public CompletableFuture<AuthResponse> auth(String login, AuthMethodPassword pas
7171

7272
private AuthRequest.AuthPasswordInterface convertAuthPasswordAll(AuthMethodPassword password) {
7373
AuthRequest.AuthPasswordInterface requestPassword;
74-
if(password instanceof AuthChainPassword chain) {
75-
if(chain.list().size() == 1) {
76-
requestPassword = convertAuthPassword(chain.list().get(0));
77-
} else if(chain.list().size() == 2) {
78-
requestPassword = new Auth2FAPassword(convertAuthPassword(chain.list().get(0)),
79-
convertAuthPassword(chain.list().get(1)));
74+
if(password instanceof AuthChainPassword(List<AuthMethodPassword> list)) {
75+
if(list.size() == 1) {
76+
requestPassword = convertAuthPassword(list.get(0));
77+
} else if(list.size() == 2) {
78+
requestPassword = new Auth2FAPassword(convertAuthPassword(list.get(0)),
79+
convertAuthPassword(list.get(1)));
8080
} else {
8181
var multi = new AuthMultiPassword();
82-
for(var e : chain.list()) {
82+
for(var e : list) {
8383
multi.list.add(convertAuthPassword(e));
8484
}
8585
requestPassword = multi;
@@ -91,21 +91,21 @@ private AuthRequest.AuthPasswordInterface convertAuthPasswordAll(AuthMethodPassw
9191
}
9292

9393
private AuthRequest.AuthPasswordInterface convertAuthPassword(AuthMethodPassword password) {
94-
if(password instanceof AuthPlainPassword plain) {
94+
if(password instanceof AuthPlainPassword(String value)) {
9595
String encryptKey = Launcher.getConfig().passwordEncryptKey;
9696
if(encryptKey != null) {
9797
try {
98-
return new AuthAESPassword(SecurityHelper.encrypt(encryptKey, plain.value()));
98+
return new AuthAESPassword(SecurityHelper.encrypt(encryptKey, value));
9999
} catch (Exception e) {
100100
throw new RuntimeException(e);
101101
}
102102
} else {
103-
return new pro.gravit.launcher.base.request.auth.password.AuthPlainPassword(plain.value());
103+
return new pro.gravit.launcher.base.request.auth.password.AuthPlainPassword(value);
104104
}
105-
} else if(password instanceof AuthTotpPassword totp) {
106-
return new AuthTOTPPassword(totp.value());
107-
} else if(password instanceof AuthOAuthPassword oauth) {
108-
return new AuthCodePassword(oauth.redirectUrl());
105+
} else if(password instanceof AuthTotpPassword(String value)) {
106+
return new AuthTOTPPassword(value);
107+
} else if(password instanceof AuthOAuthPassword(String redirectUrl)) {
108+
return new AuthCodePassword(redirectUrl);
109109
} else if(password instanceof AuthRequest.AuthPasswordInterface custom) {
110110
return custom;
111111
} else if(password == null) {

components/launcher-core/src/main/java/pro/gravit/utils/helper/CommonHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ public record ArgsParseResult(LaunchOptions.ModuleConf conf, List<String> classp
273273
}
274274

275275
private enum PrevArgType {
276-
NONE, MODULE_PATH, ADD_MODULES, ADD_OPENS, ADD_EXPORTS, ADD_READS, CLASSPATH, POST_CLASSPATH, JAR, MAINCLASS, MODULE;
276+
NONE, MODULE_PATH, ADD_MODULES, ADD_OPENS, ADD_EXPORTS, ADD_READS, CLASSPATH, POST_CLASSPATH, JAR, MAINCLASS, MODULE
277277
}
278278

279279
private static class ByteArrayToBase64TypeAdapter implements JsonSerializer<byte[]>, JsonDeserializer<byte[]> {

components/launcher-core/src/main/java/pro/gravit/utils/launch/ModuleLaunch.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ private static String getPackageFromClass(String clazz) {
193193

194194
private class CustomModuleFinder implements ModuleFinder {
195195
private final ModuleFinder delegate;
196-
private AtomicReference<ModuleClassLoader> cl;
196+
private final AtomicReference<ModuleClassLoader> cl;
197197

198198
public CustomModuleFinder(ModuleFinder delegate, AtomicReference<ModuleClassLoader> cl) {
199199
this.delegate = delegate;

components/launcher-core/src/test/java/pro/gravit/launcher/SecurityHelperTests.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ public void aesStreamTest() throws Exception {
3535
}
3636
encrypted = s.toByteArray();
3737
byte[] decrypted;
38-
;
3938
try(InputStream i = new CipherInputStream(new ByteArrayInputStream(encrypted), SecurityHelper.newAESDecryptCipher(seed))) {
4039
ByteArrayOutputStream s2 = new ByteArrayOutputStream();
4140
try(s2) {

components/launcher-runtime/src/main/java/pro/gravit/launcher/runtime/backend/ClientDownloadImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import java.util.function.Function;
2828

2929
public class ClientDownloadImpl {
30-
private LauncherBackendImpl backend;
30+
private final LauncherBackendImpl backend;
3131

3232
ClientDownloadImpl(LauncherBackendImpl backend) {
3333
this.backend = backend;

components/launcher-runtime/src/main/java/pro/gravit/launcher/runtime/backend/EncryptedVfsFile.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
import java.security.NoSuchAlgorithmException;
1919

2020
public class EncryptedVfsFile extends VfsFile {
21-
private VfsFile parent;
21+
private final VfsFile parent;
2222
private final String alg;
2323
private final SecretKeySpec sKeySpec;
2424
private final IvParameterSpec iKeySpec;

components/launcher-runtime/src/main/java/pro/gravit/launcher/runtime/backend/ReadyProfileImpl.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
import java.util.ArrayList;
2020

2121
public class ReadyProfileImpl implements LauncherBackendAPI.ReadyProfile {
22-
private LauncherBackendImpl backend;
22+
private final LauncherBackendImpl backend;
2323
private ClientProfile profile;
24-
private ProfileSettingsImpl settings;
25-
private ClientDownloadImpl.DownloadedDir clientDir;
26-
private ClientDownloadImpl.DownloadedDir assetDir;
27-
private ClientDownloadImpl.DownloadedDir javaDir;
24+
private final ProfileSettingsImpl settings;
25+
private final ClientDownloadImpl.DownloadedDir clientDir;
26+
private final ClientDownloadImpl.DownloadedDir assetDir;
27+
private final ClientDownloadImpl.DownloadedDir javaDir;
2828
private volatile Thread writeParamsThread;
2929
private volatile Thread runThread;
3030
private volatile ClientLauncherProcess process;

components/launchserver/build.gradle.kts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar.Companion.shadowJar
2-
import java.util.jar.JarFile
31

42
plugins {
53
id("application")

0 commit comments

Comments
 (0)