[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.Timer;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Stream;
import org.bouncycastle.crypto.util.PrivateKeyFactory;
import org.bouncycastle.operator.OperatorCreationException;
@ -153,7 +154,7 @@ public void invoke(String... args) throws Exception {
reload(ReloadType.NO_COMPONENTS);
break;
default:
reload(ReloadType.FULL);;
reload(ReloadType.FULL);
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 ProfilesFileVisitor(Collection<ClientProfile> result) {
@ -215,7 +216,7 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO
// Server config
public LaunchServerConfig config;
public LaunchServerRuntimeConfig runtime;
public final LaunchServerRuntimeConfig runtime;
public final ECPublicKey publicKey;
@ -225,7 +226,7 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO
public final JARLauncherBinary launcherBinary;
public Class<? extends LauncherBinary> launcherEXEBinaryClass;
public final Class<? extends LauncherBinary> launcherEXEBinaryClass;
public final LauncherBinary launcherEXEBinary;
// HWID ban + anti-brutforce
@ -263,7 +264,7 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO
public final Timer taskPool;
public static Class<? extends LauncherBinary> defaultLauncherEXEBinaryClass = null;
public static final Class<? extends LauncherBinary> defaultLauncherEXEBinaryClass = null;
public static class LaunchServerDirectories
{
@ -402,10 +403,7 @@ public LaunchServer(LaunchServerDirectories directories, LaunchServerEnv env, La
Files.createDirectory(profilesDir);
syncProfilesDir();
if (config.netty != null)
nettyServerSocketHandler = new NettyServerSocketHandler(this);
else
nettyServerSocketHandler = null;
// post init modules
modulesManager.invokeEvent(new LaunchServerPostInitPhase(this));
if (config.components != null) {
@ -548,7 +546,7 @@ public void syncUpdatesDir(Collection<String> dirs) throws IOException {
// Resolve name and verify is dir
String name = IOHelper.getFileName(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);
continue;
}

View file

@ -43,7 +43,7 @@
import pro.gravit.utils.verify.LauncherTrustManager;
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 {
JVMHelper.checkStackTrace(LaunchServerStarter.class);
JVMHelper.verifySystemProperties(LaunchServer.class, true);

View file

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

View file

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

View file

@ -10,7 +10,7 @@
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;

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<String, UUID> usernameCache;
}
@ -48,7 +48,7 @@ public Map<String, Command> getCommands() {
Map<String, Command> commands = new HashMap<>();
commands.put("clear", new SubCommand() {
@Override
public void invoke(String... args) throws Exception {
public void invoke(String... args) {
long entryCacheSize = entryCache.size();
long usernamesCacheSize = usernamesCache.size();
entryCache.clear();

View file

@ -7,21 +7,21 @@
public class HibernateAuthHandler extends CachedAuthHandler {
@Override
protected Entry fetchEntry(String username) throws IOException {
protected Entry fetchEntry(String username) {
User user = srv.config.dao.userService.findUserByUsername(username);
if(user == null) return null;
return new Entry(user.uuid, username, user.getAccessToken(), user.serverID);
}
@Override
protected Entry fetchEntry(UUID uuid) throws IOException {
protected Entry fetchEntry(UUID uuid) {
User user = srv.config.dao.userService.findUserByUUID(uuid);
if(user == null) return null;
return new Entry(user.uuid, user.username, user.getAccessToken(), user.serverID);
}
@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.setAccessToken(accessToken);
srv.config.dao.userService.updateUser(user);
@ -29,7 +29,7 @@ protected boolean updateAuth(UUID uuid, String username, String accessToken) thr
}
@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.serverID = serverID;
srv.config.dao.userService.updateUser(user);
@ -37,7 +37,7 @@ protected boolean updateServerID(UUID uuid, String serverID) throws IOException
}
@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 updateServerIdUrl;
public class EntryRequestByUsername {
public String username;
public static class EntryRequestByUsername {
public final String username;
public EntryRequestByUsername(String username) {
this.username = username;
}
}
public class EntryRequestByUUID {
public UUID uuid;
public static class EntryRequestByUUID {
public final UUID uuid;
public EntryRequestByUUID(UUID uuid) {
this.uuid = uuid;
}
}
public class UpdateAuthRequest {
public UUID uuid;
public String username;
public String accessToken;
public static class UpdateAuthRequest {
public final UUID uuid;
public final String username;
public final String accessToken;
public UpdateAuthRequest(UUID uuid, String username, String accessToken) {
this.uuid = uuid;
@ -40,9 +40,9 @@ public UpdateAuthRequest(UUID uuid, String username, String accessToken) {
}
}
public class UpdateServerIDRequest {
public UUID uuid;
public String serverID;
public static class UpdateServerIDRequest {
public final UUID uuid;
public final String serverID;
public UpdateServerIDRequest(UUID uuid, String serverID) {
this.uuid = uuid;
@ -50,7 +50,7 @@ public UpdateServerIDRequest(UUID uuid, String serverID) {
}
}
public class SuccessResponse {
public static class SuccessResponse {
public boolean success;
}

View file

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

View file

@ -12,7 +12,7 @@
import pro.gravit.utils.helper.LogHelper;
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;

View file

@ -18,8 +18,8 @@
import pro.gravit.utils.helper.LogHelper;
public class JsonFileHWIDHandler extends HWIDHandler {
public class Entry {
public HWID hwid;
public static class Entry {
public final HWID hwid;
public String username;
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 String banMessage = "You banned";
public final String banMessage = "You banned";
@Override
public void ban(List<HWID> hwid) {
for (Entry e : list) {
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) {
for (Entry e : list) {
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 String apiKey;
public class banRequest {
public static class banRequest {
public banRequest(OshiHWID hwid) {
this.hwid = hwid;
}
OshiHWID hwid;
final 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) {
this.username = username;
this.hwid = hwid;
}
String username;
OshiHWID hwid;
final String username;
final 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;
}
public class BannedResult {
public static class BannedResult {
boolean isBanned;
String error;
}
public class HWIDRequest {
public static class HWIDRequest {
public HWIDRequest(String username) {
this.username = username;
}
String username;
final String username;
String apiKey;
public HWIDRequest(String username, String apiKey) {

View file

@ -7,8 +7,8 @@
import pro.gravit.launcher.hwid.HWID;
public class MemoryHWIDHandler extends HWIDHandler {
public class Entry {
public HWID hwid;
public static class Entry {
public final HWID hwid;
public String username;
public boolean isBanned = false;
@ -30,14 +30,17 @@ public int hashCode() {
}
}
public transient LinkedList<Entry> list = new LinkedList<>();
public String banMessage = "You banned";
public final transient LinkedList<Entry> list = new LinkedList<>();
public final String banMessage = "You banned";
@Override
public void ban(List<HWID> hwid) {
for (Entry e : list) {
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) {
for (Entry e : list) {
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 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` = ?"
private int compare = 50; //При наборе схожести в 50 очков
private boolean oneCompareMode = false;
private final int compare = 50; //При наборе схожести в 50 очков
private final boolean oneCompareMode = false;
/*
//Добавить поля hwid в базу с пользователями
@ -151,7 +151,7 @@ public void onCheckInfo(OshiHWID hwid, String username, Connection c) throws HWI
db_hwid.serialNumber = set.getString(hwidFieldSerialNumber);
db_hwid.processorID = set.getString(hwidFieldProcessorID);
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);
if (LogHelper.isDevEnabled()) {
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();
if (rs.next()) {
OshiHWID oshiHWID = new OshiHWID();
oshiHWID.totalMemory = Long.valueOf(rs.getString(hwidFieldTotalMemory));
oshiHWID.totalMemory = Long.parseLong(rs.getString(hwidFieldTotalMemory));
oshiHWID.serialNumber = rs.getString(hwidFieldSerialNumber);
oshiHWID.HWDiskSerial = rs.getString(hwidFieldHWDiskSerial);
oshiHWID.processorID = rs.getString(hwidFieldProcessorID);

View file

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

View file

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

View file

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

View file

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

View file

@ -5,7 +5,7 @@
import pro.gravit.utils.ProviderMap;
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;
private static boolean registredHandl = false;

View file

@ -4,7 +4,7 @@
import pro.gravit.utils.ProviderMap;
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;

View file

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

View file

@ -8,7 +8,7 @@
import pro.gravit.utils.ProviderMap;
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;
protected transient LaunchServer srv = null;
public static AuthProviderResult authError(String message) throws AuthException {

View file

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

View file

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

View file

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

View file

@ -7,7 +7,7 @@
import pro.gravit.utils.ProviderMap;
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;
public static void registerProviders() {

View file

@ -114,8 +114,8 @@ private void setConfig() {
ConfigPersister.getInstance().setAntConfig(config, null);
}
private static String VERSION = Version.getVersion().getVersionString();
private static int BUILD = Version.getVersion().build;
private static final String VERSION = Version.getVersion().getVersionString();
private static final int BUILD = Version.getVersion().build;
public static String formatVars(String mask) {
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 guardDir;
public final Path buildDir;
public List<LauncherBuildTask> tasks;
public List<Path> coreLibs;
public List<Path> addonLibs;
public final List<LauncherBuildTask> tasks;
public final List<Path> coreLibs;
public final List<Path> addonLibs;
public JARLauncherBinary(LaunchServer server) throws IOException {
super(server, resolve(server, ".jar"));

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -19,7 +19,7 @@ public String getUsageDescription() {
}
@Override
public void invoke(String... args) throws Exception {
public void invoke(String... args) {
//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];
ClientPermissions permissions = server.config.permissionsHandler.getPermissions(username);
String permission = args[1];
boolean isEnabled = Boolean.valueOf(args[2]);
boolean isEnabled = Boolean.parseBoolean(args[2]);
switch (permission) {
case "admin": {
permissions.canAdmin = isEnabled;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -6,7 +6,7 @@
import pro.gravit.utils.ProviderMap;
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 UserService userService;
public static void registerProviders()

View file

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

View file

@ -15,7 +15,7 @@
public class MirrorManager {
public static class Mirror {
String baseUrl;
final String baseUrl;
boolean enabled;
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;
public void addMirror(String mirror) {
@ -44,7 +44,7 @@ public void addMirror(String mirror) {
list.add(m);
}
public void addMirror(String mirror, boolean enabled) throws MalformedURLException {
public void addMirror(String mirror, boolean enabled) {
Mirror m = new Mirror(mirror);
m.enabled = enabled;
if (defaultMirror == null && enabled) defaultMirror = m;

View file

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

View file

@ -9,17 +9,17 @@
import pro.gravit.utils.HookSet;
public class AuthHookManager {
public BiHookSet<AuthResponse.AuthContext, Client> preHook = new BiHookSet<>();
public BiHookSet<AuthResponse.AuthContext, Client> postHook = new BiHookSet<>();
public BiHookSet<CheckServerResponse, Client> checkServerHook = new BiHookSet<>();
public BiHookSet<JoinServerResponse, Client> joinServerHook = new BiHookSet<>();
public BiHookSet<SetProfileResponse, Client> setProfileHook = new BiHookSet<>();
public final BiHookSet<AuthResponse.AuthContext, Client> preHook = new BiHookSet<>();
public final BiHookSet<AuthResponse.AuthContext, Client> postHook = new BiHookSet<>();
public final BiHookSet<CheckServerResponse, Client> checkServerHook = new BiHookSet<>();
public final BiHookSet<JoinServerResponse, Client> joinServerHook = new BiHookSet<>();
public final BiHookSet<SetProfileResponse, Client> setProfileHook = new BiHookSet<>();
public static class RegContext
{
public String login;
public String password;
public String ip;
public boolean trustContext;
public final String login;
public final String password;
public final String ip;
public final boolean trustContext;
public RegContext(String login, String password, String ip, boolean trustContext) {
this.login = login;
this.password = password;
@ -27,5 +27,5 @@ public RegContext(String login, String password, String ip, boolean 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;
public class LaunchServerModulesManager extends SimpleModuleManager {
public LaunchServerCoreModule coreModule;
public final LaunchServerCoreModule coreModule;
public LaunchServerModulesManager(Path modulesDir, Path configDir, LauncherTrustManager trustManager) {
super(modulesDir, configDir, trustManager);
coreModule = new LaunchServerCoreModule();

View file

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

View file

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

View file

@ -11,7 +11,7 @@
import pro.gravit.utils.helper.LogHelper;
public class NettyIpForwardHandler extends MessageToMessageDecoder<HttpRequest> {
private NettyConnectContext context;
private final NettyConnectContext context;
public NettyIpForwardHandler(NettyConnectContext context) {
super();
@ -19,7 +19,7 @@ public NettyIpForwardHandler(NettyConnectContext context) {
}
@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) {
((ReferenceCounted) msg).retain();
}

View file

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

View file

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

View file

@ -30,7 +30,7 @@
import pro.gravit.utils.helper.VerifyHelper;
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 client;
public String customText;
@ -139,14 +139,14 @@ public AuthContext(Client client, String login, String customText, String profil
this.ip = ip;
this.authType = authType;
}
public String login;
public final String login;
@Deprecated
public int password_length; //Use AuthProvider for get password
public String profileName;
public HWID hwid;
public String customText;
public String ip;
public ConnectTypes authType;
public Client client;
public final String profileName;
public final HWID hwid;
public final String customText;
public final String ip;
public final ConnectTypes authType;
public final Client client;
}
}

View file

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

View file

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

View file

@ -49,22 +49,22 @@ public static void prepare() throws Exception
.setCertificateManager(new CertificateManager())
.setLaunchServerConfigManager(new LaunchServer.LaunchServerConfigManager() {
@Override
public LaunchServerConfig readConfig() throws IOException {
public LaunchServerConfig readConfig() {
return null;
}
@Override
public LaunchServerRuntimeConfig readRuntimeConfig() throws IOException {
public LaunchServerRuntimeConfig readRuntimeConfig() {
return null;
}
@Override
public void writeConfig(LaunchServerConfig config) throws IOException {
public void writeConfig(LaunchServerConfig config) {
}
@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();
}
@Test
public void start() throws Exception
{
public void start() {
launchServer.run();
}
}

View file

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

View file

@ -8,9 +8,9 @@
import pro.gravit.utils.helper.LogHelper;
public class LogListenerCommand extends Command {
public class LogListenerRequest implements WebSocketRequest {
public static class LogListenerRequest implements WebSocketRequest {
@LauncherNetworkAPI
public LogHelper.OutputTypes outputType;
public final LogHelper.OutputTypes outputType;
public LogListenerRequest(LogHelper.OutputTypes 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 NO_JAVA9_CHECK_PROPERTY = "launcher.noJava9Check";
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 {
LogHelper.printVersion("Launcher");

View file

@ -48,11 +48,11 @@ public class NewLauncherSettings {
public static class HashedStoreEntry {
@LauncherAPI
public HashedDir hdir;
public final HashedDir hdir;
@LauncherAPI
public String name;
public final String name;
@LauncherAPI
public String fullPath;
public final String fullPath;
@LauncherAPI
public transient boolean needSave = false;
@ -64,7 +64,7 @@ public HashedStoreEntry(HashedDir hdir, String name, String fullPath) {
}
@LauncherAPI
public transient List<HashedStoreEntry> lastHDirs = new ArrayList<>(16);
public final transient List<HashedStoreEntry> lastHDirs = new ArrayList<>(16);
@LauncherAPI
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() {
}
public static interface ParamsAPI {
public interface ParamsAPI {
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
public ParamContainer read() throws Exception {
ParamContainer p;
@ -614,7 +614,7 @@ public ParamContainer read() throws Exception {
return p;
}
@Override
public void write(ParamContainer p) throws Exception {
public void write(ParamContainer p) {
setWriteParamsThread(CommonHelper.newThread("Client params writter", true, () ->
{
try {

View file

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

View file

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

View file

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

View file

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

View file

@ -3,5 +3,5 @@
import pro.gravit.utils.ProviderMap;
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;
public class ClientPreGuiPhase extends LauncherModule.Event {
public RuntimeProvider runtimeProvider;
public final RuntimeProvider runtimeProvider;
public ClientPreGuiPhase(RuntimeProvider runtimeProvider) {
this.runtimeProvider = runtimeProvider;

View file

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

View file

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

View file

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

View file

@ -17,7 +17,7 @@ public String getUsageDescription() {
}
@Override
public void invoke(String... args) throws Exception {
public void invoke(String... args) {
int ind = 1;
for (NewLauncherSettings.HashedStoreEntry e : SettingsManager.settings.lastHDirs) {
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 init(boolean clientInstance) throws Exception;
void init(boolean clientInstance);
}

View file

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

View file

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

View file

@ -19,7 +19,7 @@
import pro.gravit.utils.helper.LogHelper;
public class SettingsManager extends JsonConfigurable<NewLauncherSettings> {
public class StoreFileVisitor extends SimpleFileVisitor<Path> {
public static class StoreFileVisitor extends SimpleFileVisitor<Path> {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
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)
try {
mh.invoke(code);

View file

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

View file

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

View file

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

View file

@ -9,6 +9,7 @@
import java.net.URL;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.CopyOnWriteArrayList;
@ -52,8 +53,8 @@ public interface DownloadTotalCallback {
}
public static class DownloadTask {
public String apply;
public long size;
public final String apply;
public final long size;
public DownloadTask(String apply, long size) {
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)
.setRedirectStrategy(new LaxRedirectStrategy())
.build()) {
applies.sort((a,b) -> Long.compare(a.size, b.size));
applies.sort(Comparator.comparingLong(a -> a.size));
List<Callable<Void>> toExec = new ArrayList<>();
URI baseUri = new URI(base);
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()
.setRedirectStrategy(new LaxRedirectStrategy())
.build()) {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -7,7 +7,7 @@ public abstract class LauncherModule {
private LauncherModulesContext context;
@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 final LauncherModuleInfo moduleInfo;
protected ModulesConfigManager modulesConfigManager;

View file

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

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