[ANY] IDEA Inspect Code

This commit is contained in:
Gravit 2019-10-19 23:43:25 +07:00
parent 8ba00d106e
commit 9a4b813bb7
No known key found for this signature in database
GPG key ID: 061981E1E85D3216
139 changed files with 319 additions and 454 deletions

View file

@ -27,6 +27,7 @@
import java.util.Set; import java.util.Set;
import java.util.Timer; import java.util.Timer;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Stream;
import org.bouncycastle.crypto.util.PrivateKeyFactory; import org.bouncycastle.crypto.util.PrivateKeyFactory;
import org.bouncycastle.operator.OperatorCreationException; import org.bouncycastle.operator.OperatorCreationException;
@ -153,7 +154,7 @@ public void invoke(String... args) throws Exception {
reload(ReloadType.NO_COMPONENTS); reload(ReloadType.NO_COMPONENTS);
break; break;
default: default:
reload(ReloadType.FULL);; reload(ReloadType.FULL);
break; break;
} }
} }
@ -163,7 +164,7 @@ public void invoke(String... args) throws Exception {
} }
private final class ProfilesFileVisitor extends SimpleFileVisitor<Path> { private static final class ProfilesFileVisitor extends SimpleFileVisitor<Path> {
private final Collection<ClientProfile> result; private final Collection<ClientProfile> result;
private ProfilesFileVisitor(Collection<ClientProfile> result) { private ProfilesFileVisitor(Collection<ClientProfile> result) {
@ -215,7 +216,7 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO
// Server config // Server config
public LaunchServerConfig config; public LaunchServerConfig config;
public LaunchServerRuntimeConfig runtime; public final LaunchServerRuntimeConfig runtime;
public final ECPublicKey publicKey; public final ECPublicKey publicKey;
@ -225,7 +226,7 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO
public final JARLauncherBinary launcherBinary; public final JARLauncherBinary launcherBinary;
public Class<? extends LauncherBinary> launcherEXEBinaryClass; public final Class<? extends LauncherBinary> launcherEXEBinaryClass;
public final LauncherBinary launcherEXEBinary; public final LauncherBinary launcherEXEBinary;
// HWID ban + anti-brutforce // HWID ban + anti-brutforce
@ -263,7 +264,7 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO
public final Timer taskPool; public final Timer taskPool;
public static Class<? extends LauncherBinary> defaultLauncherEXEBinaryClass = null; public static final Class<? extends LauncherBinary> defaultLauncherEXEBinaryClass = null;
public static class LaunchServerDirectories public static class LaunchServerDirectories
{ {
@ -402,10 +403,7 @@ public LaunchServer(LaunchServerDirectories directories, LaunchServerEnv env, La
Files.createDirectory(profilesDir); Files.createDirectory(profilesDir);
syncProfilesDir(); syncProfilesDir();
if (config.netty != null) nettyServerSocketHandler = new NettyServerSocketHandler(this);
nettyServerSocketHandler = new NettyServerSocketHandler(this);
else
nettyServerSocketHandler = null;
// post init modules // post init modules
modulesManager.invokeEvent(new LaunchServerPostInitPhase(this)); modulesManager.invokeEvent(new LaunchServerPostInitPhase(this));
if (config.components != null) { if (config.components != null) {
@ -548,7 +546,7 @@ public void syncUpdatesDir(Collection<String> dirs) throws IOException {
// Resolve name and verify is dir // Resolve name and verify is dir
String name = IOHelper.getFileName(updateDir); String name = IOHelper.getFileName(updateDir);
if (!IOHelper.isDir(updateDir)) { if (!IOHelper.isDir(updateDir)) {
if (!IOHelper.isFile(updateDir) && Arrays.asList(".jar", ".exe", ".hash").stream().noneMatch(e -> updateDir.toString().endsWith(e))) if (!IOHelper.isFile(updateDir) && Stream.of(".jar", ".exe", ".hash").noneMatch(e -> updateDir.toString().endsWith(e)))
LogHelper.warning("Not update dir: '%s'", name); LogHelper.warning("Not update dir: '%s'", name);
continue; continue;
} }

View file

@ -43,7 +43,7 @@
import pro.gravit.utils.verify.LauncherTrustManager; import pro.gravit.utils.verify.LauncherTrustManager;
public class LaunchServerStarter { public class LaunchServerStarter {
public static boolean allowUnsigned = Boolean.getBoolean("launchserver.allowUnsigned"); public static final boolean allowUnsigned = Boolean.getBoolean("launchserver.allowUnsigned");
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
JVMHelper.checkStackTrace(LaunchServerStarter.class); JVMHelper.checkStackTrace(LaunchServerStarter.class);
JVMHelper.verifySystemProperties(LaunchServer.class, true); JVMHelper.verifySystemProperties(LaunchServer.class, true);

View file

@ -19,7 +19,7 @@
* чего угодно. Работает через поиск class-файлов в classpath. * чего угодно. Работает через поиск class-файлов в classpath.
*/ */
public class ClassMetadataReader implements Closeable { public class ClassMetadataReader implements Closeable {
private class CheckSuperClassVisitor extends ClassVisitor { private static class CheckSuperClassVisitor extends ClassVisitor {
String superClassName; String superClassName;
@ -108,7 +108,7 @@ public ArrayList<String> getSuperClasses(String type) {
@Override @Override
public void close() { public void close() {
cp.stream().forEach(IOHelper::close); cp.forEach(IOHelper::close);
cp.clear(); cp.clear();
} }

View file

@ -8,12 +8,12 @@
import pro.gravit.launchserver.auth.texture.TextureProvider; import pro.gravit.launchserver.auth.texture.TextureProvider;
public class AuthProviderPair { public class AuthProviderPair {
public AuthProvider provider; public final AuthProvider provider;
public AuthHandler handler; public final AuthHandler handler;
public TextureProvider textureProvider; public final TextureProvider textureProvider;
public String name; public final String name;
public String displayName; public String displayName;
public boolean isDefault = true; public final boolean isDefault = true;
public AuthProviderPair(AuthProvider provider, AuthHandler handler, TextureProvider textureProvider, String name) { public AuthProviderPair(AuthProvider provider, AuthHandler handler, TextureProvider textureProvider, String name) {
this.provider = provider; this.provider = provider;

View file

@ -10,7 +10,7 @@
public abstract class AuthHandler implements AutoCloseable { public abstract class AuthHandler implements AutoCloseable {
public static ProviderMap<AuthHandler> providers = new ProviderMap<>("AuthHandler"); public static final ProviderMap<AuthHandler> providers = new ProviderMap<>("AuthHandler");
private static boolean registredHandl = false; private static boolean registredHandl = false;

View file

@ -38,7 +38,7 @@ public Entry(UUID uuid, String username, String accessToken, String serverID) {
} }
} }
protected class EntryAndUsername { protected static class EntryAndUsername {
public Map<UUID, CachedAuthHandler.Entry> entryCache; public Map<UUID, CachedAuthHandler.Entry> entryCache;
public Map<String, UUID> usernameCache; public Map<String, UUID> usernameCache;
} }
@ -48,7 +48,7 @@ public Map<String, Command> getCommands() {
Map<String, Command> commands = new HashMap<>(); Map<String, Command> commands = new HashMap<>();
commands.put("clear", new SubCommand() { commands.put("clear", new SubCommand() {
@Override @Override
public void invoke(String... args) throws Exception { public void invoke(String... args) {
long entryCacheSize = entryCache.size(); long entryCacheSize = entryCache.size();
long usernamesCacheSize = usernamesCache.size(); long usernamesCacheSize = usernamesCache.size();
entryCache.clear(); entryCache.clear();

View file

@ -7,21 +7,21 @@
public class HibernateAuthHandler extends CachedAuthHandler { public class HibernateAuthHandler extends CachedAuthHandler {
@Override @Override
protected Entry fetchEntry(String username) throws IOException { protected Entry fetchEntry(String username) {
User user = srv.config.dao.userService.findUserByUsername(username); User user = srv.config.dao.userService.findUserByUsername(username);
if(user == null) return null; if(user == null) return null;
return new Entry(user.uuid, username, user.getAccessToken(), user.serverID); return new Entry(user.uuid, username, user.getAccessToken(), user.serverID);
} }
@Override @Override
protected Entry fetchEntry(UUID uuid) throws IOException { protected Entry fetchEntry(UUID uuid) {
User user = srv.config.dao.userService.findUserByUUID(uuid); User user = srv.config.dao.userService.findUserByUUID(uuid);
if(user == null) return null; if(user == null) return null;
return new Entry(user.uuid, user.username, user.getAccessToken(), user.serverID); return new Entry(user.uuid, user.username, user.getAccessToken(), user.serverID);
} }
@Override @Override
protected boolean updateAuth(UUID uuid, String username, String accessToken) throws IOException { protected boolean updateAuth(UUID uuid, String username, String accessToken) {
User user = srv.config.dao.userService.findUserByUUID(uuid); User user = srv.config.dao.userService.findUserByUUID(uuid);
user.setAccessToken(accessToken); user.setAccessToken(accessToken);
srv.config.dao.userService.updateUser(user); srv.config.dao.userService.updateUser(user);
@ -29,7 +29,7 @@ protected boolean updateAuth(UUID uuid, String username, String accessToken) thr
} }
@Override @Override
protected boolean updateServerID(UUID uuid, String serverID) throws IOException { protected boolean updateServerID(UUID uuid, String serverID) {
User user = srv.config.dao.userService.findUserByUUID(uuid); User user = srv.config.dao.userService.findUserByUUID(uuid);
user.serverID = serverID; user.serverID = serverID;
srv.config.dao.userService.updateUser(user); srv.config.dao.userService.updateUser(user);
@ -37,7 +37,7 @@ protected boolean updateServerID(UUID uuid, String serverID) throws IOException
} }
@Override @Override
public void close() throws IOException { public void close() {
} }
} }

View file

@ -12,26 +12,26 @@ public class JsonAuthHandler extends CachedAuthHandler {
public URL updateAuthUrl; public URL updateAuthUrl;
public URL updateServerIdUrl; public URL updateServerIdUrl;
public class EntryRequestByUsername { public static class EntryRequestByUsername {
public String username; public final String username;
public EntryRequestByUsername(String username) { public EntryRequestByUsername(String username) {
this.username = username; this.username = username;
} }
} }
public class EntryRequestByUUID { public static class EntryRequestByUUID {
public UUID uuid; public final UUID uuid;
public EntryRequestByUUID(UUID uuid) { public EntryRequestByUUID(UUID uuid) {
this.uuid = uuid; this.uuid = uuid;
} }
} }
public class UpdateAuthRequest { public static class UpdateAuthRequest {
public UUID uuid; public final UUID uuid;
public String username; public final String username;
public String accessToken; public final String accessToken;
public UpdateAuthRequest(UUID uuid, String username, String accessToken) { public UpdateAuthRequest(UUID uuid, String username, String accessToken) {
this.uuid = uuid; this.uuid = uuid;
@ -40,9 +40,9 @@ public UpdateAuthRequest(UUID uuid, String username, String accessToken) {
} }
} }
public class UpdateServerIDRequest { public static class UpdateServerIDRequest {
public UUID uuid; public final UUID uuid;
public String serverID; public final String serverID;
public UpdateServerIDRequest(UUID uuid, String serverID) { public UpdateServerIDRequest(UUID uuid, String serverID) {
this.uuid = uuid; this.uuid = uuid;
@ -50,7 +50,7 @@ public UpdateServerIDRequest(UUID uuid, String serverID) {
} }
} }
public class SuccessResponse { public static class SuccessResponse {
public boolean success; public boolean success;
} }

View file

@ -16,8 +16,8 @@ public final class RequestAuthHandler extends CachedAuthHandler {
private String updateAuth; private String updateAuth;
private String updateServerID; private String updateServerID;
private String splitSymbol = ":"; private final String splitSymbol = ":";
private String goodResponse = "OK"; private final String goodResponse = "OK";
@Override @Override
public void init(LaunchServer srv) { public void init(LaunchServer srv) {

View file

@ -12,7 +12,7 @@
import pro.gravit.utils.helper.LogHelper; import pro.gravit.utils.helper.LogHelper;
public abstract class HWIDHandler implements AutoCloseable, Reconfigurable { public abstract class HWIDHandler implements AutoCloseable, Reconfigurable {
public static ProviderMap<HWIDHandler> providers = new ProviderMap<>("HWIDHandler"); public static final ProviderMap<HWIDHandler> providers = new ProviderMap<>("HWIDHandler");
private static boolean registredHandl = false; private static boolean registredHandl = false;

View file

@ -18,8 +18,8 @@
import pro.gravit.utils.helper.LogHelper; import pro.gravit.utils.helper.LogHelper;
public class JsonFileHWIDHandler extends HWIDHandler { public class JsonFileHWIDHandler extends HWIDHandler {
public class Entry { public static class Entry {
public HWID hwid; public final HWID hwid;
public String username; public String username;
public boolean isBanned = false; public boolean isBanned = false;
@ -41,15 +41,18 @@ public int hashCode() {
} }
} }
public String filename = "hwids.json"; public final String filename = "hwids.json";
public transient LinkedList<Entry> list = new LinkedList<>(); public transient LinkedList<Entry> list = new LinkedList<>();
public String banMessage = "You banned"; public final String banMessage = "You banned";
@Override @Override
public void ban(List<HWID> hwid) { public void ban(List<HWID> hwid) {
for (Entry e : list) { for (Entry e : list) {
for (HWID banHWID : hwid) { for (HWID banHWID : hwid) {
if (e.hwid.equals(banHWID)) e.isBanned = true; if (e.hwid.equals(banHWID)) {
e.isBanned = true;
break;
}
} }
} }
} }
@ -101,7 +104,10 @@ public List<HWID> getHwid(String username) {
public void unban(List<HWID> hwid) { public void unban(List<HWID> hwid) {
for (Entry e : list) { for (Entry e : list) {
for (HWID banHWID : hwid) { for (HWID banHWID : hwid) {
if (e.hwid.equals(banHWID)) e.isBanned = false; if (e.hwid.equals(banHWID)) {
e.isBanned = false;
break;
}
} }
} }
} }

View file

@ -23,12 +23,12 @@ public final class JsonHWIDHandler extends HWIDHandler {
private URL urlGet; private URL urlGet;
private String apiKey; private String apiKey;
public class banRequest { public static class banRequest {
public banRequest(OshiHWID hwid) { public banRequest(OshiHWID hwid) {
this.hwid = hwid; this.hwid = hwid;
} }
OshiHWID hwid; final OshiHWID hwid;
String apiKey; String apiKey;
public banRequest(OshiHWID hwid, String apiKey) { public banRequest(OshiHWID hwid, String apiKey) {
@ -37,14 +37,14 @@ public banRequest(OshiHWID hwid, String apiKey) {
} }
} }
public class checkRequest { public static class checkRequest {
public checkRequest(String username, OshiHWID hwid) { public checkRequest(String username, OshiHWID hwid) {
this.username = username; this.username = username;
this.hwid = hwid; this.hwid = hwid;
} }
String username; final String username;
OshiHWID hwid; final OshiHWID hwid;
String apiKey; String apiKey;
public checkRequest(String username, OshiHWID hwid, String apiKey) { public checkRequest(String username, OshiHWID hwid, String apiKey) {
@ -54,21 +54,21 @@ public checkRequest(String username, OshiHWID hwid, String apiKey) {
} }
} }
public class Result { public static class Result {
String error; String error;
} }
public class BannedResult { public static class BannedResult {
boolean isBanned; boolean isBanned;
String error; String error;
} }
public class HWIDRequest { public static class HWIDRequest {
public HWIDRequest(String username) { public HWIDRequest(String username) {
this.username = username; this.username = username;
} }
String username; final String username;
String apiKey; String apiKey;
public HWIDRequest(String username, String apiKey) { public HWIDRequest(String username, String apiKey) {

View file

@ -7,8 +7,8 @@
import pro.gravit.launcher.hwid.HWID; import pro.gravit.launcher.hwid.HWID;
public class MemoryHWIDHandler extends HWIDHandler { public class MemoryHWIDHandler extends HWIDHandler {
public class Entry { public static class Entry {
public HWID hwid; public final HWID hwid;
public String username; public String username;
public boolean isBanned = false; public boolean isBanned = false;
@ -30,14 +30,17 @@ public int hashCode() {
} }
} }
public transient LinkedList<Entry> list = new LinkedList<>(); public final transient LinkedList<Entry> list = new LinkedList<>();
public String banMessage = "You banned"; public final String banMessage = "You banned";
@Override @Override
public void ban(List<HWID> hwid) { public void ban(List<HWID> hwid) {
for (Entry e : list) { for (Entry e : list) {
for (HWID banHWID : hwid) { for (HWID banHWID : hwid) {
if (e.hwid.equals(banHWID)) e.isBanned = true; if (e.hwid.equals(banHWID)) {
e.isBanned = true;
break;
}
} }
} }
} }
@ -79,7 +82,10 @@ public List<HWID> getHwid(String username) {
public void unban(List<HWID> hwid) { public void unban(List<HWID> hwid) {
for (Entry e : list) { for (Entry e : list) {
for (HWID banHWID : hwid) { for (HWID banHWID : hwid) {
if (e.hwid.equals(banHWID)) e.isBanned = false; if (e.hwid.equals(banHWID)) {
e.isBanned = false;
break;
}
} }
} }
} }

View file

@ -37,10 +37,10 @@ public class MysqlHWIDHandler extends HWIDHandler {
private String banMessage; private String banMessage;
private boolean compareMode = false; private final boolean compareMode = false;
//Using queryHWID "queryHwids": "SELECT * FROM `users_hwids` WHERE `totalMemory` = ? or `serialNumber` = ? or `HWDiskSerial` = ? or `processorID` = ? or `MACAddr` = ?" //Using queryHWID "queryHwids": "SELECT * FROM `users_hwids` WHERE `totalMemory` = ? or `serialNumber` = ? or `HWDiskSerial` = ? or `processorID` = ? or `MACAddr` = ?"
private int compare = 50; //При наборе схожести в 50 очков private final int compare = 50; //При наборе схожести в 50 очков
private boolean oneCompareMode = false; private final boolean oneCompareMode = false;
/* /*
//Добавить поля hwid в базу с пользователями //Добавить поля hwid в базу с пользователями
@ -151,7 +151,7 @@ public void onCheckInfo(OshiHWID hwid, String username, Connection c) throws HWI
db_hwid.serialNumber = set.getString(hwidFieldSerialNumber); db_hwid.serialNumber = set.getString(hwidFieldSerialNumber);
db_hwid.processorID = set.getString(hwidFieldProcessorID); db_hwid.processorID = set.getString(hwidFieldProcessorID);
db_hwid.HWDiskSerial = set.getString(hwidFieldHWDiskSerial); db_hwid.HWDiskSerial = set.getString(hwidFieldHWDiskSerial);
db_hwid.totalMemory = Long.valueOf(set.getString(hwidFieldTotalMemory)); db_hwid.totalMemory = Long.parseLong(set.getString(hwidFieldTotalMemory));
db_hwid.macAddr = set.getString(hwidFieldMAC); db_hwid.macAddr = set.getString(hwidFieldMAC);
if (LogHelper.isDevEnabled()) { if (LogHelper.isDevEnabled()) {
LogHelper.dev("Compare HWID: %s vs %s", hwid.toString(), db_hwid.toString()); LogHelper.dev("Compare HWID: %s vs %s", hwid.toString(), db_hwid.toString());
@ -238,7 +238,7 @@ public List<HWID> getHwid(String username) {
ResultSet rs = s.executeQuery(); ResultSet rs = s.executeQuery();
if (rs.next()) { if (rs.next()) {
OshiHWID oshiHWID = new OshiHWID(); OshiHWID oshiHWID = new OshiHWID();
oshiHWID.totalMemory = Long.valueOf(rs.getString(hwidFieldTotalMemory)); oshiHWID.totalMemory = Long.parseLong(rs.getString(hwidFieldTotalMemory));
oshiHWID.serialNumber = rs.getString(hwidFieldSerialNumber); oshiHWID.serialNumber = rs.getString(hwidFieldSerialNumber);
oshiHWID.HWDiskSerial = rs.getString(hwidFieldHWDiskSerial); oshiHWID.HWDiskSerial = rs.getString(hwidFieldHWDiskSerial);
oshiHWID.processorID = rs.getString(hwidFieldProcessorID); oshiHWID.processorID = rs.getString(hwidFieldProcessorID);

View file

@ -3,8 +3,8 @@
import pro.gravit.launcher.ClientPermissions; import pro.gravit.launcher.ClientPermissions;
public class ConfigPermissionsHandler extends PermissionsHandler { public class ConfigPermissionsHandler extends PermissionsHandler {
public boolean isAdmin = false; public final boolean isAdmin = false;
public boolean isServer = false; public final boolean isServer = false;
@Override @Override
public ClientPermissions getPermissions(String username) { public ClientPermissions getPermissions(String username) {

View file

@ -21,7 +21,7 @@ public void setPermissions(String username, ClientPermissions permissions) {
} }
@Override @Override
public void close() throws Exception { public void close() {
} }
} }

View file

@ -21,7 +21,7 @@
import pro.gravit.utils.helper.LogHelper; import pro.gravit.utils.helper.LogHelper;
public class JsonFilePermissionsHandler extends PermissionsHandler implements Reconfigurable { public class JsonFilePermissionsHandler extends PermissionsHandler implements Reconfigurable {
public String filename = "permissions.json"; public final String filename = "permissions.json";
public static Map<String, ClientPermissions> map; public static Map<String, ClientPermissions> map;
@ -47,14 +47,14 @@ public Map<String, Command> getCommands() {
Map<String, Command> commands = new HashMap<>(); Map<String, Command> commands = new HashMap<>();
SubCommand reload = new SubCommand() { SubCommand reload = new SubCommand() {
@Override @Override
public void invoke(String... args) throws Exception { public void invoke(String... args) {
reload(); reload();
} }
}; };
commands.put("reload", reload); commands.put("reload", reload);
commands.put("save", new SubCommand() { commands.put("save", new SubCommand() {
@Override @Override
public void invoke(String... args) throws Exception { public void invoke(String... args) {
Path path = Paths.get(filename); Path path = Paths.get(filename);
if (!IOHelper.exists(path)) { if (!IOHelper.exists(path)) {
try (Writer writer = IOHelper.newWriter(path)) { try (Writer writer = IOHelper.newWriter(path)) {

View file

@ -21,8 +21,8 @@
import pro.gravit.utils.helper.LogHelper; import pro.gravit.utils.helper.LogHelper;
public class JsonLongFilePermissionsHandler extends PermissionsHandler implements Reconfigurable { public class JsonLongFilePermissionsHandler extends PermissionsHandler implements Reconfigurable {
public String filename = "permissions.json"; public final String filename = "permissions.json";
public long defaultPerms = 0L; public final long defaultPerms = 0L;
public static Map<String, Long> map; public static Map<String, Long> map;
@ -48,14 +48,14 @@ public Map<String, Command> getCommands() {
Map<String, Command> commands = new HashMap<>(); Map<String, Command> commands = new HashMap<>();
SubCommand reload = new SubCommand() { SubCommand reload = new SubCommand() {
@Override @Override
public void invoke(String... args) throws Exception { public void invoke(String... args) {
reload(); reload();
} }
}; };
commands.put("reload", reload); commands.put("reload", reload);
commands.put("save", new SubCommand() { commands.put("save", new SubCommand() {
@Override @Override
public void invoke(String... args) throws Exception { public void invoke(String... args) {
Path path = Paths.get(filename); Path path = Paths.get(filename);
if (!IOHelper.exists(path)) { if (!IOHelper.exists(path)) {
try (Writer writer = IOHelper.newWriter(path)) { try (Writer writer = IOHelper.newWriter(path)) {

View file

@ -5,7 +5,7 @@
import pro.gravit.utils.ProviderMap; import pro.gravit.utils.ProviderMap;
public abstract class PermissionsHandler implements AutoCloseable { public abstract class PermissionsHandler implements AutoCloseable {
public static ProviderMap<PermissionsHandler> providers = new ProviderMap<>("PermissionsHandler"); public static final ProviderMap<PermissionsHandler> providers = new ProviderMap<>("PermissionsHandler");
protected transient LaunchServer srv; protected transient LaunchServer srv;
private static boolean registredHandl = false; private static boolean registredHandl = false;

View file

@ -4,7 +4,7 @@
import pro.gravit.utils.ProviderMap; import pro.gravit.utils.ProviderMap;
public abstract class ProtectHandler { public abstract class ProtectHandler {
public static ProviderMap<ProtectHandler> providers = new ProviderMap<>("ProtectHandler"); public static final ProviderMap<ProtectHandler> providers = new ProviderMap<>("ProtectHandler");
private static boolean registredHandl = false; private static boolean registredHandl = false;

View file

@ -4,7 +4,7 @@
import pro.gravit.utils.helper.SecurityHelper; import pro.gravit.utils.helper.SecurityHelper;
public class StdProtectHandler extends ProtectHandler { public class StdProtectHandler extends ProtectHandler {
public boolean checkSecure = true; public final boolean checkSecure = true;
@Override @Override
public String generateSecureToken(AuthResponse.AuthContext context) { public String generateSecureToken(AuthResponse.AuthContext context) {
return SecurityHelper.randomStringToken(); return SecurityHelper.randomStringToken();

View file

@ -8,7 +8,7 @@
import pro.gravit.utils.ProviderMap; import pro.gravit.utils.ProviderMap;
public abstract class AuthProvider implements AutoCloseable { public abstract class AuthProvider implements AutoCloseable {
public static ProviderMap<AuthProvider> providers = new ProviderMap<>("AuthProvider"); public static final ProviderMap<AuthProvider> providers = new ProviderMap<>("AuthProvider");
private static boolean registredProv = false; private static boolean registredProv = false;
protected transient LaunchServer srv = null; protected transient LaunchServer srv = null;
public static AuthProviderResult authError(String message) throws AuthException { public static AuthProviderResult authError(String message) throws AuthException {

View file

@ -36,7 +36,7 @@ public AuthProviderResult auth(String login, AuthRequest.AuthPasswordInterface p
} }
@Override @Override
public void close() throws IOException { public void close() {
} }
} }

View file

@ -14,17 +14,17 @@
import pro.gravit.utils.helper.SecurityHelper; import pro.gravit.utils.helper.SecurityHelper;
public final class JsonAuthProvider extends AuthProvider { public final class JsonAuthProvider extends AuthProvider {
private static Gson gson = new Gson(); private static final Gson gson = new Gson();
private URL url; private URL url;
private String apiKey; private String apiKey;
public class authResult { public static class authResult {
String username; String username;
String error; String error;
long permissions; long permissions;
} }
public class authRequest { public static class authRequest {
public authRequest(String username, String password, String ip) { public authRequest(String username, String password, String ip) {
this.username = username; this.username = username;
this.password = password; this.password = password;
@ -38,9 +38,9 @@ public authRequest(String username, String password, String ip, String apiKey) {
this.apiKey = apiKey; this.apiKey = apiKey;
} }
String username; final String username;
String password; final String password;
String ip; final String ip;
String apiKey; String apiKey;
} }

View file

@ -45,7 +45,7 @@ public Map<String, Command> getCommands() {
Map<String, Command> commands = new HashMap<>(); Map<String, Command> commands = new HashMap<>();
commands.put("message", new SubCommand() { commands.put("message", new SubCommand() {
@Override @Override
public void invoke(String... args) throws Exception { public void invoke(String... args) {
message = args[0]; message = args[0];
LogHelper.info("New reject message: %s", message); LogHelper.info("New reject message: %s", message);
} }

View file

@ -7,7 +7,7 @@
import pro.gravit.utils.ProviderMap; import pro.gravit.utils.ProviderMap;
public abstract class TextureProvider implements AutoCloseable { public abstract class TextureProvider implements AutoCloseable {
public static ProviderMap<TextureProvider> providers = new ProviderMap<>("TextureProvider"); public static final ProviderMap<TextureProvider> providers = new ProviderMap<>("TextureProvider");
private static boolean registredProv = false; private static boolean registredProv = false;
public static void registerProviders() { public static void registerProviders() {

View file

@ -114,8 +114,8 @@ private void setConfig() {
ConfigPersister.getInstance().setAntConfig(config, null); ConfigPersister.getInstance().setAntConfig(config, null);
} }
private static String VERSION = Version.getVersion().getVersionString(); private static final String VERSION = Version.getVersion().getVersionString();
private static int BUILD = Version.getVersion().build; private static final int BUILD = Version.getVersion().build;
public static String formatVars(String mask) { public static String formatVars(String mask) {
return String.format(mask, VERSION, BUILD); return String.format(mask, VERSION, BUILD);

View file

@ -25,9 +25,9 @@ public final class JARLauncherBinary extends LauncherBinary {
public final Path runtimeDir; public final Path runtimeDir;
public final Path guardDir; public final Path guardDir;
public final Path buildDir; public final Path buildDir;
public List<LauncherBuildTask> tasks; public final List<LauncherBuildTask> tasks;
public List<Path> coreLibs; public final List<Path> coreLibs;
public List<Path> addonLibs; public final List<Path> addonLibs;
public JARLauncherBinary(LaunchServer server) throws IOException { public JARLauncherBinary(LaunchServer server) throws IOException {
super(server, resolve(server, ".jar")); super(server, resolve(server, ".jar"));

View file

@ -9,7 +9,7 @@
import pro.gravit.utils.helper.LogHelper; import pro.gravit.utils.helper.LogHelper;
public class SimpleEXELauncherBinary extends LauncherBinary { public class SimpleEXELauncherBinary extends LauncherBinary {
public Path exeTemplate; public final Path exeTemplate;
public SimpleEXELauncherBinary(LaunchServer server) { public SimpleEXELauncherBinary(LaunchServer server) {
super(server, LauncherBinary.resolve(server, ".exe")); super(server, LauncherBinary.resolve(server, ".exe"));
exeTemplate = server.dir.resolve("SimpleTemplate.exe"); exeTemplate = server.dir.resolve("SimpleTemplate.exe");

View file

@ -21,7 +21,7 @@ public String getUsageDescription() {
} }
@Override @Override
public void invoke(String... args) throws Exception { public void invoke(String... args) {
int count = 0; int count = 0;
for(User user : server.config.dao.userService.findAllUsers()) for(User user : server.config.dao.userService.findAllUsers())
{ {

View file

@ -21,17 +21,17 @@
import pro.gravit.utils.helper.SecurityHelper.DigestAlgorithm; import pro.gravit.utils.helper.SecurityHelper.DigestAlgorithm;
public final class IndexAssetCommand extends Command { public final class IndexAssetCommand extends Command {
private static Gson gson = new Gson(); private static final Gson gson = new Gson();
public static class IndexObject { public static class IndexObject {
long size; final long size;
public IndexObject(long size, String hash) { public IndexObject(long size, String hash) {
this.size = size; this.size = size;
this.hash = hash; this.hash = hash;
} }
String hash; final String hash;
} }
private static final class IndexAssetVisitor extends SimpleFileVisitor<Path> { private static final class IndexAssetVisitor extends SimpleFileVisitor<Path> {

View file

@ -17,7 +17,7 @@
import pro.gravit.utils.helper.LogHelper; import pro.gravit.utils.helper.LogHelper;
public final class UnindexAssetCommand extends Command { public final class UnindexAssetCommand extends Command {
private static JsonParser parser = new JsonParser(); private static final JsonParser parser = new JsonParser();
public UnindexAssetCommand(LaunchServer server) { public UnindexAssetCommand(LaunchServer server) {
super(server); super(server);

View file

@ -21,7 +21,7 @@ public String getUsageDescription() {
} }
@Override @Override
public void invoke(String... args) throws Exception { public void invoke(String... args) {
LogHelper.info("Check install success"); LogHelper.info("Check install success");
JVMHelper.RUNTIME.exit(0); JVMHelper.RUNTIME.exit(0);
} }

View file

@ -19,7 +19,7 @@ public String getUsageDescription() {
} }
@Override @Override
public void invoke(String... args) throws Exception { public void invoke(String... args) {
for (String arg : args) { for (String arg : args) {
server.commandHandler.eval(arg, false); server.commandHandler.eval(arg, false);
} }

View file

@ -24,7 +24,7 @@ public String getUsageDescription() {
} }
@Override @Override
public void invoke(String... args) throws Exception { public void invoke(String... args) {
WebSocketService service = server.nettyServerSocketHandler.nettyServer.service; WebSocketService service = server.nettyServerSocketHandler.nettyServer.service;
service.channels.forEach((channel -> { service.channels.forEach((channel -> {
WebSocketFrameHandler frameHandler = channel.pipeline().get(WebSocketFrameHandler.class); WebSocketFrameHandler frameHandler = channel.pipeline().get(WebSocketFrameHandler.class);

View file

@ -19,7 +19,7 @@ public String getUsageDescription() {
} }
@Override @Override
public void invoke(String... args) throws Exception { public void invoke(String... args) {
//LogHelper.info("You publickey modulus: %s", server.publicKey.getModulus().toString(16)); //LogHelper.info("You publickey modulus: %s", server.publicKey.getModulus().toString(16));
} }
} }

View file

@ -26,7 +26,7 @@ public void invoke(String... args) throws Exception {
String username = args[0]; String username = args[0];
ClientPermissions permissions = server.config.permissionsHandler.getPermissions(username); ClientPermissions permissions = server.config.permissionsHandler.getPermissions(username);
String permission = args[1]; String permission = args[1];
boolean isEnabled = Boolean.valueOf(args[2]); boolean isEnabled = Boolean.parseBoolean(args[2]);
switch (permission) { switch (permission) {
case "admin": { case "admin": {
permissions.canAdmin = isEnabled; permissions.canAdmin = isEnabled;

View file

@ -14,14 +14,14 @@
public abstract class AbstractLimiter<T> extends Component implements NeedGarbageCollection, Reconfigurable { public abstract class AbstractLimiter<T> extends Component implements NeedGarbageCollection, Reconfigurable {
public int rateLimit; public int rateLimit;
public int rateLimitMillis; public int rateLimitMillis;
public List<T> exclude = new ArrayList<>(); public final List<T> exclude = new ArrayList<>();
@Override @Override
public Map<String, Command> getCommands() { public Map<String, Command> getCommands() {
Map<String, Command> commands = new HashMap<>(); Map<String, Command> commands = new HashMap<>();
commands.put("gc", new SubCommand() { commands.put("gc", new SubCommand() {
@Override @Override
public void invoke(String... args) throws Exception { public void invoke(String... args) {
long size = map.size(); long size = map.size();
garbageCollection(); garbageCollection();
LogHelper.info("Cleared %d entity", size); LogHelper.info("Cleared %d entity", size);
@ -29,7 +29,7 @@ public void invoke(String... args) throws Exception {
}); });
commands.put("clear", new SubCommand() { commands.put("clear", new SubCommand() {
@Override @Override
public void invoke(String... args) throws Exception { public void invoke(String... args) {
long size = map.size(); long size = map.size();
map.clear(); map.clear();
LogHelper.info("Cleared %d entity", size); LogHelper.info("Cleared %d entity", size);
@ -51,7 +51,7 @@ public void invoke(String... args) throws Exception {
}); });
commands.put("clearExclude", new SubCommand() { commands.put("clearExclude", new SubCommand() {
@Override @Override
public void invoke(String... args) throws Exception { public void invoke(String... args) {
exclude.clear(); exclude.clear();
} }
}); });
@ -67,7 +67,7 @@ public void garbageCollection() {
map.entrySet().removeIf((e) -> e.getValue().time + rateLimitMillis < time); map.entrySet().removeIf((e) -> e.getValue().time + rateLimitMillis < time);
} }
class LimitEntry static class LimitEntry
{ {
long time; long time;
int trys; int trys;
@ -82,7 +82,7 @@ public LimitEntry() {
trys = 0; trys = 0;
} }
} }
protected transient Map<T, LimitEntry> map = new HashMap<>(); protected final transient Map<T, LimitEntry> map = new HashMap<>();
public boolean check(T address) public boolean check(T address)
{ {
if(exclude.contains(address)) return true; if(exclude.contains(address)) return true;

View file

@ -32,7 +32,7 @@ public boolean preAuthHook(AuthResponse.AuthContext context, Client client) {
public String message; public String message;
@Override @Override
public void close() throws Exception { public void close() {
srv.authHookManager.preHook.unregisterHook(this::preAuthHook); srv.authHookManager.preHook.unregisterHook(this::preAuthHook);
} }
} }

View file

@ -7,8 +7,8 @@
import pro.gravit.utils.command.Command; import pro.gravit.utils.command.Command;
public class CommandRemoverComponent extends Component implements AutoCloseable { public class CommandRemoverComponent extends Component implements AutoCloseable {
public String[] removeList = new String[]{}; public final String[] removeList = new String[]{};
public transient Map<String, Command> commandsList = new HashMap<>(); public final transient Map<String, Command> commandsList = new HashMap<>();
private transient LaunchServer server = null; private transient LaunchServer server = null;
@Override @Override

View file

@ -4,7 +4,7 @@
import pro.gravit.utils.ProviderMap; import pro.gravit.utils.ProviderMap;
public abstract class Component { public abstract class Component {
public static ProviderMap<Component> providers = new ProviderMap<>(); public static final ProviderMap<Component> providers = new ProviderMap<>();
private static boolean registredComp = false; private static boolean registredComp = false;
public static void registerComponents() { public static void registerComponents() {

View file

@ -39,7 +39,7 @@ public boolean registerHook(AuthHookManager.RegContext context)
} }
@Override @Override
public void close() throws Exception { public void close() {
launchServer.authHookManager.registraion.unregisterHook(this::registerHook); launchServer.authHookManager.registraion.unregisterHook(this::registerHook);
} }
} }

View file

@ -44,7 +44,7 @@ public LaunchServerConfig setLaunchServer(LaunchServer server) {
public String binaryName; public String binaryName;
public boolean copyBinaries = true; public final boolean copyBinaries = true;
public LauncherConfig.LauncherEnvironment env; public LauncherConfig.LauncherEnvironment env;
@ -75,7 +75,7 @@ public AuthProviderPair getAuthProviderPair() {
return pair; return pair;
} }
} }
return null; throw new IllegalStateException("Default AuthProviderPair not found");
} }
public HWIDHandler hwidHandler; public HWIDHandler hwidHandler;
@ -146,16 +146,13 @@ public void init(LaunchServer.ReloadType type) {
} }
if(components != null) if(components != null)
{ {
components.forEach((k,v) -> { components.forEach((k,v) -> server.registerObject("component.".concat(k), v));
server.registerObject("component.".concat(k), v);
});
} }
server.registerObject("permissionsHandler", permissionsHandler); server.registerObject("permissionsHandler", permissionsHandler);
server.registerObject("hwidHandler", hwidHandler); server.registerObject("hwidHandler", hwidHandler);
if(!type.equals(LaunchServer.ReloadType.NO_AUTH)) if(!type.equals(LaunchServer.ReloadType.NO_AUTH))
{ {
for (int i = 0; i < auth.length; ++i) { for (AuthProviderPair pair : auth) {
AuthProviderPair pair = auth[i];
server.registerObject("auth.".concat(pair.name).concat(".provider"), pair.provider); server.registerObject("auth.".concat(pair.name).concat(".provider"), pair.provider);
server.registerObject("auth.".concat(pair.name).concat(".handler"), pair.handler); server.registerObject("auth.".concat(pair.name).concat(".handler"), pair.handler);
server.registerObject("auth.".concat(pair.name).concat(".texture"), pair.textureProvider); server.registerObject("auth.".concat(pair.name).concat(".texture"), pair.textureProvider);
@ -258,10 +255,10 @@ public static class NettyConfig {
public String downloadURL; public String downloadURL;
public String launcherEXEURL; public String launcherEXEURL;
public String address; public String address;
public Map<String, LaunchServerConfig.NettyUpdatesBind> bindings = new HashMap<>(); public final Map<String, LaunchServerConfig.NettyUpdatesBind> bindings = new HashMap<>();
public NettyPerformanceConfig performance; public NettyPerformanceConfig performance;
public NettyBindAddress[] binds; public NettyBindAddress[] binds;
public LogLevel logLevel = LogLevel.DEBUG; public final LogLevel logLevel = LogLevel.DEBUG;
} }
public static class NettyPerformanceConfig { public static class NettyPerformanceConfig {
@ -271,8 +268,8 @@ public static class NettyPerformanceConfig {
} }
public static class NettyBindAddress { public static class NettyBindAddress {
public String address; public final String address;
public int port; public final int port;
public NettyBindAddress(String address, int port) { public NettyBindAddress(String address, int port) {
this.address = address; this.address = address;

View file

@ -14,7 +14,7 @@
@Entity @Entity
@Table(name = "users_hwids") @Table(name = "users_hwids")
public class UserHWID implements HWID { public class UserHWID implements HWID {
private transient Supplier<OshiHWID> oshiSupp = () -> { private final transient Supplier<OshiHWID> oshiSupp = () -> {
OshiHWID hwid = new OshiHWID(); OshiHWID hwid = new OshiHWID();
hwid.HWDiskSerial = this.HWDiskSerial; hwid.HWDiskSerial = this.HWDiskSerial;
hwid.macAddr = this.macAddr; hwid.macAddr = this.macAddr;
@ -28,7 +28,7 @@ public class UserHWID implements HWID {
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
private long id; private long id;
public long totalMemory = 0; public final long totalMemory = 0;
public String serialNumber; public String serialNumber;
public String HWDiskSerial; public String HWDiskSerial;
public String processorID; public String processorID;

View file

@ -6,7 +6,7 @@
import pro.gravit.utils.ProviderMap; import pro.gravit.utils.ProviderMap;
public abstract class DaoProvider { public abstract class DaoProvider {
public static ProviderMap<DaoProvider> providers = new ProviderMap<>("DaoProvider"); public static final ProviderMap<DaoProvider> providers = new ProviderMap<>("DaoProvider");
public UserDAO userDAO; public UserDAO userDAO;
public UserService userService; public UserService userService;
public static void registerProviders() public static void registerProviders()

View file

@ -57,8 +57,8 @@ public class CertificateManager {
public LauncherTrustManager trustManager; public LauncherTrustManager trustManager;
public int validDays = 60; public final int validDays = 60;
public int minusHours = 6; public final int minusHours = 6;
public String orgName; public String orgName;

View file

@ -15,7 +15,7 @@
public class MirrorManager { public class MirrorManager {
public static class Mirror { public static class Mirror {
String baseUrl; final String baseUrl;
boolean enabled; boolean enabled;
Mirror(String url) { Mirror(String url) {
@ -34,7 +34,7 @@ public URL getURL(String mask, Object... args) throws MalformedURLException {
} }
} }
protected ArrayList<Mirror> list = new ArrayList<>(); protected final ArrayList<Mirror> list = new ArrayList<>();
private Mirror defaultMirror; private Mirror defaultMirror;
public void addMirror(String mirror) { public void addMirror(String mirror) {
@ -44,7 +44,7 @@ public void addMirror(String mirror) {
list.add(m); list.add(m);
} }
public void addMirror(String mirror, boolean enabled) throws MalformedURLException { public void addMirror(String mirror, boolean enabled) {
Mirror m = new Mirror(mirror); Mirror m = new Mirror(mirror);
m.enabled = enabled; m.enabled = enabled;
if (defaultMirror == null && enabled) defaultMirror = m; if (defaultMirror == null && enabled) defaultMirror = m;

View file

@ -10,7 +10,7 @@
import pro.gravit.utils.helper.VerifyHelper; import pro.gravit.utils.helper.VerifyHelper;
public class ReconfigurableManager { public class ReconfigurableManager {
private class ReconfigurableVirtualCommand extends Command { private static class ReconfigurableVirtualCommand extends Command {
public ReconfigurableVirtualCommand(Map<String, Command> childs) { public ReconfigurableVirtualCommand(Map<String, Command> childs) {
super(childs); super(childs);
} }

View file

@ -14,7 +14,7 @@ public class SessionManager implements NeedGarbageCollection {
public static final long SESSION_TIMEOUT = 3 * 60 * 60 * 1000; // 3 часа public static final long SESSION_TIMEOUT = 3 * 60 * 60 * 1000; // 3 часа
public static final boolean GARBAGE_SERVER = Boolean.parseBoolean(System.getProperty("launcher.garbageSessionsServer", "false")); public static final boolean GARBAGE_SERVER = Boolean.parseBoolean(System.getProperty("launcher.garbageSessionsServer", "false"));
private Map<Long, Client> clientSet = new HashMap<>(128); private final Map<Long, Client> clientSet = new HashMap<>(128);
public boolean addClient(Client client) { public boolean addClient(Client client) {

View file

@ -9,17 +9,17 @@
import pro.gravit.utils.HookSet; import pro.gravit.utils.HookSet;
public class AuthHookManager { public class AuthHookManager {
public BiHookSet<AuthResponse.AuthContext, Client> preHook = new BiHookSet<>(); public final BiHookSet<AuthResponse.AuthContext, Client> preHook = new BiHookSet<>();
public BiHookSet<AuthResponse.AuthContext, Client> postHook = new BiHookSet<>(); public final BiHookSet<AuthResponse.AuthContext, Client> postHook = new BiHookSet<>();
public BiHookSet<CheckServerResponse, Client> checkServerHook = new BiHookSet<>(); public final BiHookSet<CheckServerResponse, Client> checkServerHook = new BiHookSet<>();
public BiHookSet<JoinServerResponse, Client> joinServerHook = new BiHookSet<>(); public final BiHookSet<JoinServerResponse, Client> joinServerHook = new BiHookSet<>();
public BiHookSet<SetProfileResponse, Client> setProfileHook = new BiHookSet<>(); public final BiHookSet<SetProfileResponse, Client> setProfileHook = new BiHookSet<>();
public static class RegContext public static class RegContext
{ {
public String login; public final String login;
public String password; public final String password;
public String ip; public final String ip;
public boolean trustContext; public final boolean trustContext;
public RegContext(String login, String password, String ip, boolean trustContext) { public RegContext(String login, String password, String ip, boolean trustContext) {
this.login = login; this.login = login;
this.password = password; this.password = password;
@ -27,5 +27,5 @@ public RegContext(String login, String password, String ip, boolean trustContext
this.trustContext = trustContext; this.trustContext = trustContext;
} }
} }
public HookSet<RegContext> registraion = new HookSet<>(); public final HookSet<RegContext> registraion = new HookSet<>();
} }

View file

@ -11,7 +11,7 @@
import pro.gravit.utils.verify.LauncherTrustManager; import pro.gravit.utils.verify.LauncherTrustManager;
public class LaunchServerModulesManager extends SimpleModuleManager { public class LaunchServerModulesManager extends SimpleModuleManager {
public LaunchServerCoreModule coreModule; public final LaunchServerCoreModule coreModule;
public LaunchServerModulesManager(Path modulesDir, Path configDir, LauncherTrustManager trustManager) { public LaunchServerModulesManager(Path modulesDir, Path configDir, LauncherTrustManager trustManager) {
super(modulesDir, configDir, trustManager); super(modulesDir, configDir, trustManager);
coreModule = new LaunchServerCoreModule(); coreModule = new LaunchServerCoreModule();

View file

@ -10,7 +10,7 @@ public class Client {
public long session; public long session;
public String auth_id; public String auth_id;
public long timestamp; public long timestamp;
public Type type; public final Type type;
public ClientProfile profile; public ClientProfile profile;
public boolean isAuth; public boolean isAuth;
public boolean checkSign; public boolean checkSign;

View file

@ -36,12 +36,12 @@
public class WebSocketService { public class WebSocketService {
public final ChannelGroup channels; public final ChannelGroup channels;
public static ProviderMap<WebSocketServerResponse> providers = new ProviderMap<>(); public static final ProviderMap<WebSocketServerResponse> providers = new ProviderMap<>();
public static class WebSocketRequestContext public static class WebSocketRequestContext
{ {
public WebSocketServerResponse response; public final WebSocketServerResponse response;
public Client client; public final Client client;
public String ip; public final String ip;
public WebSocketRequestContext(WebSocketServerResponse response, Client client, String ip) { public WebSocketRequestContext(WebSocketServerResponse response, Client client, String ip) {
this.response = response; this.response = response;

View file

@ -11,7 +11,7 @@
import pro.gravit.utils.helper.LogHelper; import pro.gravit.utils.helper.LogHelper;
public class NettyIpForwardHandler extends MessageToMessageDecoder<HttpRequest> { public class NettyIpForwardHandler extends MessageToMessageDecoder<HttpRequest> {
private NettyConnectContext context; private final NettyConnectContext context;
public NettyIpForwardHandler(NettyConnectContext context) { public NettyIpForwardHandler(NettyConnectContext context) {
super(); super();
@ -19,7 +19,7 @@ public NettyIpForwardHandler(NettyConnectContext context) {
} }
@Override @Override
protected void decode(ChannelHandlerContext ctx, HttpRequest msg, List<Object> out) throws Exception { protected void decode(ChannelHandlerContext ctx, HttpRequest msg, List<Object> out) {
if (msg instanceof ReferenceCounted) { if (msg instanceof ReferenceCounted) {
((ReferenceCounted) msg).retain(); ((ReferenceCounted) msg).retain();
} }

View file

@ -88,11 +88,6 @@ public void channelRead0(ChannelHandlerContext ctx, FullHttpRequest request) thr
return; return;
} }
if (path == null) {
sendError(ctx, FORBIDDEN);
return;
}
File file = base.resolve(path).toFile(); File file = base.resolve(path).toFile();
if ((file.isHidden() && !showHiddenFiles) || !file.exists()) { if ((file.isHidden() && !showHiddenFiles) || !file.exists()) {
sendError(ctx, NOT_FOUND); sendError(ctx, NOT_FOUND);

View file

@ -7,7 +7,7 @@
import pro.gravit.utils.helper.LogHelper; import pro.gravit.utils.helper.LogHelper;
public class AddLogListenerResponse extends SimpleResponse { public class AddLogListenerResponse extends SimpleResponse {
public LogHelper.OutputTypes outputType = LogHelper.OutputTypes.PLAIN; public final LogHelper.OutputTypes outputType = LogHelper.OutputTypes.PLAIN;
@Override @Override
public String getType() { public String getType() {

View file

@ -30,7 +30,7 @@
import pro.gravit.utils.helper.VerifyHelper; import pro.gravit.utils.helper.VerifyHelper;
public class AuthResponse extends SimpleResponse { public class AuthResponse extends SimpleResponse {
public transient static Random random = new SecureRandom(); public final transient static Random random = new SecureRandom();
public String login; public String login;
public String client; public String client;
public String customText; public String customText;
@ -139,14 +139,14 @@ public AuthContext(Client client, String login, String customText, String profil
this.ip = ip; this.ip = ip;
this.authType = authType; this.authType = authType;
} }
public String login; public final String login;
@Deprecated @Deprecated
public int password_length; //Use AuthProvider for get password public int password_length; //Use AuthProvider for get password
public String profileName; public final String profileName;
public HWID hwid; public final HWID hwid;
public String customText; public final String customText;
public String ip; public final String ip;
public ConnectTypes authType; public final ConnectTypes authType;
public Client client; public final Client client;
} }
} }

View file

@ -16,7 +16,7 @@ public String getType() {
} }
@Override @Override
public void execute(ChannelHandlerContext ctx, Client client) throws Exception { public void execute(ChannelHandlerContext ctx, Client client) {
if(( oldPassword == null && username == null ) || newPassword == null) if(( oldPassword == null && username == null ) || newPassword == null)
{ {
sendError("Request invalid"); sendError("Request invalid");

View file

@ -10,7 +10,7 @@
import pro.gravit.utils.helper.LogHelper; import pro.gravit.utils.helper.LogHelper;
public class BatchProfileByUsername extends SimpleResponse { public class BatchProfileByUsername extends SimpleResponse {
class Entry { static class Entry {
String username; String username;
String client; String client;
} }

View file

@ -49,22 +49,22 @@ public static void prepare() throws Exception
.setCertificateManager(new CertificateManager()) .setCertificateManager(new CertificateManager())
.setLaunchServerConfigManager(new LaunchServer.LaunchServerConfigManager() { .setLaunchServerConfigManager(new LaunchServer.LaunchServerConfigManager() {
@Override @Override
public LaunchServerConfig readConfig() throws IOException { public LaunchServerConfig readConfig() {
return null; return null;
} }
@Override @Override
public LaunchServerRuntimeConfig readRuntimeConfig() throws IOException { public LaunchServerRuntimeConfig readRuntimeConfig() {
return null; return null;
} }
@Override @Override
public void writeConfig(LaunchServerConfig config) throws IOException { public void writeConfig(LaunchServerConfig config) {
} }
@Override @Override
public void writeRuntimeConfig(LaunchServerRuntimeConfig config) throws IOException { public void writeRuntimeConfig(LaunchServerRuntimeConfig config) {
} }
}) })
@ -73,8 +73,7 @@ public void writeRuntimeConfig(LaunchServerRuntimeConfig config) throws IOExcept
launchServer = builder.build(); launchServer = builder.build();
} }
@Test @Test
public void start() throws Exception public void start() {
{
launchServer.run(); launchServer.run();
} }
} }

View file

@ -17,7 +17,7 @@ public String getUsageDescription() {
} }
@Override @Override
public void invoke(String... args) throws Exception { public void invoke(String... args) {
System.exit(0); System.exit(0);
} }
} }

View file

@ -8,9 +8,9 @@
import pro.gravit.utils.helper.LogHelper; import pro.gravit.utils.helper.LogHelper;
public class LogListenerCommand extends Command { public class LogListenerCommand extends Command {
public class LogListenerRequest implements WebSocketRequest { public static class LogListenerRequest implements WebSocketRequest {
@LauncherNetworkAPI @LauncherNetworkAPI
public LogHelper.OutputTypes outputType; public final LogHelper.OutputTypes outputType;
public LogListenerRequest(LogHelper.OutputTypes outputType) { public LogListenerRequest(LogHelper.OutputTypes outputType) {
this.outputType = outputType; this.outputType = outputType;

View file

@ -21,7 +21,7 @@ public class ClientLauncherWrapper {
public static final String WAIT_PROCESS_PROPERTY = "launcher.waitProcess"; public static final String WAIT_PROCESS_PROPERTY = "launcher.waitProcess";
public static final String NO_JAVA9_CHECK_PROPERTY = "launcher.noJava9Check"; public static final String NO_JAVA9_CHECK_PROPERTY = "launcher.noJava9Check";
public static boolean waitProcess = Boolean.getBoolean(WAIT_PROCESS_PROPERTY); public static boolean waitProcess = Boolean.getBoolean(WAIT_PROCESS_PROPERTY);
public static boolean noJava9check = Boolean.getBoolean(NO_JAVA9_CHECK_PROPERTY); public static final boolean noJava9check = Boolean.getBoolean(NO_JAVA9_CHECK_PROPERTY);
public static void main(String[] arguments) throws IOException, InterruptedException { public static void main(String[] arguments) throws IOException, InterruptedException {
LogHelper.printVersion("Launcher"); LogHelper.printVersion("Launcher");

View file

@ -48,11 +48,11 @@ public class NewLauncherSettings {
public static class HashedStoreEntry { public static class HashedStoreEntry {
@LauncherAPI @LauncherAPI
public HashedDir hdir; public final HashedDir hdir;
@LauncherAPI @LauncherAPI
public String name; public final String name;
@LauncherAPI @LauncherAPI
public String fullPath; public final String fullPath;
@LauncherAPI @LauncherAPI
public transient boolean needSave = false; public transient boolean needSave = false;
@ -64,7 +64,7 @@ public HashedStoreEntry(HashedDir hdir, String name, String fullPath) {
} }
@LauncherAPI @LauncherAPI
public transient List<HashedStoreEntry> lastHDirs = new ArrayList<>(16); public final transient List<HashedStoreEntry> lastHDirs = new ArrayList<>(16);
@LauncherAPI @LauncherAPI
public void putHDir(String name, Path path, HashedDir dir) { public void putHDir(String name, Path path, HashedDir dir) {

View file

@ -596,12 +596,12 @@ public static void verifyHDir(Path dir, HashedDir hdir, FileNameMatcher matcher,
private ClientLauncher() { private ClientLauncher() {
} }
public static interface ParamsAPI { public interface ParamsAPI {
ParamContainer read() throws Exception; ParamContainer read() throws Exception;
void write(ParamContainer p) throws Exception; void write(ParamContainer p);
} }
public static ParamsAPI container = new ParamsAPI() { public static final ParamsAPI container = new ParamsAPI() {
@Override @Override
public ParamContainer read() throws Exception { public ParamContainer read() throws Exception {
ParamContainer p; ParamContainer p;
@ -614,7 +614,7 @@ public ParamContainer read() throws Exception {
return p; return p;
} }
@Override @Override
public void write(ParamContainer p) throws Exception { public void write(ParamContainer p) {
setWriteParamsThread(CommonHelper.newThread("Client params writter", true, () -> setWriteParamsThread(CommonHelper.newThread("Client params writter", true, () ->
{ {
try { try {

View file

@ -9,7 +9,7 @@
public class ClientLauncherContext { public class ClientLauncherContext {
public Path javaBin; public Path javaBin;
public List<String> args = new LinkedList<>(); public final List<String> args = new LinkedList<>();
public String pathLauncher; public String pathLauncher;
public ProcessBuilder builder; public ProcessBuilder builder;
public ClientProfile clientProfile; public ClientProfile clientProfile;

View file

@ -16,17 +16,17 @@ public ClientModuleManager() {
} }
@Override @Override
public void autoload() throws IOException { public void autoload() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override @Override
public void autoload(Path dir) throws IOException { public void autoload(Path dir) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }
@Override @Override
public LauncherModule loadModule(Path file) throws IOException { public LauncherModule loadModule(Path file) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
} }

View file

@ -26,11 +26,11 @@
public class FunctionalBridge { public class FunctionalBridge {
@LauncherAPI @LauncherAPI
public static ScheduledExecutorService threadPool = Executors.newScheduledThreadPool(0); public static final ScheduledExecutorService threadPool = Executors.newScheduledThreadPool(0);
@LauncherAPI @LauncherAPI
public static OshiHWIDProvider hwidProvider; public static OshiHWIDProvider hwidProvider;
@LauncherAPI @LauncherAPI
public static AtomicReference<HWID> hwid = new AtomicReference<>(); public static final AtomicReference<HWID> hwid = new AtomicReference<>();
@LauncherAPI @LauncherAPI
public static Thread getHWID = null; public static Thread getHWID = null;

View file

@ -22,7 +22,7 @@
import pro.gravit.utils.helper.VerifyHelper; import pro.gravit.utils.helper.VerifyHelper;
public final class ServerPinger { public final class ServerPinger {
private JsonParser parser = new JsonParser(); private final JsonParser parser = new JsonParser();
public static final class Result { public static final class Result {
@LauncherAPI @LauncherAPI

View file

@ -3,5 +3,5 @@
import pro.gravit.utils.ProviderMap; import pro.gravit.utils.ProviderMap;
public class UserSettings { public class UserSettings {
public static ProviderMap<UserSettings> providers = new ProviderMap<>(); public static final ProviderMap<UserSettings> providers = new ProviderMap<>();
} }

View file

@ -4,7 +4,7 @@
import pro.gravit.launcher.modules.LauncherModule; import pro.gravit.launcher.modules.LauncherModule;
public class ClientPreGuiPhase extends LauncherModule.Event { public class ClientPreGuiPhase extends LauncherModule.Event {
public RuntimeProvider runtimeProvider; public final RuntimeProvider runtimeProvider;
public ClientPreGuiPhase(RuntimeProvider runtimeProvider) { public ClientPreGuiPhase(RuntimeProvider runtimeProvider) {
this.runtimeProvider = runtimeProvider; this.runtimeProvider = runtimeProvider;

View file

@ -18,7 +18,7 @@ public String getUsageDescription() {
@Override @Override
public void invoke(String... args) throws Exception { public void invoke(String... args) throws Exception {
verifyArgs(args, 2); verifyArgs(args, 2);
boolean enabled = Boolean.valueOf(args[1]); boolean enabled = Boolean.parseBoolean(args[1]);
switch (args[0]) { switch (args[0]) {
case "store": { case "store": {
SettingsManager.settings.featureStore = enabled; SettingsManager.settings.featureStore = enabled;

View file

@ -8,9 +8,9 @@
import pro.gravit.utils.helper.LogHelper; import pro.gravit.utils.helper.LogHelper;
public class LogListenerCommand extends Command { public class LogListenerCommand extends Command {
public class LogListenerRequest implements WebSocketRequest { public static class LogListenerRequest implements WebSocketRequest {
@LauncherNetworkAPI @LauncherNetworkAPI
public LogHelper.OutputTypes outputType; public final LogHelper.OutputTypes outputType;
public LogListenerRequest(LogHelper.OutputTypes outputType) { public LogListenerRequest(LogHelper.OutputTypes outputType) {
this.outputType = outputType; this.outputType = outputType;

View file

@ -24,8 +24,8 @@ public String getUsageDescription() {
public void invoke(String... args) throws Exception { public void invoke(String... args) throws Exception {
verifyArgs(args, 2); verifyArgs(args, 2);
int ind = 1; int ind = 1;
int index = Integer.valueOf(args[0]); int index = Integer.parseInt(args[0]);
boolean overwrite = Boolean.valueOf(args[1]); boolean overwrite = Boolean.parseBoolean(args[1]);
for (NewLauncherSettings.HashedStoreEntry e : SettingsManager.settings.lastHDirs) { for (NewLauncherSettings.HashedStoreEntry e : SettingsManager.settings.lastHDirs) {
if (ind == index) { if (ind == index) {
LogHelper.info("Copy [%d] FullPath: %s name: %s", ind, e.fullPath, e.name); LogHelper.info("Copy [%d] FullPath: %s name: %s", ind, e.fullPath, e.name);

View file

@ -25,7 +25,7 @@ public String getUsageDescription() {
public void invoke(String... args) throws Exception { public void invoke(String... args) throws Exception {
verifyArgs(args, 1); verifyArgs(args, 1);
int ind = 1; int ind = 1;
int index = Integer.valueOf(args[0]); int index = Integer.parseInt(args[0]);
for (NewLauncherSettings.HashedStoreEntry e : SettingsManager.settings.lastHDirs) { for (NewLauncherSettings.HashedStoreEntry e : SettingsManager.settings.lastHDirs) {
if (ind == index) { if (ind == index) {
LogHelper.info("Copy [%d] FullPath: %s name: %s", ind, e.fullPath, e.name); LogHelper.info("Copy [%d] FullPath: %s name: %s", ind, e.fullPath, e.name);

View file

@ -17,7 +17,7 @@ public String getUsageDescription() {
} }
@Override @Override
public void invoke(String... args) throws Exception { public void invoke(String... args) {
int ind = 1; int ind = 1;
for (NewLauncherSettings.HashedStoreEntry e : SettingsManager.settings.lastHDirs) { for (NewLauncherSettings.HashedStoreEntry e : SettingsManager.settings.lastHDirs) {
LogHelper.info("[%d] FullPath: %s name: %s", ind, e.fullPath, e.name); LogHelper.info("[%d] FullPath: %s name: %s", ind, e.fullPath, e.name);

View file

@ -5,5 +5,5 @@ public interface RuntimeProvider {
void preLoad() throws Exception; void preLoad() throws Exception;
void init(boolean clientInstance) throws Exception; void init(boolean clientInstance);
} }

View file

@ -8,13 +8,13 @@
import pro.gravit.utils.HookSet; import pro.gravit.utils.HookSet;
public class ClientHookManager { public class ClientHookManager {
public static HookSet<RuntimeProvider> initGuiHook = new HookSet<>(); public static final HookSet<RuntimeProvider> initGuiHook = new HookSet<>();
public static HookSet<HInput> paramsInputHook = new HookSet<>(); public static final HookSet<HInput> paramsInputHook = new HookSet<>();
public static HookSet<HOutput> paramsOutputHook = new HookSet<>(); public static final HookSet<HOutput> paramsOutputHook = new HookSet<>();
public static HookSet<ClientLauncherContext> clientLaunchHook = new HookSet<>(); public static final HookSet<ClientLauncherContext> clientLaunchHook = new HookSet<>();
public static HookSet<ClientLauncherContext> clientLaunchFinallyHook = new HookSet<>(); public static final HookSet<ClientLauncherContext> clientLaunchFinallyHook = new HookSet<>();
public static BiHookSet<ClientLauncherContext, ProcessBuilder> preStartHook = new BiHookSet<>(); public static final BiHookSet<ClientLauncherContext, ProcessBuilder> preStartHook = new BiHookSet<>();
public static BiHookSet<ClientLauncherContext, ProcessBuilder> postStartHook = new BiHookSet<>(); public static final BiHookSet<ClientLauncherContext, ProcessBuilder> postStartHook = new BiHookSet<>();
} }

View file

@ -18,7 +18,7 @@
public class HasherStore { public class HasherStore {
public Map<String, HasherStoreEnity> store; public Map<String, HasherStoreEnity> store;
public class HasherStoreEnity { public static class HasherStoreEnity {
@LauncherAPI @LauncherAPI
public HashedDir hdir; public HashedDir hdir;
@LauncherAPI @LauncherAPI

View file

@ -19,7 +19,7 @@
import pro.gravit.utils.helper.LogHelper; import pro.gravit.utils.helper.LogHelper;
public class SettingsManager extends JsonConfigurable<NewLauncherSettings> { public class SettingsManager extends JsonConfigurable<NewLauncherSettings> {
public class StoreFileVisitor extends SimpleFileVisitor<Path> { public static class StoreFileVisitor extends SimpleFileVisitor<Path> {
@Override @Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
throws IOException { throws IOException {

View file

@ -33,7 +33,7 @@ public static void apply() {
} }
} }
public static void exit(final int code) throws Throwable { public static void exit(final int code) {
for (MethodHandle mh : MHS) for (MethodHandle mh : MHS)
try { try {
mh.invoke(code); mh.invoke(code);

View file

@ -14,7 +14,7 @@ public NativeJVMHalt(int haltCode) {
System.out.println("JVM exit code " + haltCode); System.out.println("JVM exit code " + haltCode);
} }
public int haltCode; public final int haltCode;
public native void aaabbb38C_D(); public native void aaabbb38C_D();

View file

@ -13,11 +13,11 @@ public class ClientPermissions {
@LauncherAPI @LauncherAPI
public boolean canServer; public boolean canServer;
@LauncherAPI @LauncherAPI
public boolean canUSR1; public final boolean canUSR1;
@LauncherAPI @LauncherAPI
public boolean canUSR2; public final boolean canUSR2;
@LauncherAPI @LauncherAPI
public boolean canUSR3; public final boolean canUSR3;
@LauncherAPI @LauncherAPI
public boolean canBot; public boolean canBot;

View file

@ -3,7 +3,7 @@
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
public class SecureAutogenConfig { public class SecureAutogenConfig {
public byte[][] certificates; public final byte[][] certificates;
public SecureAutogenConfig() { public SecureAutogenConfig() {
//Пока не реализован SecureLauncherConfigurator //Пока не реализован SecureLauncherConfigurator

View file

@ -9,6 +9,7 @@
import java.net.URL; import java.net.URL;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.CopyOnWriteArrayList;
@ -52,8 +53,8 @@ public interface DownloadTotalCallback {
} }
public static class DownloadTask { public static class DownloadTask {
public String apply; public final String apply;
public long size; public final long size;
public DownloadTask(String apply, long size) { public DownloadTask(String apply, long size) {
this.apply = apply; this.apply = apply;
@ -65,7 +66,7 @@ public void download(String base, List<DownloadTask> applies, Path dstDirFile, D
try (CloseableHttpClient httpclient = HttpClients.custom().setUserAgent(IOHelper.USER_AGENT) try (CloseableHttpClient httpclient = HttpClients.custom().setUserAgent(IOHelper.USER_AGENT)
.setRedirectStrategy(new LaxRedirectStrategy()) .setRedirectStrategy(new LaxRedirectStrategy())
.build()) { .build()) {
applies.sort((a,b) -> Long.compare(a.size, b.size)); applies.sort(Comparator.comparingLong(a -> a.size));
List<Callable<Void>> toExec = new ArrayList<>(); List<Callable<Void>> toExec = new ArrayList<>();
URI baseUri = new URI(base); URI baseUri = new URI(base);
String scheme = baseUri.getScheme(); String scheme = baseUri.getScheme();
@ -106,7 +107,7 @@ public void download(String base, List<DownloadTask> applies, Path dstDirFile, D
} }
} }
public void downloadZip(String base, List<DownloadTask> applies, Path dstDirFile, DownloadCallback callback, DownloadTotalCallback totalCallback, boolean fullDownload) throws IOException, URISyntaxException { public void downloadZip(String base, List<DownloadTask> applies, Path dstDirFile, DownloadCallback callback, DownloadTotalCallback totalCallback, boolean fullDownload) throws IOException {
/*try (CloseableHttpClient httpclient = HttpClients.custom() /*try (CloseableHttpClient httpclient = HttpClients.custom()
.setRedirectStrategy(new LaxRedirectStrategy()) .setRedirectStrategy(new LaxRedirectStrategy())
.build()) { .build()) {

View file

@ -15,5 +15,5 @@ public ControlEvent(ControlCommand signal) {
this.signal = signal; this.signal = signal;
} }
public ControlCommand signal; public final ControlCommand signal;
} }

View file

@ -5,7 +5,7 @@
//Используется, что бы послать короткое сообщение, которое вмещается в int //Используется, что бы послать короткое сообщение, которое вмещается в int
public class SignalEvent { public class SignalEvent {
@LauncherNetworkAPI @LauncherNetworkAPI
public int signal; public final int signal;
public SignalEvent(int signal) { public SignalEvent(int signal) {
this.signal = signal; this.signal = signal;

View file

@ -10,7 +10,7 @@ public String getType() {
} }
@LauncherNetworkAPI @LauncherNetworkAPI
public boolean success; public final boolean success;
public ExecCommandRequestEvent(boolean success) { public ExecCommandRequestEvent(boolean success) {
this.success = success; this.success = success;

View file

@ -8,9 +8,9 @@
public class GetAvailabilityAuthRequestEvent extends RequestEvent { public class GetAvailabilityAuthRequestEvent extends RequestEvent {
public static class AuthAvailability { public static class AuthAvailability {
@LauncherNetworkAPI @LauncherNetworkAPI
public String name; public final String name;
@LauncherNetworkAPI @LauncherNetworkAPI
public String displayName; public final String displayName;
public AuthAvailability(String name, String displayName) { public AuthAvailability(String name, String displayName) {
this.name = name; this.name = name;
@ -19,7 +19,7 @@ public AuthAvailability(String name, String displayName) {
} }
@LauncherNetworkAPI @LauncherNetworkAPI
public List<AuthAvailability> list; public final List<AuthAvailability> list;
public GetAvailabilityAuthRequestEvent(List<AuthAvailability> list) { public GetAvailabilityAuthRequestEvent(List<AuthAvailability> list) {
this.list = list; this.list = list;

View file

@ -5,7 +5,7 @@
public class GetSecureTokenRequestEvent extends RequestEvent { public class GetSecureTokenRequestEvent extends RequestEvent {
@LauncherNetworkAPI @LauncherNetworkAPI
public String secureToken; public final String secureToken;
@Override @Override
public String getType() { public String getType() {

View file

@ -15,7 +15,7 @@ public JoinServerRequestEvent(boolean allow) {
} }
@LauncherNetworkAPI @LauncherNetworkAPI
public boolean allow; public final boolean allow;
@Override @Override
public String getType() { public String getType() {

View file

@ -10,7 +10,7 @@ public String getType() {
} }
@LauncherNetworkAPI @LauncherNetworkAPI
public String string; public final String string;
public LogEvent(String string) { public LogEvent(String string) {
this.string = string; this.string = string;

View file

@ -13,7 +13,7 @@ public class ProfileByUsernameRequestEvent extends RequestEvent {
@LauncherNetworkAPI @LauncherNetworkAPI
public String error; public String error;
@LauncherNetworkAPI @LauncherNetworkAPI
public PlayerProfile playerProfile; public final PlayerProfile playerProfile;
public ProfileByUsernameRequestEvent(PlayerProfile playerProfile) { public ProfileByUsernameRequestEvent(PlayerProfile playerProfile) {
this.playerProfile = playerProfile; this.playerProfile = playerProfile;

View file

@ -11,7 +11,7 @@ public class SetProfileRequestEvent extends RequestEvent {
@SuppressWarnings("unused") @SuppressWarnings("unused")
private static final UUID uuid = UUID.fromString("08c0de9e-4364-4152-9066-8354a3a48541"); private static final UUID uuid = UUID.fromString("08c0de9e-4364-4152-9066-8354a3a48541");
@LauncherNetworkAPI @LauncherNetworkAPI
public ClientProfile newProfile; public final ClientProfile newProfile;
public SetProfileRequestEvent(ClientProfile newProfile) { public SetProfileRequestEvent(ClientProfile newProfile) {
this.newProfile = newProfile; this.newProfile = newProfile;

View file

@ -6,11 +6,11 @@
public class UpdateRequestEvent extends RequestEvent { public class UpdateRequestEvent extends RequestEvent {
@LauncherNetworkAPI @LauncherNetworkAPI
public HashedDir hdir; public final HashedDir hdir;
@LauncherNetworkAPI @LauncherNetworkAPI
public String url; public String url;
@LauncherNetworkAPI @LauncherNetworkAPI
public boolean zip; public final boolean zip;
@LauncherNetworkAPI @LauncherNetworkAPI
public boolean fullDownload; public boolean fullDownload;

View file

@ -5,7 +5,7 @@
public class VerifySecureTokenRequestEvent extends RequestEvent { public class VerifySecureTokenRequestEvent extends RequestEvent {
@LauncherAPI @LauncherAPI
public boolean success; public final boolean success;
@Override @Override
public String getType() { public String getType() {

View file

@ -3,7 +3,7 @@
import pro.gravit.utils.ProviderMap; import pro.gravit.utils.ProviderMap;
public class HWIDProvider { public class HWIDProvider {
public static ProviderMap<HWID> hwids = new ProviderMap<>(); public static final ProviderMap<HWID> hwids = new ProviderMap<>();
public static void registerHWIDs() public static void registerHWIDs()
{ {
hwids.register("oshi", OshiHWID.class); hwids.register("oshi", OshiHWID.class);

View file

@ -10,7 +10,7 @@
import pro.gravit.utils.helper.LogHelper; import pro.gravit.utils.helper.LogHelper;
public class SimpleModulesConfigManager implements ModulesConfigManager { public class SimpleModulesConfigManager implements ModulesConfigManager {
public Path configDir; public final Path configDir;
public SimpleModulesConfigManager(Path configDir) { public SimpleModulesConfigManager(Path configDir) {
this.configDir = configDir; this.configDir = configDir;

View file

@ -7,7 +7,7 @@ public abstract class LauncherModule {
private LauncherModulesContext context; private LauncherModulesContext context;
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
private Map<Class<? extends Event>, EventHandler> eventMap = new HashMap<>(); private final Map<Class<? extends Event>, EventHandler> eventMap = new HashMap<>();
protected LauncherModulesManager modulesManager; protected LauncherModulesManager modulesManager;
protected final LauncherModuleInfo moduleInfo; protected final LauncherModuleInfo moduleInfo;
protected ModulesConfigManager modulesConfigManager; protected ModulesConfigManager modulesConfigManager;

View file

@ -5,7 +5,7 @@
import pro.gravit.launcher.modules.LauncherModule; import pro.gravit.launcher.modules.LauncherModule;
public class PreGsonPhase extends LauncherModule.Event { public class PreGsonPhase extends LauncherModule.Event {
public GsonBuilder gsonBuilder; public final GsonBuilder gsonBuilder;
public PreGsonPhase(GsonBuilder gsonBuilder) { public PreGsonPhase(GsonBuilder gsonBuilder) {
this.gsonBuilder = gsonBuilder; this.gsonBuilder = gsonBuilder;

Some files were not shown because too many files have changed in this diff Show more