mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 03:31:15 +03:00
[ANY] IDEA Reformat code
This commit is contained in:
parent
f1ccfbf58e
commit
bda1c3658b
126 changed files with 1031 additions and 1101 deletions
|
@ -11,24 +11,20 @@
|
|||
import ru.gravit.launcher.profiles.ClientProfile;
|
||||
import ru.gravit.launcher.serialize.signed.SignedObjectHolder;
|
||||
import ru.gravit.launchserver.auth.AuthProviderPair;
|
||||
import ru.gravit.launchserver.auth.protect.NoProtectHandler;
|
||||
import ru.gravit.launchserver.auth.protect.ProtectHandler;
|
||||
import ru.gravit.launchserver.components.AuthLimiterComponent;
|
||||
import ru.gravit.launchserver.auth.handler.AuthHandler;
|
||||
import ru.gravit.launchserver.auth.handler.MemoryAuthHandler;
|
||||
import ru.gravit.launchserver.auth.hwid.AcceptHWIDHandler;
|
||||
import ru.gravit.launchserver.auth.hwid.HWIDHandler;
|
||||
import ru.gravit.launchserver.auth.permissions.JsonFilePermissionsHandler;
|
||||
import ru.gravit.launchserver.auth.permissions.PermissionsHandler;
|
||||
import ru.gravit.launchserver.auth.protect.NoProtectHandler;
|
||||
import ru.gravit.launchserver.auth.protect.ProtectHandler;
|
||||
import ru.gravit.launchserver.auth.provider.AuthProvider;
|
||||
import ru.gravit.launchserver.auth.provider.RejectAuthProvider;
|
||||
import ru.gravit.launchserver.binary.*;
|
||||
import ru.gravit.launchserver.components.AuthLimiterComponent;
|
||||
import ru.gravit.launchserver.components.Component;
|
||||
import ru.gravit.utils.config.JsonConfigurable;
|
||||
import ru.gravit.launchserver.config.adapter.*;
|
||||
import ru.gravit.utils.command.CommandHandler;
|
||||
import ru.gravit.utils.command.JLineCommandHandler;
|
||||
import ru.gravit.utils.command.StdCommandHandler;
|
||||
import ru.gravit.launchserver.manangers.*;
|
||||
import ru.gravit.launchserver.manangers.hook.AuthHookManager;
|
||||
import ru.gravit.launchserver.manangers.hook.BuildHookManager;
|
||||
|
@ -38,6 +34,10 @@
|
|||
import ru.gravit.launchserver.socket.ServerSocketHandler;
|
||||
import ru.gravit.launchserver.texture.RequestTextureProvider;
|
||||
import ru.gravit.launchserver.texture.TextureProvider;
|
||||
import ru.gravit.utils.command.CommandHandler;
|
||||
import ru.gravit.utils.command.JLineCommandHandler;
|
||||
import ru.gravit.utils.command.StdCommandHandler;
|
||||
import ru.gravit.utils.config.JsonConfigurable;
|
||||
import ru.gravit.utils.helper.*;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
|
@ -96,25 +96,21 @@ public static final class Config {
|
|||
|
||||
private transient AuthProviderPair authDefault;
|
||||
|
||||
public AuthProviderPair getAuthProviderPair(String name)
|
||||
{
|
||||
for(AuthProviderPair pair : auth)
|
||||
{
|
||||
public AuthProviderPair getAuthProviderPair(String name) {
|
||||
for (AuthProviderPair pair : auth) {
|
||||
if (pair.name.equals(name)) return pair;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ProtectHandler protectHandler;
|
||||
|
||||
public PermissionsHandler permissionsHandler;
|
||||
|
||||
public AuthProviderPair getAuthProviderPair()
|
||||
{
|
||||
public AuthProviderPair getAuthProviderPair() {
|
||||
if (authDefault != null) return authDefault;
|
||||
for(AuthProviderPair pair : auth)
|
||||
{
|
||||
if(pair.isDefault)
|
||||
{
|
||||
for (AuthProviderPair pair : auth) {
|
||||
if (pair.isDefault) {
|
||||
authDefault = pair;
|
||||
return pair;
|
||||
}
|
||||
|
@ -196,12 +192,10 @@ public void verify() {
|
|||
break;
|
||||
}
|
||||
}
|
||||
if(protectHandler == null)
|
||||
{
|
||||
if (protectHandler == null) {
|
||||
throw new NullPointerException("ProtectHandler must not be null");
|
||||
}
|
||||
if(!isOneDefault)
|
||||
{
|
||||
if (!isOneDefault) {
|
||||
throw new IllegalStateException("No auth pairs declared by default.");
|
||||
}
|
||||
if (permissionsHandler == null) {
|
||||
|
@ -210,13 +204,12 @@ public void verify() {
|
|||
if (env == null) {
|
||||
throw new NullPointerException("Env must not be null");
|
||||
}
|
||||
if(netty == null)
|
||||
{
|
||||
if (netty == null) {
|
||||
throw new NullPointerException("Netty must not be null");
|
||||
}
|
||||
}
|
||||
public void close()
|
||||
{
|
||||
|
||||
public void close() {
|
||||
try {
|
||||
for (AuthProviderPair p : auth) p.close();
|
||||
} catch (IOException e) {
|
||||
|
@ -248,8 +241,8 @@ public static class ExeConf {
|
|||
public String txtFileVersion;
|
||||
public String txtProductVersion;
|
||||
}
|
||||
public class NettyConfig
|
||||
{
|
||||
|
||||
public class NettyConfig {
|
||||
public String bindAddress;
|
||||
public int port;
|
||||
public boolean clientEnabled;
|
||||
|
@ -257,8 +250,8 @@ public class NettyConfig
|
|||
public String launcherEXEURL;
|
||||
public String address;
|
||||
}
|
||||
public class GuardLicenseConf
|
||||
{
|
||||
|
||||
public class GuardLicenseConf {
|
||||
public String name;
|
||||
public String key;
|
||||
public String encryptKey;
|
||||
|
@ -469,12 +462,10 @@ public LaunchServer(Path dir, String[] args) throws IOException, InvalidKeySpecE
|
|||
}
|
||||
config.permissionsHandler.init();
|
||||
config.hwidHandler.init();
|
||||
if(config.protectHandler != null)
|
||||
{
|
||||
if (config.protectHandler != null) {
|
||||
config.protectHandler.checkLaunchServerLicense();
|
||||
}
|
||||
if(config.components != null)
|
||||
{
|
||||
if (config.components != null) {
|
||||
LogHelper.debug("PreInit components");
|
||||
config.components.forEach((k, v) -> {
|
||||
LogHelper.subDebug("PreInit component %s", k);
|
||||
|
@ -507,8 +498,7 @@ public LaunchServer(Path dir, String[] args) throws IOException, InvalidKeySpecE
|
|||
|
||||
// init modules
|
||||
modulesManager.initModules();
|
||||
if(config.components != null)
|
||||
{
|
||||
if (config.components != null) {
|
||||
LogHelper.debug("Init components");
|
||||
config.components.forEach((k, v) -> {
|
||||
LogHelper.subDebug("Init component %s", k);
|
||||
|
@ -542,8 +532,7 @@ public LaunchServer(Path dir, String[] args) throws IOException, InvalidKeySpecE
|
|||
|
||||
// post init modules
|
||||
modulesManager.postInitModules();
|
||||
if(config.components != null)
|
||||
{
|
||||
if (config.components != null) {
|
||||
LogHelper.debug("PostInit components");
|
||||
config.components.forEach((k, v) -> {
|
||||
LogHelper.subDebug("PostInit component %s", k);
|
||||
|
@ -789,22 +778,17 @@ public void restart() {
|
|||
}
|
||||
}
|
||||
|
||||
public void registerObject(String name, Object object)
|
||||
{
|
||||
if(object instanceof Reloadable)
|
||||
{
|
||||
public void registerObject(String name, Object object) {
|
||||
if (object instanceof Reloadable) {
|
||||
reloadManager.registerReloadable(name, (Reloadable) object);
|
||||
}
|
||||
if(object instanceof Reconfigurable)
|
||||
{
|
||||
if (object instanceof Reconfigurable) {
|
||||
reconfigurableManager.registerReconfigurable(name, (Reconfigurable) object);
|
||||
}
|
||||
if(object instanceof NeedGarbageCollection)
|
||||
{
|
||||
if (object instanceof NeedGarbageCollection) {
|
||||
GarbageManager.registerNeedGC((NeedGarbageCollection) object);
|
||||
}
|
||||
if(object instanceof JsonConfigurable)
|
||||
{
|
||||
if (object instanceof JsonConfigurable) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,8 +20,7 @@ public AuthProviderPair(AuthProvider provider, AuthHandler handler, TextureProvi
|
|||
this.name = name;
|
||||
}
|
||||
|
||||
public void init()
|
||||
{
|
||||
public void init() {
|
||||
provider.init();
|
||||
handler.init();
|
||||
}
|
||||
|
|
|
@ -80,8 +80,7 @@ public synchronized Connection getConnection() throws SQLException {
|
|||
hikari = false;
|
||||
// Try using HikariCP
|
||||
source = mysqlSource;
|
||||
if(enableHikari)
|
||||
{
|
||||
if (enableHikari) {
|
||||
try {
|
||||
Class.forName("com.zaxxer.hikari.HikariDataSource");
|
||||
hikari = true; // Used for shutdown. Not instanceof because of possible classpath error
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package ru.gravit.launchserver.auth.hwid;
|
||||
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import ru.gravit.launcher.ClientPermissions;
|
||||
import ru.gravit.launcher.HWID;
|
||||
import ru.gravit.launcher.Launcher;
|
||||
import ru.gravit.launchserver.LaunchServer;
|
||||
|
@ -16,12 +15,10 @@
|
|||
import java.nio.file.Paths;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
public class JsonFileHWIDHandler extends HWIDHandler {
|
||||
public class Entry
|
||||
{
|
||||
public class Entry {
|
||||
public HWID hwid;
|
||||
public String username;
|
||||
public boolean isBanned = false;
|
||||
|
@ -43,22 +40,22 @@ public int hashCode() {
|
|||
return Objects.hash(hwid);
|
||||
}
|
||||
}
|
||||
|
||||
public String filename = "hwids.json";
|
||||
public transient LinkedList<Entry> list = new LinkedList<>();
|
||||
public String banMessage = "You banned";
|
||||
|
||||
@Override
|
||||
public void ban(List<HWID> hwid) throws HWIDException {
|
||||
for(Entry e : list)
|
||||
{
|
||||
for(HWID banHWID : hwid)
|
||||
{
|
||||
for (Entry e : list) {
|
||||
for (HWID banHWID : hwid) {
|
||||
if (e.hwid.equals(banHWID)) e.isBanned = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init()
|
||||
{
|
||||
public void init() {
|
||||
Path path = Paths.get(filename);
|
||||
Type type = new TypeToken<LinkedList<Entry>>() {
|
||||
}.getType();
|
||||
|
@ -72,16 +69,13 @@ public void init()
|
|||
@Override
|
||||
public void check0(HWID hwid, String username) throws HWIDException {
|
||||
boolean isOne = false;
|
||||
for(Entry e : list)
|
||||
{
|
||||
if(e.hwid.equals(hwid))
|
||||
{
|
||||
for (Entry e : list) {
|
||||
if (e.hwid.equals(hwid)) {
|
||||
isOne = true;
|
||||
if (e.isBanned) throw new HWIDException(banMessage);
|
||||
}
|
||||
}
|
||||
if(!isOne)
|
||||
{
|
||||
if (!isOne) {
|
||||
list.add(new Entry(hwid));
|
||||
}
|
||||
}
|
||||
|
@ -89,8 +83,7 @@ public void check0(HWID hwid, String username) throws HWIDException {
|
|||
@Override
|
||||
public void close() throws Exception {
|
||||
Path path = Paths.get(filename);
|
||||
try(Writer writer = IOHelper.newWriter(path))
|
||||
{
|
||||
try (Writer writer = IOHelper.newWriter(path)) {
|
||||
LaunchServer.gson.toJson(list, writer);
|
||||
}
|
||||
}
|
||||
|
@ -98,8 +91,7 @@ public void close() throws Exception {
|
|||
@Override
|
||||
public List<HWID> getHwid(String username) throws HWIDException {
|
||||
LinkedList<HWID> hwids = new LinkedList<>();
|
||||
for(Entry e : list)
|
||||
{
|
||||
for (Entry e : list) {
|
||||
if (e.username.equals(username)) hwids.add(e.hwid);
|
||||
}
|
||||
return hwids;
|
||||
|
@ -107,10 +99,8 @@ public List<HWID> getHwid(String username) throws HWIDException {
|
|||
|
||||
@Override
|
||||
public void unban(List<HWID> hwid) throws HWIDException {
|
||||
for(Entry e : list)
|
||||
{
|
||||
for(HWID banHWID : hwid)
|
||||
{
|
||||
for (Entry e : list) {
|
||||
for (HWID banHWID : hwid) {
|
||||
if (e.hwid.equals(banHWID)) e.isBanned = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,8 +7,7 @@
|
|||
import java.util.Objects;
|
||||
|
||||
public class MemoryHWIDHandler extends HWIDHandler {
|
||||
public class Entry
|
||||
{
|
||||
public class Entry {
|
||||
public HWID hwid;
|
||||
public String username;
|
||||
public boolean isBanned = false;
|
||||
|
@ -30,14 +29,14 @@ public int hashCode() {
|
|||
return Objects.hash(hwid);
|
||||
}
|
||||
}
|
||||
|
||||
public transient LinkedList<Entry> list = new LinkedList<>();
|
||||
public String banMessage = "You banned";
|
||||
|
||||
@Override
|
||||
public void ban(List<HWID> hwid) throws HWIDException {
|
||||
for(Entry e : list)
|
||||
{
|
||||
for(HWID banHWID : hwid)
|
||||
{
|
||||
for (Entry e : list) {
|
||||
for (HWID banHWID : hwid) {
|
||||
if (e.hwid.equals(banHWID)) e.isBanned = true;
|
||||
}
|
||||
}
|
||||
|
@ -46,16 +45,13 @@ public void ban(List<HWID> hwid) throws HWIDException {
|
|||
@Override
|
||||
public void check0(HWID hwid, String username) throws HWIDException {
|
||||
boolean isOne = false;
|
||||
for(Entry e : list)
|
||||
{
|
||||
if(e.hwid.equals(hwid))
|
||||
{
|
||||
for (Entry e : list) {
|
||||
if (e.hwid.equals(hwid)) {
|
||||
isOne = true;
|
||||
if (e.isBanned) throw new HWIDException(banMessage);
|
||||
}
|
||||
}
|
||||
if(!isOne)
|
||||
{
|
||||
if (!isOne) {
|
||||
list.add(new Entry(hwid));
|
||||
}
|
||||
}
|
||||
|
@ -73,8 +69,7 @@ public void init() {
|
|||
@Override
|
||||
public List<HWID> getHwid(String username) throws HWIDException {
|
||||
LinkedList<HWID> hwids = new LinkedList<>();
|
||||
for(Entry e : list)
|
||||
{
|
||||
for (Entry e : list) {
|
||||
if (e.username.equals(username)) hwids.add(e.hwid);
|
||||
}
|
||||
return hwids;
|
||||
|
@ -82,10 +77,8 @@ public List<HWID> getHwid(String username) throws HWIDException {
|
|||
|
||||
@Override
|
||||
public void unban(List<HWID> hwid) throws HWIDException {
|
||||
for(Entry e : list)
|
||||
{
|
||||
for(HWID banHWID : hwid)
|
||||
{
|
||||
for (Entry e : list) {
|
||||
for (HWID banHWID : hwid) {
|
||||
if (e.hwid.equals(banHWID)) e.isBanned = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -143,8 +143,7 @@ public void onCheckInfo(OshiHWID hwid, String username, Connection c) throws HWI
|
|||
boolean isOne = false;
|
||||
while (set.next()) {
|
||||
if (!oneCompareMode) isOne = true;
|
||||
if(compareMode)
|
||||
{
|
||||
if (compareMode) {
|
||||
OshiHWID db_hwid = new OshiHWID();
|
||||
db_hwid.serialNumber = set.getString(hwidFieldSerialNumber);
|
||||
db_hwid.processorID = set.getString(hwidFieldProcessorID);
|
||||
|
@ -154,8 +153,7 @@ public void onCheckInfo(OshiHWID hwid, String username, Connection c) throws HWI
|
|||
LogHelper.dev("Compare HWID: %s vs %s", hwid.getSerializeString(), db_hwid.getSerializeString());
|
||||
int compare_point = hwid.compare(db_hwid);
|
||||
if (compare_point < compare) continue;
|
||||
else
|
||||
{
|
||||
else {
|
||||
LogHelper.debug("User %s hwid check: found compare %d in %d", username, compare_point, set.getInt("id"));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,8 +37,7 @@ public static void registerProviders() {
|
|||
|
||||
public abstract AuthProviderResult auth(String login, String password, String ip) throws Exception;
|
||||
|
||||
public void preAuth(String login, String password, String customText, String ip) throws Exception
|
||||
{
|
||||
public void preAuth(String login, String password, String customText, String ip) throws Exception {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,8 +29,7 @@ public void init() {
|
|||
|
||||
@Override
|
||||
public AuthProviderResult auth(String login, String password, String ip) throws SQLException, AuthException {
|
||||
try(Connection c = mySQLHolder.getConnection())
|
||||
{
|
||||
try (Connection c = mySQLHolder.getConnection()) {
|
||||
PreparedStatement s = c.prepareStatement(query);
|
||||
String[] replaceParams = {"login", login, "password", password, "ip", ip};
|
||||
for (int i = 0; i < queryParams.length; i++)
|
||||
|
|
|
@ -70,6 +70,7 @@ public void setAddress(String address) {
|
|||
body.append(address);
|
||||
body.append("\";");
|
||||
}
|
||||
|
||||
public void setNettyAddress(String address) {
|
||||
body.append("this.nettyAddress = \"");
|
||||
body.append(address);
|
||||
|
@ -139,6 +140,7 @@ public void setDownloadJava(boolean b) {
|
|||
body.append(b ? "true" : "false");
|
||||
body.append(";");
|
||||
}
|
||||
|
||||
public void setNettyEnabled(boolean b) {
|
||||
body.append("this.isNettyEnabled = ");
|
||||
body.append(b ? "true" : "false");
|
||||
|
@ -151,8 +153,7 @@ public void setWarningMissArchJava(boolean b) {
|
|||
body.append(";");
|
||||
}
|
||||
|
||||
public void setGuardLicense(String name, String key, String encryptKey)
|
||||
{
|
||||
public void setGuardLicense(String name, String key, String encryptKey) {
|
||||
body.append("this.guardLicenseName = \"");
|
||||
body.append(name);
|
||||
body.append("\";");
|
||||
|
|
|
@ -6,7 +6,9 @@
|
|||
import ru.gravit.utils.helper.SecurityHelper;
|
||||
import ru.gravit.utils.helper.UnpackHelper;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.PrintWriter;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.security.SecureRandom;
|
||||
|
@ -18,8 +20,7 @@ public class ProguardConf {
|
|||
|
||||
private static String generateString(SecureRandom rand, String lowString, String upString, int il) {
|
||||
StringBuilder sb = new StringBuilder(il + lowString.length());
|
||||
for(int i = 0;i<lowString.length();++i)
|
||||
{
|
||||
for (int i = 0; i < lowString.length(); ++i) {
|
||||
sb.append(rand.nextBoolean() ? lowString.charAt(i) : upString.charAt(i));
|
||||
}
|
||||
for (int i = 0; i < il - 1; i++) sb.append(chars.charAt(rand.nextInt(chars.length())));
|
||||
|
|
|
@ -131,8 +131,7 @@ public Path process(Path inputJar) throws IOException {
|
|||
jaConfigurator.setAddress(server.config.getAddress());
|
||||
jaConfigurator.setPort(server.config.port);
|
||||
jaConfigurator.setNettyEnabled(server.config.netty.clientEnabled);
|
||||
if(server.config.netty.clientEnabled)
|
||||
{
|
||||
if (server.config.netty.clientEnabled) {
|
||||
jaConfigurator.setNettyPort(server.config.netty.port);
|
||||
jaConfigurator.setNettyAddress(server.config.netty.address);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package ru.gravit.launchserver.binary.tasks;
|
||||
|
||||
import me.itzsomebody.radon.Radon;
|
||||
import me.itzsomebody.radon.SessionInfo;
|
||||
import me.itzsomebody.radon.config.ConfigurationParser;
|
||||
import ru.gravit.launchserver.LaunchServer;
|
||||
import ru.gravit.utils.helper.IOHelper;
|
||||
import ru.gravit.utils.helper.UnpackHelper;
|
||||
|
@ -10,10 +13,6 @@
|
|||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import me.itzsomebody.radon.Radon;
|
||||
import me.itzsomebody.radon.SessionInfo;
|
||||
import me.itzsomebody.radon.config.ConfigurationParser;
|
||||
|
||||
public class RadonBuildTask implements LauncherBuildTask {
|
||||
private final LaunchServer srv;
|
||||
public final Path config;
|
||||
|
@ -33,7 +32,8 @@ public String getName() {
|
|||
public Path process(Path inputFile) throws IOException {
|
||||
Path outputFile = srv.launcherBinary.nextLowerPath(this);
|
||||
if (srv.config.enabledRadon) {
|
||||
if (!IOHelper.isFile(config)) UnpackHelper.unpack(IOHelper.getResourceURL("ru/gravit/launchserver/defaults/radon.cfg"), config);
|
||||
if (!IOHelper.isFile(config))
|
||||
UnpackHelper.unpack(IOHelper.getResourceURL("ru/gravit/launchserver/defaults/radon.cfg"), config);
|
||||
ConfigurationParser p = new ConfigurationParser(IOHelper.newInput(config));
|
||||
SessionInfo info = p.createSessionFromConfig();
|
||||
info.setInput(inputFile.toFile());
|
||||
|
|
|
@ -13,8 +13,7 @@
|
|||
import ru.gravit.launchserver.command.service.*;
|
||||
|
||||
public abstract class CommandHandler extends ru.gravit.utils.command.CommandHandler {
|
||||
public static void registerCommands(ru.gravit.utils.command.CommandHandler handler)
|
||||
{
|
||||
public static void registerCommands(ru.gravit.utils.command.CommandHandler handler) {
|
||||
LaunchServer server = LaunchServer.server;
|
||||
// Register basic commands
|
||||
handler.registerCommand("help", new HelpCommand(server));
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
import ru.gravit.launcher.profiles.ClientProfile.Version;
|
||||
import ru.gravit.launchserver.LaunchServer;
|
||||
import ru.gravit.launchserver.command.Command;
|
||||
import ru.gravit.utils.command.CommandException;
|
||||
import ru.gravit.utils.HttpDownloader;
|
||||
import ru.gravit.utils.command.CommandException;
|
||||
import ru.gravit.utils.helper.IOHelper;
|
||||
import ru.gravit.utils.helper.LogHelper;
|
||||
|
||||
|
|
|
@ -20,8 +20,7 @@ public String getUsageDescription() {
|
|||
|
||||
@Override
|
||||
public void invoke(String... args) throws Exception {
|
||||
for(String arg : args)
|
||||
{
|
||||
for (String arg : args) {
|
||||
server.commandHandler.eval(arg, false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,8 +25,7 @@ public String getUsageDescription() {
|
|||
return "component manager";
|
||||
}
|
||||
|
||||
public void printHelp()
|
||||
{
|
||||
public void printHelp() {
|
||||
LogHelper.info("Print help for component:");
|
||||
LogHelper.subInfo("component unload [componentName]");
|
||||
LogHelper.subInfo("component load [componentName] [filename]");
|
||||
|
@ -38,53 +37,42 @@ public void invoke(String... args) throws Exception {
|
|||
verifyArgs(args, 1);
|
||||
String componentName = null;
|
||||
if (args.length > 1) componentName = args[1];
|
||||
switch(args[0])
|
||||
{
|
||||
case "unload":
|
||||
{
|
||||
switch (args[0]) {
|
||||
case "unload": {
|
||||
if (componentName == null) throw new IllegalArgumentException("Must set componentName");
|
||||
Component component = server.config.components.get(componentName);
|
||||
if (component == null) {
|
||||
LogHelper.error("Component %s not found", componentName);
|
||||
return;
|
||||
}
|
||||
if(component instanceof AutoCloseable)
|
||||
{
|
||||
if (component instanceof AutoCloseable) {
|
||||
((AutoCloseable) component).close();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
LogHelper.error("Component %s unload not supported", componentName);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "gc":
|
||||
{
|
||||
case "gc": {
|
||||
if (componentName == null) throw new IllegalArgumentException("Must set componentName");
|
||||
Component component = server.config.components.get(componentName);
|
||||
if (component == null) {
|
||||
LogHelper.error("Component %s not found", componentName);
|
||||
return;
|
||||
}
|
||||
if(component instanceof NeedGarbageCollection)
|
||||
{
|
||||
if (component instanceof NeedGarbageCollection) {
|
||||
((NeedGarbageCollection) component).garbageCollection();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
LogHelper.error("Component %s gc not supported", componentName);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "load":
|
||||
{
|
||||
case "load": {
|
||||
if (componentName == null) throw new IllegalArgumentException("Must set componentName");
|
||||
if (args.length <= 2) throw new IllegalArgumentException("Must set file");
|
||||
String fileName = args[2];
|
||||
try(Reader reader = IOHelper.newReader(Paths.get(fileName)))
|
||||
{
|
||||
try (Reader reader = IOHelper.newReader(Paths.get(fileName))) {
|
||||
Component component = LaunchServer.gson.fromJson(reader, Component.class);
|
||||
component.preInit(server);
|
||||
component.init(server);
|
||||
|
@ -92,12 +80,10 @@ public void invoke(String... args) throws Exception {
|
|||
LogHelper.info("Component %s(%s) loaded", componentName, component.getClass().getName());
|
||||
}
|
||||
}
|
||||
case "help":
|
||||
{
|
||||
case "help": {
|
||||
printHelp();
|
||||
}
|
||||
default:
|
||||
{
|
||||
default: {
|
||||
printHelp();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,25 +27,20 @@ public void invoke(String... args) throws Exception {
|
|||
ClientPermissions permissions = server.config.permissionsHandler.getPermissions(username);
|
||||
String permission = args[1];
|
||||
boolean isEnabled = Boolean.valueOf(args[2]);
|
||||
switch (permission)
|
||||
{
|
||||
case "admin":
|
||||
{
|
||||
switch (permission) {
|
||||
case "admin": {
|
||||
permissions.canAdmin = isEnabled;
|
||||
break;
|
||||
}
|
||||
case "server":
|
||||
{
|
||||
case "server": {
|
||||
permissions.canServer = isEnabled;
|
||||
break;
|
||||
}
|
||||
case "bot":
|
||||
{
|
||||
case "bot": {
|
||||
permissions.canBot = isEnabled;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
default: {
|
||||
LogHelper.error("Unknown permission: %s", permission);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -34,8 +34,7 @@ public void invoke(String... args) {
|
|||
LogHelper.info("Uptime: %d days %d hours %d minutes %d seconds", days, hour, min, second);
|
||||
LogHelper.info("Uptime (double): %f", (double) JVMHelper.RUNTIME_MXBEAN.getUptime() / 1000);
|
||||
LogHelper.info("Sessions: %d | Modules: %d | Commands: %d", server.sessionManager.getSessions().size(), server.modulesManager.modules.size(), server.commandHandler.commandsMap().size());
|
||||
for(AuthProviderPair pair : server.config.auth)
|
||||
{
|
||||
for (AuthProviderPair pair : server.config.auth) {
|
||||
if (pair.handler instanceof CachedAuthHandler) {
|
||||
LogHelper.info("AuthHandler %s: EntryCache: %d | usernameCache: %d", pair.name, ((CachedAuthHandler) pair.handler).getEntryCache().size(), ((CachedAuthHandler) pair.handler).getUsernamesCache().size());
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
import ru.gravit.launchserver.LaunchServer;
|
||||
import ru.gravit.launchserver.auth.AuthException;
|
||||
import ru.gravit.launchserver.auth.provider.AuthProvider;
|
||||
import ru.gravit.launchserver.components.Component;
|
||||
import ru.gravit.launchserver.response.auth.AuthResponse;
|
||||
import ru.gravit.launchserver.socket.Client;
|
||||
|
||||
|
@ -26,9 +25,9 @@ public void init(LaunchServer launchServer) {
|
|||
public void postInit(LaunchServer launchServer) {
|
||||
|
||||
}
|
||||
|
||||
public void preAuthHook(AuthResponse.AuthContext context, Client client) throws AuthException {
|
||||
if(isLimit(context.ip))
|
||||
{
|
||||
if (isLimit(context.ip)) {
|
||||
AuthProvider.authError(message);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
public class CommandRemoverComponent extends Component implements AutoCloseable {
|
||||
public String[] removeList = new String[]{};
|
||||
public transient Map<String, Command> commandsList = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void preInit(LaunchServer launchServer) {
|
||||
|
||||
|
@ -21,8 +22,7 @@ public void init(LaunchServer launchServer) {
|
|||
|
||||
@Override
|
||||
public void postInit(LaunchServer launchServer) {
|
||||
for(String cmd : removeList)
|
||||
{
|
||||
for (String cmd : removeList) {
|
||||
Command removedCmd = launchServer.commandHandler.unregisterCommand(cmd);
|
||||
if (removedCmd != null)
|
||||
commandsList.put(cmd, removedCmd);
|
||||
|
@ -31,8 +31,7 @@ public void postInit(LaunchServer launchServer) {
|
|||
|
||||
@Override
|
||||
public void close() throws Exception {
|
||||
for(Map.Entry<String, Command> e : commandsList.entrySet())
|
||||
{
|
||||
for (Map.Entry<String, Command> e : commandsList.entrySet()) {
|
||||
LaunchServer.server.commandHandler.registerCommand(e.getKey(), e.getValue());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,10 @@ public static void registerComponents() {
|
|||
registredComp = true;
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void preInit(LaunchServer launchServer);
|
||||
|
||||
public abstract void init(LaunchServer launchServer);
|
||||
|
||||
public abstract void postInit(LaunchServer launchServer);
|
||||
}
|
||||
|
|
|
@ -13,8 +13,7 @@ public class AuthHandlerAdapter implements JsonSerializer<AuthHandler>, JsonDese
|
|||
public AuthHandler deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
||||
String typename = json.getAsJsonObject().getAsJsonPrimitive(PROP_NAME).getAsString();
|
||||
Class<? extends AuthHandler> cls = AuthHandler.getHandlerClass(typename);
|
||||
if(cls == null)
|
||||
{
|
||||
if (cls == null) {
|
||||
LogHelper.error("AuthHandler %s not found", typename);
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -13,8 +13,7 @@ public class AuthProviderAdapter implements JsonSerializer<AuthProvider>, JsonDe
|
|||
public AuthProvider deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
||||
String typename = json.getAsJsonObject().getAsJsonPrimitive(PROP_NAME).getAsString();
|
||||
Class<? extends AuthProvider> cls = AuthProvider.getProviderClass(typename);
|
||||
if(cls == null)
|
||||
{
|
||||
if (cls == null) {
|
||||
LogHelper.error("AuthProvider %s not found", typename);
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -13,8 +13,7 @@ public class ComponentAdapter implements JsonSerializer<Component>, JsonDeserial
|
|||
public Component deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
||||
String typename = json.getAsJsonObject().getAsJsonPrimitive(PROP_NAME).getAsString();
|
||||
Class<? extends Component> cls = Component.getComponentClass(typename);
|
||||
if(cls == null)
|
||||
{
|
||||
if (cls == null) {
|
||||
LogHelper.error("Component %s not found", typename);
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -13,8 +13,7 @@ public class HWIDHandlerAdapter implements JsonSerializer<HWIDHandler>, JsonDese
|
|||
public HWIDHandler deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
||||
String typename = json.getAsJsonObject().getAsJsonPrimitive(PROP_NAME).getAsString();
|
||||
Class<? extends HWIDHandler> cls = HWIDHandler.getHandlerClass(typename);
|
||||
if(cls == null)
|
||||
{
|
||||
if (cls == null) {
|
||||
LogHelper.error("HWIDHandler %s not found", typename);
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -13,8 +13,7 @@ public class PermissionsHandlerAdapter implements JsonSerializer<PermissionsHand
|
|||
public PermissionsHandler deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
||||
String typename = json.getAsJsonObject().getAsJsonPrimitive(PROP_NAME).getAsString();
|
||||
Class<? extends PermissionsHandler> cls = PermissionsHandler.getHandlerClass(typename);
|
||||
if(cls == null)
|
||||
{
|
||||
if (cls == null) {
|
||||
LogHelper.error("PermissionsHandler %s not found", typename);
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -13,8 +13,7 @@ public class ProtectHandlerAdapter implements JsonSerializer<ProtectHandler>, Js
|
|||
public ProtectHandler deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
||||
String typename = json.getAsJsonObject().getAsJsonPrimitive(PROP_NAME).getAsString();
|
||||
Class<? extends ProtectHandler> cls = ProtectHandler.getHandlerClass(typename);
|
||||
if(cls == null)
|
||||
{
|
||||
if (cls == null) {
|
||||
LogHelper.error("ProtectHandler %s not found", typename);
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -13,8 +13,7 @@ public class TextureProviderAdapter implements JsonSerializer<TextureProvider>,
|
|||
public TextureProvider deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
|
||||
String typename = json.getAsJsonObject().getAsJsonPrimitive(PROP_NAME).getAsString();
|
||||
Class<? extends TextureProvider> cls = TextureProvider.getProviderClass(typename);
|
||||
if(cls == null)
|
||||
{
|
||||
if (cls == null) {
|
||||
LogHelper.error("TextureProvider %s not found", typename);
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package ru.gravit.launchserver.manangers;
|
||||
|
||||
import ru.gravit.launcher.managers.SimpleModulesConfigManager;
|
||||
import ru.gravit.launcher.managers.SimpleModuleManager;
|
||||
import ru.gravit.launcher.managers.SimpleModulesConfigManager;
|
||||
import ru.gravit.launchserver.LaunchServer;
|
||||
import ru.gravit.launchserver.modules.CoreModule;
|
||||
import ru.gravit.launchserver.modules.LaunchServerModuleContext;
|
||||
|
|
|
@ -34,8 +34,8 @@ public Client(long session) {
|
|||
public void up() {
|
||||
timestamp = System.currentTimeMillis();
|
||||
}
|
||||
public void updateAuth()
|
||||
{
|
||||
|
||||
public void updateAuth() {
|
||||
if (!isAuth) return;
|
||||
if (auth_id.isEmpty()) auth = LaunchServer.server.config.getAuthProviderPair();
|
||||
else auth = LaunchServer.server.config.getAuthProviderPair(auth_id);
|
||||
|
|
|
@ -86,6 +86,7 @@ public void registerResponses() {
|
|||
public void sendObject(ChannelHandlerContext ctx, Object obj) {
|
||||
ctx.channel().writeAndFlush(new TextWebSocketFrame(gson.toJson(obj, ResultInterface.class)));
|
||||
}
|
||||
|
||||
public void sendObject(ChannelHandlerContext ctx, Object obj, Type type) {
|
||||
ctx.channel().writeAndFlush(new TextWebSocketFrame(gson.toJson(obj, type)));
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
public class AddLogListenerResponse implements JsonResponseInterface {
|
||||
public LogHelper.OutputTypes outputType = LogHelper.OutputTypes.PLAIN;
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return "addLogListener";
|
||||
|
@ -25,20 +26,15 @@ public void execute(WebSocketService service, ChannelHandlerContext ctx, Client
|
|||
service.sendObject(ctx, new ErrorRequestEvent("Access denied"));
|
||||
return;
|
||||
}
|
||||
if(client.logOutput != null)
|
||||
{
|
||||
if (client.logOutput != null) {
|
||||
LogHelper.info("Client %s remove log listener", client.username);
|
||||
LogHelper.removeOutput(client.logOutput);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
LogHelper.info("Client %s add log listener", client.username);
|
||||
LogHelper.Output output = (str) -> {
|
||||
if(!ctx.isRemoved())
|
||||
{
|
||||
if (!ctx.isRemoved()) {
|
||||
service.sendObject(ctx, new LogEvent(str));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
LogHelper.removeOutput(client.logOutput);
|
||||
LogHelper.info("Client %s remove log listener", client.username);
|
||||
}
|
||||
|
|
|
@ -42,8 +42,8 @@ public AuthResponse(String login, String password, String auth_id, OshiHWID hwid
|
|||
public String auth_id;
|
||||
public ConnectTypes authType;
|
||||
public OshiHWID hwid;
|
||||
public enum ConnectTypes
|
||||
{
|
||||
|
||||
public enum ConnectTypes {
|
||||
SERVER, CLIENT, BOT
|
||||
}
|
||||
|
||||
|
@ -61,8 +61,7 @@ public void execute(WebSocketService service, ChannelHandlerContext ctx, Client
|
|||
AuthProvider.authError("Don't skip Launcher Update");
|
||||
return;
|
||||
}
|
||||
if(password == null)
|
||||
{
|
||||
if (password == null) {
|
||||
try {
|
||||
password = IOHelper.decode(SecurityHelper.newRSADecryptCipher(LaunchServer.server.privateKey).
|
||||
doFinal(encryptedPassword));
|
||||
|
@ -71,12 +70,10 @@ public void execute(WebSocketService service, ChannelHandlerContext ctx, Client
|
|||
}
|
||||
}
|
||||
clientData.permissions = LaunchServer.server.config.permissionsHandler.getPermissions(login);
|
||||
if(authType == ConnectTypes.BOT && !clientData.permissions.canBot)
|
||||
{
|
||||
if (authType == ConnectTypes.BOT && !clientData.permissions.canBot) {
|
||||
AuthProvider.authError("authType: BOT not allowed for this account");
|
||||
}
|
||||
if(authType == ConnectTypes.SERVER && !clientData.permissions.canServer)
|
||||
{
|
||||
if (authType == ConnectTypes.SERVER && !clientData.permissions.canServer) {
|
||||
AuthProvider.authError("authType: SERVER not allowed for this account");
|
||||
}
|
||||
AuthProviderPair pair;
|
||||
|
|
|
@ -19,8 +19,7 @@ public String getType() {
|
|||
|
||||
@Override
|
||||
public void execute(WebSocketService service, ChannelHandlerContext ctx, Client client) throws Exception {
|
||||
if(!client.checkSign)
|
||||
{
|
||||
if (!client.checkSign) {
|
||||
service.sendObject(ctx, new ErrorRequestEvent("Access denied"));
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
public class SetProfileResponse implements JsonResponseInterface {
|
||||
public String client;
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return "setProfile";
|
||||
|
@ -20,8 +21,7 @@ public String getType() {
|
|||
|
||||
@Override
|
||||
public void execute(WebSocketService service, ChannelHandlerContext ctx, Client client) throws Exception {
|
||||
if(!client.isAuth)
|
||||
{
|
||||
if (!client.isAuth) {
|
||||
service.sendObject(ctx, new ErrorRequestEvent("Access denied"));
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -11,12 +11,13 @@
|
|||
import java.util.UUID;
|
||||
|
||||
public class BatchProfileByUsername implements JsonResponseInterface {
|
||||
class Entry
|
||||
{
|
||||
class Entry {
|
||||
String username;
|
||||
String client;
|
||||
}
|
||||
|
||||
Entry[] list;
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return "batchProfileByUsername";
|
||||
|
@ -26,8 +27,7 @@ public String getType() {
|
|||
public void execute(WebSocketService service, ChannelHandlerContext ctx, Client client) throws Exception {
|
||||
BatchProfileByUsernameRequestEvent result = new BatchProfileByUsernameRequestEvent();
|
||||
result.playerProfiles = new PlayerProfile[list.length];
|
||||
for(int i=0;i<list.length;++i)
|
||||
{
|
||||
for (int i = 0; i < list.length; ++i) {
|
||||
UUID uuid = client.auth.handler.usernameToUUID(list[i].username);
|
||||
result.playerProfiles[i] = ProfileByUUIDResponse.getProfile(LaunchServer.server, uuid, list[i].username, list[i].client, client.auth.textureProvider);
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
public class ProfileByUUIDResponse implements JsonResponseInterface {
|
||||
public UUID uuid;
|
||||
public String client;
|
||||
|
||||
public static PlayerProfile getProfile(LaunchServer server, UUID uuid, String username, String client, TextureProvider textureProvider) {
|
||||
// Get skin texture
|
||||
Texture skin;
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
public class ProfileByUsername implements JsonResponseInterface {
|
||||
String username;
|
||||
String client;
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return "profileByUsername";
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
public class UpdateResponse implements JsonResponseInterface {
|
||||
public String dir;
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return "update";
|
||||
|
|
|
@ -8,13 +8,12 @@
|
|||
|
||||
public class ConsoleMain {
|
||||
public static CommandHandler commandHandler;
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
if(ServerWrapper.config == null)
|
||||
{
|
||||
if (ServerWrapper.config == null) {
|
||||
LogHelper.warning("ServerWrapper not found");
|
||||
}
|
||||
if(!ServerWrapper.permissions.canAdmin)
|
||||
{
|
||||
if (!ServerWrapper.permissions.canAdmin) {
|
||||
LogHelper.warning("Permission canAdmin not found");
|
||||
}
|
||||
try {
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
public class RemoteJLineCommandHandler extends JLineCommandHandler {
|
||||
public RemoteJLineCommandHandler() throws IOException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void eval(String line, boolean bell)
|
||||
{
|
||||
public void eval(String line, boolean bell) {
|
||||
if (line.equals("exit")) System.exit(0);
|
||||
ExecCommandRequest request = new ExecCommandRequest(System.out::println, line);
|
||||
try {
|
||||
|
|
|
@ -8,9 +8,9 @@ public class RemoteStdCommandHandler extends StdCommandHandler {
|
|||
public RemoteStdCommandHandler(boolean readCommands) {
|
||||
super(readCommands);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void eval(String line, boolean bell)
|
||||
{
|
||||
public void eval(String line, boolean bell) {
|
||||
if (line.equals("exit")) System.exit(0);
|
||||
ExecCommandRequest request = new ExecCommandRequest(System.out::println, line);
|
||||
try {
|
||||
|
|
|
@ -12,7 +12,9 @@
|
|||
|
||||
<!-- DrLeonardo Design -->
|
||||
|
||||
<Pane fx:id="layout" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" visible="true" xmlns="http://javafx.com/javafx/8.0.20" xmlns:fx="http://javafx.com/fxml/1">
|
||||
<Pane fx:id="layout" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity"
|
||||
prefHeight="400.0" prefWidth="600.0" visible="true" xmlns="http://javafx.com/javafx/8.0.20"
|
||||
xmlns:fx="http://javafx.com/fxml/1">
|
||||
<children>
|
||||
<ImageView id="background" fitHeight="400.0" fitWidth="600.0">
|
||||
<image>
|
||||
|
@ -30,17 +32,25 @@
|
|||
</Pane>
|
||||
<Pane id="authPane" layoutX="1.0" layoutY="2.0" prefHeight="400.0" prefWidth="600.0">
|
||||
<children>
|
||||
<TextField id="login" alignment="CENTER" layoutX="175.0" layoutY="144.0" prefHeight="45.0" prefWidth="233.0" promptText="Логин" />
|
||||
<PasswordField id="password" alignment="CENTER" layoutX="175.0" layoutY="197.0" prefHeight="45.0" prefWidth="233.0" promptText="Пароль" />
|
||||
<Button id="goAuth" layoutX="159.0" layoutY="319.0" mnemonicParsing="false" opacity="1.0" prefHeight="45.0" prefWidth="267.0" styleClass="btn" text="ВОЙТИ" visible="true" />
|
||||
<CheckBox id="rememberchb" fx:id="savePassword" contentDisplay="CENTER" layoutX="224.0" layoutY="291.0" prefHeight="17.0" prefWidth="137.0" text="Сохранить пароль" textFill="#dadada" />
|
||||
<Hyperlink id="link" fx:id="link" layoutY="371.0" prefHeight="30.0" prefWidth="158.0" textAlignment="CENTER" />
|
||||
<Button id="discord_url" layoutX="278.0" layoutY="373.0" minHeight="16.0" minWidth="28.0" mnemonicParsing="false" prefHeight="16.0" prefWidth="28.0" text="" />
|
||||
<TextField id="login" alignment="CENTER" layoutX="175.0" layoutY="144.0" prefHeight="45.0"
|
||||
prefWidth="233.0" promptText="Логин"/>
|
||||
<PasswordField id="password" alignment="CENTER" layoutX="175.0" layoutY="197.0" prefHeight="45.0"
|
||||
prefWidth="233.0" promptText="Пароль"/>
|
||||
<Button id="goAuth" layoutX="159.0" layoutY="319.0" mnemonicParsing="false" opacity="1.0"
|
||||
prefHeight="45.0" prefWidth="267.0" styleClass="btn" text="ВОЙТИ" visible="true"/>
|
||||
<CheckBox id="rememberchb" fx:id="savePassword" contentDisplay="CENTER" layoutX="224.0" layoutY="291.0"
|
||||
prefHeight="17.0" prefWidth="137.0" text="Сохранить пароль" textFill="#dadada"/>
|
||||
<Hyperlink id="link" fx:id="link" layoutY="371.0" prefHeight="30.0" prefWidth="158.0"
|
||||
textAlignment="CENTER"/>
|
||||
<Button id="discord_url" layoutX="278.0" layoutY="373.0" minHeight="16.0" minWidth="28.0"
|
||||
mnemonicParsing="false" prefHeight="16.0" prefWidth="28.0" text=""/>
|
||||
</children>
|
||||
</Pane>
|
||||
<Pane id="mask" opacity="0.0" prefHeight="400.0" prefWidth="600.0" visible="false"/>
|
||||
<Button id="hidebtn" focusTraversable="false" layoutX="535.0" layoutY="2.0" minHeight="25.0" minWidth="35.0" prefHeight="25.0" prefWidth="25.0" />
|
||||
<Button id="exitbtn" focusTraversable="false" layoutX="574.0" layoutY="2.0" minHeight="25.0" minWidth="20.0" prefHeight="25.0" prefWidth="20.0" />
|
||||
<Button id="hidebtn" focusTraversable="false" layoutX="535.0" layoutY="2.0" minHeight="25.0" minWidth="35.0"
|
||||
prefHeight="25.0" prefWidth="25.0"/>
|
||||
<Button id="exitbtn" focusTraversable="false" layoutX="574.0" layoutY="2.0" minHeight="25.0" minWidth="20.0"
|
||||
prefHeight="25.0" prefWidth="20.0"/>
|
||||
<ImageView fitHeight="12.0" fitWidth="11.0" layoutX="9.0" layoutY="8.0">
|
||||
<image>
|
||||
<Image url="@images/icons/logo_small.png"/>
|
||||
|
|
|
@ -13,7 +13,8 @@
|
|||
|
||||
<!-- DrLeonardo Design -->
|
||||
|
||||
<Pane fx:id="layout" maxHeight="-1.0" maxWidth="-1.0" prefHeight="400.0" prefWidth="600.0" visible="true" xmlns="http://javafx.com/javafx/8.0.20" xmlns:fx="http://javafx.com/fxml/1">
|
||||
<Pane fx:id="layout" maxHeight="-1.0" maxWidth="-1.0" prefHeight="400.0" prefWidth="600.0" visible="true"
|
||||
xmlns="http://javafx.com/javafx/8.0.20" xmlns:fx="http://javafx.com/fxml/1">
|
||||
<children>
|
||||
<ImageView id="background" fitHeight="400.0" fitWidth="600.0">
|
||||
<image>
|
||||
|
@ -28,25 +29,37 @@
|
|||
<Pane layoutX="171.0" layoutY="28.0" prefHeight="372.0" prefWidth="429.0" styleClass="menuPane"/>
|
||||
<Pane id="serverPane" prefHeight="400.0" prefWidth="600.0">
|
||||
<children>
|
||||
<Button id="hidebtn" focusTraversable="false" layoutX="545.0" layoutY="2.0" minHeight="25.0" minWidth="20.0" prefHeight="25.0" prefWidth="25.0" textAlignment="CENTER" />
|
||||
<Button id="exitbtn" alignment="CENTER" contentDisplay="CENTER" focusTraversable="false" layoutX="572.0" layoutY="2.0" minHeight="25.0" minWidth="20.0" prefHeight="25.0" prefWidth="25.0" rotate="360.0" textAlignment="CENTER" translateX="0.0" />
|
||||
<ScrollPane id="serverlist" hbarPolicy="NEVER" layoutX="0.0" layoutY="27.0" prefHeight="306.0" prefWidth="171.0" visible="true">
|
||||
<Button id="hidebtn" focusTraversable="false" layoutX="545.0" layoutY="2.0" minHeight="25.0"
|
||||
minWidth="20.0" prefHeight="25.0" prefWidth="25.0" textAlignment="CENTER"/>
|
||||
<Button id="exitbtn" alignment="CENTER" contentDisplay="CENTER" focusTraversable="false" layoutX="572.0"
|
||||
layoutY="2.0" minHeight="25.0" minWidth="20.0" prefHeight="25.0" prefWidth="25.0" rotate="360.0"
|
||||
textAlignment="CENTER" translateX="0.0"/>
|
||||
<ScrollPane id="serverlist" hbarPolicy="NEVER" layoutX="0.0" layoutY="27.0" prefHeight="306.0"
|
||||
prefWidth="171.0" visible="true">
|
||||
<content>
|
||||
<FlowPane id="servercontainer" alignment="TOP_LEFT" columnHalignment="LEFT" focusTraversable="false" hgap="0.0" maxHeight="0.0" maxWidth="0.0" orientation="HORIZONTAL" prefHeight="-1.0" prefWidth="161.0" prefWrapLength="0.0" rowValignment="TOP" vgap="7.0" visible="true">
|
||||
<FlowPane id="servercontainer" alignment="TOP_LEFT" columnHalignment="LEFT"
|
||||
focusTraversable="false" hgap="0.0" maxHeight="0.0" maxWidth="0.0"
|
||||
orientation="HORIZONTAL" prefHeight="-1.0" prefWidth="161.0" prefWrapLength="0.0"
|
||||
rowValignment="TOP" vgap="7.0" visible="true">
|
||||
<padding>
|
||||
<Insets top="10.0"/>
|
||||
</padding>
|
||||
</FlowPane>
|
||||
</content>
|
||||
</ScrollPane>
|
||||
<ScrollPane id="serverinfo" hbarPolicy="NEVER" layoutX="170.0" layoutY="71.0" pannable="true" prefHeight="234.0" prefWidth="432.0" visible="true">
|
||||
<ScrollPane id="serverinfo" hbarPolicy="NEVER" layoutX="170.0" layoutY="71.0" pannable="true"
|
||||
prefHeight="234.0" prefWidth="432.0" visible="true">
|
||||
<content>
|
||||
<FlowPane id="" focusTraversable="false" orientation="HORIZONTAL" prefHeight="219.0" prefWidth="428.0" rowValignment="TOP" visible="true">
|
||||
<FlowPane id="" focusTraversable="false" orientation="HORIZONTAL" prefHeight="219.0"
|
||||
prefWidth="428.0" rowValignment="TOP" visible="true">
|
||||
<padding>
|
||||
<Insets bottom="10.0" left="15.0" top="7.0"/>
|
||||
</padding>
|
||||
<children>
|
||||
<Label id="serverDescription" alignment="TOP_LEFT" contentDisplay="LEFT" nodeOrientation="LEFT_TO_RIGHT" prefHeight="204.0" prefWidth="407.0" text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla convallis magna tellus, in bibendum tortor dignissim non. Phasellus vel tincidunt nulla, eu convallis ligula. Suspendisse ut diam vestibulum, tincidunt neque ut, posuere risus. Pellentesque posuere molestie eros, quis laoreet ante ornare quis. Morbi eu tortor fermentum, iaculis risus sit amet, fringilla augue. Aenean nulla purus, rutrum non sapien et, convallis tincidunt purus. Vivamus a eros pulvinar, dignissim leo lacinia, sodales nulla. Aliquam tortor augue, cursus a rutrum viverra, consequat non tellus. Donec porta nisl sed quam dictum commodo. Sed et vulputate dolor. Morbi ultrices justo vitae convallis semper. Donec sodales velit vel velit faucibus, et scelerisque felis finibus. Sed rutrum lacinia mauris, porta cursus mauris tempor eu. Duis turpis nulla, dictum vitae commodo rhoncus, pretium in turpis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos." textFill="#d3d3d3" wrapText="true">
|
||||
<Label id="serverDescription" alignment="TOP_LEFT" contentDisplay="LEFT"
|
||||
nodeOrientation="LEFT_TO_RIGHT" prefHeight="204.0" prefWidth="407.0"
|
||||
text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla convallis magna tellus, in bibendum tortor dignissim non. Phasellus vel tincidunt nulla, eu convallis ligula. Suspendisse ut diam vestibulum, tincidunt neque ut, posuere risus. Pellentesque posuere molestie eros, quis laoreet ante ornare quis. Morbi eu tortor fermentum, iaculis risus sit amet, fringilla augue. Aenean nulla purus, rutrum non sapien et, convallis tincidunt purus. Vivamus a eros pulvinar, dignissim leo lacinia, sodales nulla. Aliquam tortor augue, cursus a rutrum viverra, consequat non tellus. Donec porta nisl sed quam dictum commodo. Sed et vulputate dolor. Morbi ultrices justo vitae convallis semper. Donec sodales velit vel velit faucibus, et scelerisque felis finibus. Sed rutrum lacinia mauris, porta cursus mauris tempor eu. Duis turpis nulla, dictum vitae commodo rhoncus, pretium in turpis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos."
|
||||
textFill="#d3d3d3" wrapText="true">
|
||||
<font>
|
||||
<Font size="14.0" fx:id="x3"/>
|
||||
</font>
|
||||
|
@ -57,18 +70,23 @@
|
|||
</ScrollPane>
|
||||
<Pane id="serverentrance" layoutX="170.0" layoutY="27.0" prefHeight="372.0" prefWidth="430.0">
|
||||
<children>
|
||||
<Button id="serverLaunch" layoutX="180.0" layoutY="294.0" mnemonicParsing="false" prefHeight="60.0" prefWidth="182.0" text="ИГРАТЬ">
|
||||
<Button id="serverLaunch" layoutX="180.0" layoutY="294.0" mnemonicParsing="false"
|
||||
prefHeight="60.0" prefWidth="182.0" text="ИГРАТЬ">
|
||||
<font>
|
||||
<Font size="22.0"/>
|
||||
</font>
|
||||
</Button>
|
||||
<Button id="clientbtn" layoutX="363.0" layoutY="294.0" mnemonicParsing="false" prefHeight="60.0" prefWidth="50.0" text="" />
|
||||
<Label id="serverStatus" alignment="TOP_RIGHT" contentDisplay="RIGHT" layoutX="14.0" layoutY="312.0" opacity="0.61" prefHeight="25.0" prefWidth="153.0" text="12/100" textAlignment="RIGHT" textFill="WHITE">
|
||||
<Button id="clientbtn" layoutX="363.0" layoutY="294.0" mnemonicParsing="false" prefHeight="60.0"
|
||||
prefWidth="50.0" text=""/>
|
||||
<Label id="serverStatus" alignment="TOP_RIGHT" contentDisplay="RIGHT" layoutX="14.0"
|
||||
layoutY="312.0" opacity="0.61" prefHeight="25.0" prefWidth="153.0" text="12/100"
|
||||
textAlignment="RIGHT" textFill="WHITE">
|
||||
<font>
|
||||
<Font name="System Bold" size="16.0"/>
|
||||
</font>
|
||||
</Label>
|
||||
<Label id="serverLabel" layoutX="2.0" layoutY="11.0" prefHeight="40.0" prefWidth="274.0" text="СЕРВЕР IFARM">
|
||||
<Label id="serverLabel" layoutX="2.0" layoutY="11.0" prefHeight="40.0" prefWidth="274.0"
|
||||
text="СЕРВЕР IFARM">
|
||||
<font>
|
||||
<Font name="System Bold" size="18.0"/>
|
||||
</font>
|
||||
|
@ -76,12 +94,16 @@
|
|||
<Insets left="14.0"/>
|
||||
</padding>
|
||||
</Label>
|
||||
<Button id="discord_url" alignment="BOTTOM_CENTER" contentDisplay="CENTER" layoutX="386.0" layoutY="23.0" minHeight="16.0" minWidth="28.0" mnemonicParsing="false" prefHeight="16.0" prefWidth="28.0" text="" textAlignment="CENTER" />
|
||||
<Button id="discord_url" alignment="BOTTOM_CENTER" contentDisplay="CENTER" layoutX="386.0"
|
||||
layoutY="23.0" minHeight="16.0" minWidth="28.0" mnemonicParsing="false"
|
||||
prefHeight="16.0" prefWidth="28.0" text="" textAlignment="CENTER"/>
|
||||
</children>
|
||||
|
||||
</Pane>
|
||||
<Button id="logoutbtn" layoutX="19.0" layoutY="350.0" mnemonicParsing="false" prefHeight="31.0" prefWidth="133.0" styleClass="logoutbtn" text="Выйти" />
|
||||
<Button id="settingsbtn" alignment="CENTER" contentDisplay="CENTER" layoutX="518.0" layoutY="2.0" mnemonicParsing="false" prefHeight="25.0" prefWidth="25.0" text="" textAlignment="CENTER" />
|
||||
<Button id="logoutbtn" layoutX="19.0" layoutY="350.0" mnemonicParsing="false" prefHeight="31.0"
|
||||
prefWidth="133.0" styleClass="logoutbtn" text="Выйти"/>
|
||||
<Button id="settingsbtn" alignment="CENTER" contentDisplay="CENTER" layoutX="518.0" layoutY="2.0"
|
||||
mnemonicParsing="false" prefHeight="25.0" prefWidth="25.0" text="" textAlignment="CENTER"/>
|
||||
</children>
|
||||
</Pane>
|
||||
<Pane id="mask" opacity="0.0" prefHeight="400.0" prefWidth="600.0" visible="false"/>
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
<body style="color:red">
|
||||
<h2>Offline-режим</h2>
|
||||
Лаунчер запущен в Offline-режиме. В этом режиме Вы можете запустить любой ранее загруженный клиент
|
||||
с любым именем пользователя, при этом вход на серверы с авторизацией, а так же система скинов и плащей <b>может не работать</b>.
|
||||
с любым именем пользователя, при этом вход на серверы с авторизацией, а так же система скинов и плащей <b>может не
|
||||
работать</b>.
|
||||
Скорее всего, проблема вызвана сбоем на сервере или неполадками в интернет-подключении.
|
||||
Проверьте состояние интернет-подключения или обратитесь к администратору сервера.
|
||||
</body>
|
||||
|
|
|
@ -7,13 +7,15 @@
|
|||
|
||||
<!-- DrLeonardo Design -->
|
||||
|
||||
<Pane fx:id="overlay" prefHeight="400.0" prefWidth="600.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8.0.20">
|
||||
<Pane fx:id="overlay" prefHeight="400.0" prefWidth="600.0" xmlns:fx="http://javafx.com/fxml/1"
|
||||
xmlns="http://javafx.com/javafx/8.0.20">
|
||||
<stylesheets>
|
||||
<URL value="@debug.css"/>
|
||||
</stylesheets>
|
||||
|
||||
<!-- Debug controls -->
|
||||
<TextArea fx:id="output" layoutY="28.0" prefHeight="372.0" prefWidth="600.0"/>
|
||||
<Button fx:id="copy" defaultButton="true" layoutX="375.0" layoutY="352.0" prefHeight="30.0" prefWidth="100.0" text="Копировать" />
|
||||
<Button fx:id="copy" defaultButton="true" layoutX="375.0" layoutY="352.0" prefHeight="30.0" prefWidth="100.0"
|
||||
text="Копировать"/>
|
||||
<Button fx:id="action" layoutX="480.0" layoutY="352.0" prefHeight="30.0" prefWidth="100.0"/>
|
||||
</Pane>
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
|
||||
<!-- DrLeonardo Design -->
|
||||
|
||||
<Pane fx:id="overlay" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.20" xmlns:fx="http://javafx.com/fxml/1">
|
||||
<Pane fx:id="overlay" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.20"
|
||||
xmlns:fx="http://javafx.com/fxml/1">
|
||||
<children>
|
||||
<Pane id="holder" layoutX="171.0" layoutY="28.0" prefHeight="371.0" prefWidth="428.0">
|
||||
<children>
|
||||
|
@ -24,7 +25,8 @@
|
|||
</VBox>
|
||||
</content>
|
||||
</ScrollPane>
|
||||
<Button fx:id="apply" defaultButton="true" layoutX="318.0" layoutY="336.0" prefHeight="25.0" prefWidth="100.0" text="Применить" />
|
||||
<Button fx:id="apply" defaultButton="true" layoutX="318.0" layoutY="336.0" prefHeight="25.0"
|
||||
prefWidth="100.0" text="Применить"/>
|
||||
</children>
|
||||
</Pane>
|
||||
</children>
|
||||
|
|
|
@ -8,15 +8,18 @@
|
|||
|
||||
<!-- DrLeonardo Design | Fixes by Yaroslavik -->
|
||||
|
||||
<Pane fx:id="overlay" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.20" xmlns:fx="http://javafx.com/fxml/1">
|
||||
<Pane fx:id="overlay" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.20"
|
||||
xmlns:fx="http://javafx.com/fxml/1">
|
||||
<children>
|
||||
<ImageView id="spinner" fx:id="spinner" fitHeight="161.0" fitWidth="161.0" layoutX="213.0" layoutY="94.0" y="-6.0">
|
||||
<ImageView id="spinner" fx:id="spinner" fitHeight="161.0" fitWidth="161.0" layoutX="213.0" layoutY="94.0"
|
||||
y="-6.0">
|
||||
<image>
|
||||
<Image url="@../../images/icons/loading.gif"/>
|
||||
</image>
|
||||
</ImageView>
|
||||
<!-- Description -->
|
||||
<Label fx:id="description" alignment="CENTER" contentDisplay="CENTER" layoutX="152.0" layoutY="249.0" prefHeight="64.0" prefWidth="283.0" text="..." textAlignment="CENTER" />
|
||||
<Label fx:id="description" alignment="CENTER" contentDisplay="CENTER" layoutX="152.0" layoutY="249.0"
|
||||
prefHeight="64.0" prefWidth="283.0" text="..." textAlignment="CENTER"/>
|
||||
</children>
|
||||
<stylesheets>
|
||||
<URL value="@processing.css"/>
|
||||
|
|
|
@ -13,16 +13,23 @@
|
|||
|
||||
<!-- DrLeonardo Design -->
|
||||
|
||||
<Pane fx:id="overlay" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.20" xmlns:fx="http://javafx.com/fxml/1">
|
||||
<Pane fx:id="overlay" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.20"
|
||||
xmlns:fx="http://javafx.com/fxml/1">
|
||||
<children>
|
||||
<Pane id="holder" layoutX="1.0" layoutY="28.0" prefHeight="371.0" prefWidth="598.0">
|
||||
<children>
|
||||
<CheckBox fx:id="autoEnter" layoutX="14.0" layoutY="80.0" text="Автовход на сервер"/>
|
||||
<Text fill="#8c8c8c" layoutX="38.0" layoutY="95.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Включение авто-входа означает что вы сразу после загрузки клиента попадете на сервер" wrappingWidth="533.0000102519989" y="15.0" />
|
||||
<Text fill="#8c8c8c" layoutX="38.0" layoutY="95.0" strokeType="OUTSIDE" strokeWidth="0.0"
|
||||
text="Включение авто-входа означает что вы сразу после загрузки клиента попадете на сервер"
|
||||
wrappingWidth="533.0000102519989" y="15.0"/>
|
||||
<CheckBox fx:id="fullScreen" layoutX="13.0" layoutY="185.0" text="Клиент в полный экран"/>
|
||||
<Text fill="#8c8c8c" layoutX="38.0" layoutY="200.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Включение данной функции позволяет запустить игру сразу в полноэкранном режиме" wrappingWidth="533.0000102519989" y="15.0" />
|
||||
<Text fill="#8c8c8c" layoutX="38.0" layoutY="200.0" strokeType="OUTSIDE" strokeWidth="0.0"
|
||||
text="Включение данной функции позволяет запустить игру сразу в полноэкранном режиме"
|
||||
wrappingWidth="533.0000102519989" y="15.0"/>
|
||||
<CheckBox id="debug" layoutX="13.0" layoutY="124.0" text="Режим Отладки"/>
|
||||
<Text fill="#8c8c8c" layoutX="38.0" layoutY="139.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Режим отладки позволяет просмотреть лог запуска и работы программы в реальном времени прямо из лаунчера, что упрощает поиск нужной информации" wrappingWidth="533.0000016447157" y="15.0" />
|
||||
<Text fill="#8c8c8c" layoutX="38.0" layoutY="139.0" strokeType="OUTSIDE" strokeWidth="0.0"
|
||||
text="Режим отладки позволяет просмотреть лог запуска и работы программы в реальном времени прямо из лаунчера, что упрощает поиск нужной информации"
|
||||
wrappingWidth="533.0000016447157" y="15.0"/>
|
||||
|
||||
<!-- RAM settings -->
|
||||
<TextFlow layoutX="128.0" layoutY="6.0">
|
||||
|
@ -33,7 +40,8 @@
|
|||
<!-- RAM settings -->
|
||||
|
||||
<!-- Deldir settings -->
|
||||
<Button fx:id="deleteDir" layoutX="15.0" layoutY="333.0" prefHeight="25.0" prefWidth="245.0" text="Очистить данные игровых клиентов" textAlignment="CENTER" wrapText="true">
|
||||
<Button fx:id="deleteDir" layoutX="15.0" layoutY="333.0" prefHeight="25.0" prefWidth="245.0"
|
||||
text="Очистить данные игровых клиентов" textAlignment="CENTER" wrapText="true">
|
||||
<font>
|
||||
<Font name="System Bold" size="12.0"/>
|
||||
</font>
|
||||
|
@ -41,21 +49,27 @@
|
|||
<!-- Deldir settings -->
|
||||
|
||||
<!-- Changedir settings -->
|
||||
<Button fx:id="changeDir" layoutX="14.0" layoutY="229.0" prefHeight="25.0" prefWidth="200.0" text="Сменить директорию загрузки" textAlignment="CENTER" wrapText="true" />
|
||||
<Hyperlink id="dirLabel" alignment="TOP_LEFT" layoutX="215.0" layoutY="230.0" prefHeight="23.0" prefWidth="371.0" text="C:/Users" wrapText="true" />
|
||||
<Button fx:id="changeDir" layoutX="14.0" layoutY="229.0" prefHeight="25.0" prefWidth="200.0"
|
||||
text="Сменить директорию загрузки" textAlignment="CENTER" wrapText="true"/>
|
||||
<Hyperlink id="dirLabel" alignment="TOP_LEFT" layoutX="215.0" layoutY="230.0" prefHeight="23.0"
|
||||
prefWidth="371.0" text="C:/Users" wrapText="true"/>
|
||||
<!-- Changedir settings -->
|
||||
|
||||
<Button fx:id="apply" defaultButton="true" layoutX="486.0" layoutY="335.0" prefHeight="23.0" prefWidth="100.0" text="Применить" />
|
||||
<Button fx:id="apply" defaultButton="true" layoutX="486.0" layoutY="335.0" prefHeight="23.0"
|
||||
prefWidth="100.0" text="Применить"/>
|
||||
<Text layoutX="17.0" layoutY="19.0">Выделение памяти:</Text>
|
||||
<Pane fx:id="transferDialog" prefHeight="371.0" prefWidth="598.0">
|
||||
<children>
|
||||
<Text fill="WHITE" layoutX="99.0" layoutY="155.0" strokeType="OUTSIDE" strokeWidth="0.0" text="Перенести все данные в новую директорию?" wrappingWidth="400.13671875">
|
||||
<Text fill="WHITE" layoutX="99.0" layoutY="155.0" strokeType="OUTSIDE" strokeWidth="0.0"
|
||||
text="Перенести все данные в новую директорию?" wrappingWidth="400.13671875">
|
||||
<font>
|
||||
<Font size="19.0"/>
|
||||
</font>
|
||||
</Text>
|
||||
<Button fx:id="applyTransfer" layoutX="130.0" layoutY="186.0" mnemonicParsing="false" prefHeight="25.0" prefWidth="124.0" text="Да, перенести!" />
|
||||
<Button fx:id="cancelTransfer" layoutX="344.0" layoutY="186.0" mnemonicParsing="false" prefHeight="25.0" prefWidth="124.0" text="Нет, не нужно." />
|
||||
<Button fx:id="applyTransfer" layoutX="130.0" layoutY="186.0" mnemonicParsing="false"
|
||||
prefHeight="25.0" prefWidth="124.0" text="Да, перенести!"/>
|
||||
<Button fx:id="cancelTransfer" layoutX="344.0" layoutY="186.0" mnemonicParsing="false"
|
||||
prefHeight="25.0" prefWidth="124.0" text="Нет, не нужно."/>
|
||||
</children>
|
||||
</Pane>
|
||||
|
||||
|
|
|
@ -10,7 +10,8 @@
|
|||
|
||||
<!-- DrLeonardo Design -->
|
||||
|
||||
<Pane fx:id="overlay" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.20" xmlns:fx="http://javafx.com/fxml/1">
|
||||
<Pane fx:id="overlay" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.20"
|
||||
xmlns:fx="http://javafx.com/fxml/1">
|
||||
<children>
|
||||
<ImageView fitHeight="400.0" fitWidth="600.0" pickOnBounds="true" preserveRatio="true">
|
||||
<image>
|
||||
|
@ -23,10 +24,13 @@
|
|||
<Image url="@../../images/icons/logo_small.png"/>
|
||||
</image>
|
||||
</ImageView>
|
||||
<Label fx:id="description" layoutX="12.0" layoutY="267.0" prefHeight="98.0" prefWidth="576.0" text="..." textFill="WHITE" />
|
||||
<ProgressBar fx:id="progress" disable="false" layoutX="-1.0" layoutY="376.0" opacity="1.0" prefHeight="24.0" prefWidth="600.0" progress="1.0" style="" />
|
||||
<Label fx:id="description" layoutX="12.0" layoutY="267.0" prefHeight="98.0" prefWidth="576.0" text="..."
|
||||
textFill="WHITE"/>
|
||||
<ProgressBar fx:id="progress" disable="false" layoutX="-1.0" layoutY="376.0" opacity="1.0" prefHeight="24.0"
|
||||
prefWidth="600.0" progress="1.0" style=""/>
|
||||
<!-- Update controls -->
|
||||
<Label fx:id="utitle" alignment="TOP_LEFT" layoutX="15.0" layoutY="236.0" prefHeight="30.0" prefWidth="470.0" text="Обновление..." textFill="WHITE">
|
||||
<Label fx:id="utitle" alignment="TOP_LEFT" layoutX="15.0" layoutY="236.0" prefHeight="30.0" prefWidth="470.0"
|
||||
text="Обновление..." textFill="WHITE">
|
||||
<font>
|
||||
<Font name="System Bold" size="20.0"/>
|
||||
</font>
|
||||
|
|
|
@ -303,8 +303,7 @@ public static Process launch(
|
|||
LogHelper.debug("Writing ClientLauncher params");
|
||||
ClientLauncherContext context = new ClientLauncherContext();
|
||||
clientStarted = false;
|
||||
if(writeParamsThread != null && writeParamsThread.isAlive())
|
||||
{
|
||||
if (writeParamsThread != null && writeParamsThread.isAlive()) {
|
||||
writeParamsThread.interrupt();
|
||||
}
|
||||
writeParamsThread = CommonHelper.newThread("Client params writter", true, () ->
|
||||
|
@ -394,23 +393,19 @@ public static Process launch(
|
|||
// Let's rock!
|
||||
process = builder.start();
|
||||
if (!LogHelper.isDebugEnabled()) {
|
||||
for(int i=0;i<50;++i)
|
||||
{
|
||||
if(!process.isAlive())
|
||||
{
|
||||
for (int i = 0; i < 50; ++i) {
|
||||
if (!process.isAlive()) {
|
||||
int exitCode = process.exitValue();
|
||||
LogHelper.error("Process exit code %d", exitCode);
|
||||
if (writeParamsThread != null && writeParamsThread.isAlive()) writeParamsThread.interrupt();
|
||||
break;
|
||||
}
|
||||
if(clientStarted)
|
||||
{
|
||||
if (clientStarted) {
|
||||
break;
|
||||
}
|
||||
Thread.sleep(200);
|
||||
}
|
||||
if(!clientStarted)
|
||||
{
|
||||
if (!clientStarted) {
|
||||
LogHelper.error("Write Client Params not successful. Using debug mode for more information");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,9 +64,9 @@ public static Path getAppDataDir() throws IOException {
|
|||
public static Path getLauncherDir(String projectname) throws IOException {
|
||||
return getAppDataDir().resolve(projectname);
|
||||
}
|
||||
|
||||
@LauncherAPI
|
||||
public static Path getGuardDir()
|
||||
{
|
||||
public static Path getGuardDir() {
|
||||
return dir.resolve("guard");
|
||||
}
|
||||
|
||||
|
|
|
@ -82,19 +82,15 @@ public static long getTotalMemory() {
|
|||
}
|
||||
|
||||
@LauncherAPI
|
||||
public static int getClientJVMBits()
|
||||
{
|
||||
public static int getClientJVMBits() {
|
||||
return LauncherGuardManager.guard.getClientJVMBits();
|
||||
}
|
||||
|
||||
@LauncherAPI
|
||||
public static long getJVMTotalMemory()
|
||||
{
|
||||
if(getClientJVMBits() == 32)
|
||||
{
|
||||
public static long getJVMTotalMemory() {
|
||||
if (getClientJVMBits() == 32) {
|
||||
return Math.min(getTotalMemory(), 1536);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return getTotalMemory();
|
||||
}
|
||||
}
|
||||
|
@ -105,8 +101,7 @@ public static HasherStore getDefaultHasherStore() {
|
|||
}
|
||||
|
||||
@LauncherAPI
|
||||
public static void setAuthParams(AuthRequestEvent event)
|
||||
{
|
||||
public static void setAuthParams(AuthRequestEvent event) {
|
||||
LauncherGuardManager.guard.setProtectToken(event.protectToken);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,10 @@
|
|||
import ru.gravit.launcher.profiles.ClientProfile;
|
||||
import ru.gravit.launcher.serialize.HInput;
|
||||
import ru.gravit.launcher.serialize.HOutput;
|
||||
import ru.gravit.utils.helper.*;
|
||||
import ru.gravit.utils.helper.IOHelper;
|
||||
import ru.gravit.utils.helper.JVMHelper;
|
||||
import ru.gravit.utils.helper.LogHelper;
|
||||
import ru.gravit.utils.helper.SecurityHelper;
|
||||
|
||||
import javax.crypto.BadPaddingException;
|
||||
import javax.crypto.IllegalBlockSizeException;
|
||||
|
|
|
@ -6,10 +6,16 @@
|
|||
|
||||
public interface LauncherGuardInterface {
|
||||
String getName();
|
||||
|
||||
Path getJavaBinPath();
|
||||
|
||||
int getClientJVMBits();
|
||||
|
||||
void init(boolean clientInstance);
|
||||
|
||||
void addCustomParams(ClientLauncherContext context);
|
||||
|
||||
void addCustomEnv(ClientLauncherContext context);
|
||||
|
||||
void setProtectToken(String token);
|
||||
}
|
||||
|
|
|
@ -6,21 +6,17 @@
|
|||
|
||||
public class LauncherGuardManager {
|
||||
public static LauncherGuardInterface guard;
|
||||
public static void initGuard(boolean clientInstance)
|
||||
{
|
||||
if(ClientLauncher.isUsingWrapper())
|
||||
{
|
||||
|
||||
public static void initGuard(boolean clientInstance) {
|
||||
if (ClientLauncher.isUsingWrapper()) {
|
||||
guard = new LauncherWrapperGuard();
|
||||
}
|
||||
else if(ClientLauncher.isDownloadJava())
|
||||
{
|
||||
} else if (ClientLauncher.isDownloadJava()) {
|
||||
guard = new LauncherJavaGuard();
|
||||
}
|
||||
else guard = new LauncherNoGuard();
|
||||
} else guard = new LauncherNoGuard();
|
||||
guard.init(clientInstance);
|
||||
}
|
||||
public static Path getGuardJavaBinPath()
|
||||
{
|
||||
|
||||
public static Path getGuardJavaBinPath() {
|
||||
return guard.getJavaBinPath();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,9 @@
|
|||
import ru.gravit.launcher.LauncherConfig;
|
||||
import ru.gravit.launcher.client.ClientLauncherContext;
|
||||
import ru.gravit.launcher.client.DirBridge;
|
||||
import ru.gravit.utils.helper.*;
|
||||
import ru.gravit.utils.helper.IOHelper;
|
||||
import ru.gravit.utils.helper.JVMHelper;
|
||||
import ru.gravit.utils.helper.UnpackHelper;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
|
@ -23,13 +25,11 @@ public String getName() {
|
|||
|
||||
@Override
|
||||
public Path getJavaBinPath() {
|
||||
if(JVMHelper.OS_TYPE == JVMHelper.OS.MUSTDIE)
|
||||
{
|
||||
if (JVMHelper.OS_TYPE == JVMHelper.OS.MUSTDIE) {
|
||||
String projectName = Launcher.getConfig().projectname;
|
||||
String wrapperUnpackName = JVMHelper.JVM_BITS == 64 ? projectName.concat("64.exe") : projectName.concat("32.exe");
|
||||
return DirBridge.getGuardDir().resolve(wrapperUnpackName);
|
||||
}
|
||||
else
|
||||
} else
|
||||
return IOHelper.resolveJavaBin(Paths.get(System.getProperty("java.home")));
|
||||
}
|
||||
|
||||
|
@ -69,8 +69,7 @@ public void addCustomEnv(ClientLauncherContext context) {
|
|||
env.put("GUARD_TOKEN", protectToken);
|
||||
if (config.guardLicenseName != null)
|
||||
env.put("GUARD_LICENSE_NAME", config.guardLicenseName);
|
||||
if(config.guardLicenseKey != null)
|
||||
{
|
||||
if (config.guardLicenseKey != null) {
|
||||
env.put("GUARD_LICENSE_KEY", config.guardLicenseKey);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -146,8 +146,7 @@ public void run(String[] args) throws ScriptException, NoSuchMethodException, IO
|
|||
|
||||
@Override
|
||||
public void preLoad() throws IOException, ScriptException {
|
||||
if(!isPreLoaded)
|
||||
{
|
||||
if (!isPreLoaded) {
|
||||
loadScript(Launcher.API_SCRIPT_FILE);
|
||||
loadScript(Launcher.CONFIG_SCRIPT_FILE);
|
||||
isPreLoaded = true;
|
||||
|
|
|
@ -64,21 +64,16 @@ public String getHWDisk() {
|
|||
}
|
||||
}
|
||||
|
||||
public String getSoundCardInfo()
|
||||
{
|
||||
for(SoundCard soundcard : hardware.getSoundCards())
|
||||
{
|
||||
public String getSoundCardInfo() {
|
||||
for (SoundCard soundcard : hardware.getSoundCards()) {
|
||||
return soundcard.getName();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public String getMacAddr()
|
||||
{
|
||||
for(NetworkIF networkIF : hardware.getNetworkIFs())
|
||||
{
|
||||
for(String ipv4 : networkIF.getIPv4addr())
|
||||
{
|
||||
public String getMacAddr() {
|
||||
for (NetworkIF networkIF : hardware.getNetworkIFs()) {
|
||||
for (String ipv4 : networkIF.getIPv4addr()) {
|
||||
if (ipv4.startsWith("127.")) continue;
|
||||
if (ipv4.startsWith("10.")) continue;
|
||||
return networkIF.getMacaddr();
|
||||
|
@ -110,21 +105,18 @@ public void printHardwareInformation() {
|
|||
for (UsbDevice s : hardware.getUsbDevices(true)) {
|
||||
LogHelper.debug("USBDevice Serial: %s Name: %s", s.getSerialNumber(), s.getName());
|
||||
}
|
||||
for(NetworkIF networkIF : hardware.getNetworkIFs())
|
||||
{
|
||||
for (NetworkIF networkIF : hardware.getNetworkIFs()) {
|
||||
LogHelper.debug("Network Interface: %s mac: %s", networkIF.getName(), networkIF.getMacaddr());
|
||||
NetworkInterface network = networkIF.getNetworkInterface();
|
||||
if (network.isLoopback() || network.isVirtual()) continue;
|
||||
LogHelper.debug("Network Interface display: %s name: %s", network.getDisplayName(), network.getName());
|
||||
for(String ipv4 : networkIF.getIPv4addr())
|
||||
{
|
||||
for (String ipv4 : networkIF.getIPv4addr()) {
|
||||
if (ipv4.startsWith("127.")) continue;
|
||||
if (ipv4.startsWith("10.")) continue;
|
||||
LogHelper.subDebug("IPv4: %s", ipv4);
|
||||
}
|
||||
}
|
||||
for(SoundCard soundcard : hardware.getSoundCards())
|
||||
{
|
||||
for (SoundCard soundcard : hardware.getSoundCards()) {
|
||||
LogHelper.debug("SoundCard %s", soundcard.getName());
|
||||
}
|
||||
CentralProcessor processor = hardware.getProcessor();
|
||||
|
|
|
@ -1,13 +1,5 @@
|
|||
package ru.gravit.launcher.downloader;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.ClientProtocolException;
|
||||
import org.apache.http.client.ResponseHandler;
|
||||
|
@ -15,9 +7,16 @@
|
|||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClients;
|
||||
import org.apache.http.impl.client.LaxRedirectStrategy;
|
||||
|
||||
import ru.gravit.utils.helper.IOHelper;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
|
||||
public class ListDownloader {
|
||||
public void download(String base, List<String> applies, Path dstDirFile) throws IOException, URISyntaxException {
|
||||
try (CloseableHttpClient httpclient = HttpClients.custom()
|
||||
|
@ -39,9 +38,11 @@ public void download(String base, List<String> applies, Path dstDirFile) throws
|
|||
|
||||
static class FileDownloadResponseHandler implements ResponseHandler<Path> {
|
||||
private final Path target;
|
||||
|
||||
public FileDownloadResponseHandler(Path target) {
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Path handleResponse(HttpResponse response) throws ClientProtocolException, IOException {
|
||||
InputStream source = response.getEntity().getContent();
|
||||
|
|
|
@ -71,10 +71,11 @@ public R request() throws Exception {
|
|||
}
|
||||
}
|
||||
}
|
||||
protected R requestWebSockets() throws Exception
|
||||
{
|
||||
|
||||
protected R requestWebSockets() throws Exception {
|
||||
return null;
|
||||
}
|
||||
|
||||
@LauncherAPI
|
||||
protected abstract R requestDo(HInput input, HOutput output) throws Exception;
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ public AuthRequest(LauncherConfig config, String login, byte[] password, HWID hw
|
|||
this.auth_id = auth_id;
|
||||
customText = "";
|
||||
}
|
||||
|
||||
@LauncherAPI
|
||||
public AuthRequest(LauncherConfig config, String login, byte[] password, HWID hwid, String customText, String auth_id) {
|
||||
super(config);
|
||||
|
@ -57,11 +58,12 @@ public AuthRequest(LauncherConfig config, String login, byte[] password, HWID hw
|
|||
public AuthRequest(String login, byte[] password, HWID hwid) {
|
||||
this(null, login, password, hwid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AuthRequestEvent requestWebSockets() throws Exception
|
||||
{
|
||||
public AuthRequestEvent requestWebSockets() throws Exception {
|
||||
return (AuthRequestEvent) LegacyRequestBridge.sendRequest(this);
|
||||
}
|
||||
|
||||
@LauncherAPI
|
||||
public AuthRequest(String login, byte[] password, HWID hwid, String auth_id) {
|
||||
this(null, login, password, hwid, auth_id);
|
||||
|
@ -71,6 +73,7 @@ public AuthRequest(String login, byte[] password, HWID hwid, String auth_id) {
|
|||
public Integer getLegacyType() {
|
||||
return RequestType.AUTH.getNumber();
|
||||
}
|
||||
|
||||
/*public class EchoRequest implements RequestInterface
|
||||
{
|
||||
String echo;
|
||||
|
|
|
@ -21,11 +21,12 @@ public SetProfileRequest(LauncherConfig config, ClientProfile profile) {
|
|||
this.profile = profile;
|
||||
this.client = profile.getTitle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SetProfileRequestEvent requestWebSockets() throws Exception
|
||||
{
|
||||
public SetProfileRequestEvent requestWebSockets() throws Exception {
|
||||
return (SetProfileRequestEvent) LegacyRequestBridge.sendRequest(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getLegacyType() {
|
||||
return RequestType.SETPROFILE.getNumber();
|
||||
|
|
|
@ -49,8 +49,7 @@ public static void update(LauncherConfig config, LauncherRequestEvent result) th
|
|||
// Rewrite and start new instance
|
||||
if (result.binary != null)
|
||||
IOHelper.write(BINARY_PATH, result.binary);
|
||||
else
|
||||
{
|
||||
else {
|
||||
URLConnection connection = IOHelper.newConnection(new URL(result.url));
|
||||
connection.connect();
|
||||
try (OutputStream stream = connection.getOutputStream()) {
|
||||
|
@ -70,8 +69,7 @@ public LauncherRequest() {
|
|||
}
|
||||
|
||||
@Override
|
||||
public LauncherRequestEvent requestWebSockets() throws Exception
|
||||
{
|
||||
public LauncherRequestEvent requestWebSockets() throws Exception {
|
||||
LauncherRequestEvent result = (LauncherRequestEvent) LegacyRequestBridge.sendRequest(this);
|
||||
if (result.needUpdate) update(config, result);
|
||||
return result;
|
||||
|
|
|
@ -33,8 +33,7 @@ public Integer getLegacyType() {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ProfilesRequestEvent requestWebSockets() throws Exception
|
||||
{
|
||||
public ProfilesRequestEvent requestWebSockets() throws Exception {
|
||||
return (ProfilesRequestEvent) LegacyRequestBridge.sendRequest(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,8 +26,7 @@ public UpdateListRequest(LauncherConfig config) {
|
|||
}
|
||||
|
||||
@Override
|
||||
public UpdateListRequestEvent requestWebSockets() throws Exception
|
||||
{
|
||||
public UpdateListRequestEvent requestWebSockets() throws Exception {
|
||||
return (UpdateListRequestEvent) LegacyRequestBridge.sendRequest(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -197,9 +197,9 @@ private static void fillActionsQueue(Queue<UpdateAction> queue, HashedDir mismat
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public UpdateRequestEvent requestWebSockets() throws Exception
|
||||
{
|
||||
public UpdateRequestEvent requestWebSockets() throws Exception {
|
||||
return (UpdateRequestEvent) LegacyRequestBridge.sendRequest(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
package ru.gravit.launcher.request.websockets;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Map;
|
||||
|
||||
import org.java_websocket.client.WebSocketClient;
|
||||
import org.java_websocket.drafts.Draft_6455;
|
||||
import org.java_websocket.handshake.ServerHandshake;
|
||||
|
||||
import ru.gravit.utils.helper.LogHelper;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Map;
|
||||
|
||||
public class ClientJSONPoint extends WebSocketClient {
|
||||
|
||||
public ClientJSONPoint(URI serverUri, Map<String, String> httpHeaders, int connectTimeout) {
|
||||
|
|
|
@ -33,6 +33,7 @@ public ClientWebSocketService(GsonBuilder gsonBuilder, String address, int i) {
|
|||
this.gsonBuilder.registerTypeAdapter(HashedEntry.class, new HashedEntryAdapter());
|
||||
this.gson = gsonBuilder.create();
|
||||
}
|
||||
|
||||
private static URI createURL(String address) {
|
||||
try {
|
||||
URI u = new URI(address);
|
||||
|
@ -42,23 +43,24 @@ private static URI createURL(String address) {
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessage(String message) {
|
||||
ResultInterface result = gson.fromJson(message, ResultInterface.class);
|
||||
for(EventHandler handler : handlers)
|
||||
{
|
||||
for (EventHandler handler : handlers) {
|
||||
handler.process(result);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Exception e)
|
||||
{
|
||||
public void onError(Exception e) {
|
||||
LogHelper.error(e);
|
||||
}
|
||||
|
||||
public Class<? extends RequestInterface> getRequestClass(String key) {
|
||||
return requests.get(key);
|
||||
}
|
||||
|
||||
public Class<? extends ResultInterface> getResultClass(String key) {
|
||||
return results.get(key);
|
||||
}
|
||||
|
@ -91,20 +93,20 @@ public void registerResults() {
|
|||
registerResult("update", UpdateRequestEvent.class);
|
||||
}
|
||||
|
||||
public void registerHandler(EventHandler eventHandler)
|
||||
{
|
||||
public void registerHandler(EventHandler eventHandler) {
|
||||
handlers.add(eventHandler);
|
||||
}
|
||||
|
||||
public void sendObject(Object obj) throws IOException {
|
||||
send(gson.toJson(obj, RequestInterface.class));
|
||||
}
|
||||
|
||||
public void sendObject(Object obj, Type type) throws IOException {
|
||||
send(gson.toJson(obj, type));
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface EventHandler
|
||||
{
|
||||
public interface EventHandler {
|
||||
void process(ResultInterface resultInterface);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,33 +8,32 @@
|
|||
import ru.gravit.utils.helper.LogHelper;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class LegacyRequestBridge {
|
||||
public static WaitEventHandler waitEventHandler = new WaitEventHandler();
|
||||
public static ClientWebSocketService service;
|
||||
|
||||
public static ResultInterface sendRequest(RequestInterface request) throws IOException, InterruptedException {
|
||||
WaitEventHandler.ResultEvent e = new WaitEventHandler.ResultEvent();
|
||||
e.type = request.getType();
|
||||
waitEventHandler.requests.add(e);
|
||||
service.sendObject(request);
|
||||
while(!e.ready)
|
||||
{
|
||||
synchronized(e)
|
||||
{
|
||||
while (!e.ready) {
|
||||
synchronized (e) {
|
||||
e.wait();
|
||||
LogHelper.debug("WAIT OK");
|
||||
}
|
||||
}
|
||||
ResultInterface result = e.result;
|
||||
waitEventHandler.requests.remove(e);
|
||||
if(e.result.getType().equals("error"))
|
||||
{
|
||||
if (e.result.getType().equals("error")) {
|
||||
ErrorRequestEvent errorRequestEvent = (ErrorRequestEvent) e.result;
|
||||
throw new RequestException(errorRequestEvent.error);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
public static void initWebSockets(String address)
|
||||
{
|
||||
|
||||
public static void initWebSockets(String address) {
|
||||
service = new ClientWebSocketService(new GsonBuilder(), address, 5000);
|
||||
service.registerResults();
|
||||
service.registerRequests();
|
||||
|
@ -46,6 +45,7 @@ public static void initWebSockets(String address)
|
|||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
if (Launcher.getConfig().nettyPort != 0)
|
||||
initWebSockets(Launcher.getConfig().nettyAddress);
|
||||
|
|
|
@ -7,17 +7,15 @@
|
|||
|
||||
public class WaitEventHandler implements ClientWebSocketService.EventHandler {
|
||||
public HashSet<ResultEvent> requests = new HashSet<>();
|
||||
|
||||
@Override
|
||||
public void process(ResultInterface result) {
|
||||
LogHelper.debug("Processing event %s type", result.getType());
|
||||
for(ResultEvent r : requests)
|
||||
{
|
||||
for (ResultEvent r : requests) {
|
||||
LogHelper.subDebug("Processing %s", r.type);
|
||||
if(r.type.equals(result.getType()) || result.getType().equals("error"))
|
||||
{
|
||||
if (r.type.equals(result.getType()) || result.getType().equals("error")) {
|
||||
LogHelper.debug("Event %s type", r.type);
|
||||
synchronized (r)
|
||||
{
|
||||
synchronized (r) {
|
||||
r.result = result;
|
||||
r.ready = true;
|
||||
r.notifyAll();
|
||||
|
@ -25,8 +23,8 @@ public void process(ResultInterface result) {
|
|||
}
|
||||
}
|
||||
}
|
||||
public static class ResultEvent
|
||||
{
|
||||
|
||||
public static class ResultEvent {
|
||||
public ResultInterface result;
|
||||
public String type;
|
||||
public boolean ready;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package ru.gravit.launcher.server;
|
||||
|
||||
import ru.gravit.launcher.managers.SimpleModulesConfigManager;
|
||||
import ru.gravit.launcher.managers.SimpleModuleManager;
|
||||
import ru.gravit.launcher.managers.SimpleModulesConfigManager;
|
||||
import ru.gravit.utils.PublicURLClassLoader;
|
||||
|
||||
import java.net.URL;
|
||||
|
|
|
@ -8,7 +8,10 @@
|
|||
import java.lang.invoke.MethodHandle;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.lang.invoke.MethodType;
|
||||
import java.nio.file.*;
|
||||
import java.nio.file.FileVisitResult;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.SimpleFileVisitor;
|
||||
import java.nio.file.attribute.BasicFileAttributes;
|
||||
import java.util.jar.JarFile;
|
||||
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
import ru.gravit.utils.helper.SecurityHelper;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.io.Writer;
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.lang.invoke.MethodType;
|
||||
|
@ -102,14 +100,12 @@ public static void initGson() {
|
|||
Launcher.gson = Launcher.gsonBuilder.create();
|
||||
}
|
||||
|
||||
public void run(String... args) throws Throwable
|
||||
{
|
||||
public void run(String... args) throws Throwable {
|
||||
gsonBuiler = new GsonBuilder();
|
||||
gsonBuiler.setPrettyPrinting();
|
||||
gson = gsonBuiler.create();
|
||||
initGson();
|
||||
if(args.length > 0 && args[0].equals("setup") && !disableSetup)
|
||||
{
|
||||
if (args.length > 0 && args[0].equals("setup") && !disableSetup) {
|
||||
LogHelper.debug("Read ServerWrapperConfig.json");
|
||||
loadConfig();
|
||||
ServerWrapperSetup setup = new ServerWrapperSetup();
|
||||
|
@ -170,24 +166,20 @@ public void run(String... args) throws Throwable
|
|||
LogHelper.info("Minecraft Version (for profile): %s", wrapper.profile == null ? "unknown" : wrapper.profile.getVersion().name);
|
||||
LogHelper.info("Start Minecraft Server");
|
||||
LogHelper.debug("Invoke main method %s", mainClass.getName());
|
||||
if(config.args == null)
|
||||
{
|
||||
if (config.args == null) {
|
||||
String[] real_args;
|
||||
if(args.length > 0)
|
||||
{
|
||||
if (args.length > 0) {
|
||||
real_args = new String[args.length - 1];
|
||||
System.arraycopy(args, 1, real_args, 0, args.length - 1);
|
||||
} else real_args = args;
|
||||
|
||||
mainMethod.invoke(real_args);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
mainMethod.invoke(config.args);
|
||||
}
|
||||
}
|
||||
public void updateLauncherConfig()
|
||||
{
|
||||
|
||||
public void updateLauncherConfig() {
|
||||
|
||||
LauncherConfig cfg = null;
|
||||
try {
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
|
||||
public class ServerWrapperCommands {
|
||||
public final CommandHandler commandHandler;
|
||||
public void registerCommands()
|
||||
{
|
||||
|
||||
public void registerCommands() {
|
||||
//FUTURE
|
||||
}
|
||||
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
package ru.gravit.launcher.server.setup;
|
||||
|
||||
import ru.gravit.launcher.Launcher;
|
||||
import ru.gravit.launcher.LauncherConfig;
|
||||
import ru.gravit.launcher.server.ServerWrapper;
|
||||
import ru.gravit.utils.PublicURLClassLoader;
|
||||
import ru.gravit.utils.helper.IOHelper;
|
||||
import ru.gravit.utils.helper.JVMHelper;
|
||||
import ru.gravit.utils.helper.LogHelper;
|
||||
import ru.gravit.utils.helper.SecurityHelper;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
import java.net.URL;
|
||||
|
@ -21,8 +18,8 @@
|
|||
public class ServerWrapperSetup {
|
||||
public ServerWrapperCommands commands;
|
||||
public PublicURLClassLoader urlClassLoader;
|
||||
public void run() throws IOException
|
||||
{
|
||||
|
||||
public void run() throws IOException {
|
||||
ServerWrapper wrapper = ServerWrapper.wrapper;
|
||||
System.out.println("Print jar filename:");
|
||||
String jarName = commands.commandHandler.readLine();
|
||||
|
@ -32,15 +29,13 @@ public void run() throws IOException
|
|||
urlClassLoader = new PublicURLClassLoader(new URL[]{jarURL});
|
||||
LogHelper.info("Check jar MainClass");
|
||||
String mainClassName = file.getManifest().getMainAttributes().getValue("Main-Class");
|
||||
if(mainClassName == null)
|
||||
{
|
||||
if (mainClassName == null) {
|
||||
LogHelper.error("Main-Class not found in MANIFEST");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
Class mainClass = Class.forName(mainClassName, false, urlClassLoader);
|
||||
} catch (ClassNotFoundException e)
|
||||
{
|
||||
} catch (ClassNotFoundException e) {
|
||||
LogHelper.error(e);
|
||||
return;
|
||||
}
|
||||
|
@ -52,11 +47,9 @@ public void run() throws IOException
|
|||
wrapper.config.mainclass = mainClassName;
|
||||
wrapper.config.address = address;
|
||||
wrapper.config.port = port;
|
||||
if(!Files.exists(ServerWrapper.publicKeyFile))
|
||||
{
|
||||
if (!Files.exists(ServerWrapper.publicKeyFile)) {
|
||||
LogHelper.error("public.key not found");
|
||||
for(int i=0;i<10;++i)
|
||||
{
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
System.out.println("Print F to continue:");
|
||||
String printF = commands.commandHandler.readLine();
|
||||
if (printF.equals("stop")) return;
|
||||
|
@ -65,8 +58,7 @@ public void run() throws IOException
|
|||
}
|
||||
}
|
||||
boolean stopOnError = wrapper.config.stopOnError;
|
||||
for(int i=0;i<10;++i)
|
||||
{
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
System.out.println("Print server account login:");
|
||||
String login = commands.commandHandler.readLine();
|
||||
System.out.println("Print server account password:");
|
||||
|
@ -79,12 +71,9 @@ public void run() throws IOException
|
|||
wrapper.config.stopOnError = false;
|
||||
LauncherConfig cfg = null;
|
||||
|
||||
if(wrapper.auth())
|
||||
{
|
||||
if (wrapper.auth()) {
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
LogHelper.error("Auth error. Recheck account params");
|
||||
}
|
||||
}
|
||||
|
@ -94,21 +83,17 @@ public void run() throws IOException
|
|||
Path startScript;
|
||||
if (JVMHelper.OS_TYPE == JVMHelper.OS.MUSTDIE) startScript = Paths.get("start.bat");
|
||||
else startScript = Paths.get("start.sh");
|
||||
if(Files.exists(startScript))
|
||||
{
|
||||
if (Files.exists(startScript)) {
|
||||
LogHelper.warning("start script found. Move to start.bak");
|
||||
Path startScriptBak = Paths.get("start.bak");
|
||||
IOHelper.move(startScript, startScriptBak);
|
||||
}
|
||||
try(Writer writer = IOHelper.newWriter(startScript))
|
||||
{
|
||||
if(JVMHelper.OS_TYPE == JVMHelper.OS.LINUX)
|
||||
{
|
||||
try (Writer writer = IOHelper.newWriter(startScript)) {
|
||||
if (JVMHelper.OS_TYPE == JVMHelper.OS.LINUX) {
|
||||
writer.append("#!/bin/sh\n\n");
|
||||
}
|
||||
writer.append("java ");
|
||||
if(mainClassName.contains("bungee"))
|
||||
{
|
||||
if (mainClassName.contains("bungee")) {
|
||||
LogHelper.info("Found BungeeCord mainclass. Modules dir change to modules_srv");
|
||||
writer.append(JVMHelper.jvmProperty("serverwrapper.modulesDir", "modules_srv"));
|
||||
writer.append(" ");
|
||||
|
@ -117,8 +102,7 @@ public void run() throws IOException
|
|||
writer.append("-cp ");
|
||||
String pathServerWrapper = IOHelper.getCodeSource(ServerWrapper.class).getFileName().toString();
|
||||
writer.append(pathServerWrapper);
|
||||
if(JVMHelper.OS_TYPE == JVMHelper.OS.MUSTDIE)
|
||||
{
|
||||
if (JVMHelper.OS_TYPE == JVMHelper.OS.MUSTDIE) {
|
||||
writer.append(";");
|
||||
} else writer.append(":");
|
||||
writer.append(jarName);
|
||||
|
|
|
@ -42,9 +42,9 @@ public ClientPermissions(long data) {
|
|||
canUSR3 = (data & (1 << 4)) != 0;
|
||||
canBot = (data & (1 << 5)) != 0;
|
||||
}
|
||||
|
||||
@LauncherAPI
|
||||
public long toLong()
|
||||
{
|
||||
public long toLong() {
|
||||
long result = 0;
|
||||
result |= canAdmin ? 0 : 1;
|
||||
result |= canServer ? 0 : (1 << 1);
|
||||
|
|
|
@ -125,10 +125,8 @@ public static Version getVersion() {
|
|||
return new Version(MAJOR, MINOR, PATCH, BUILD, RELEASE);
|
||||
}
|
||||
|
||||
public static void applyLauncherEnv(LauncherConfig.LauncherEnvironment env)
|
||||
{
|
||||
switch (env)
|
||||
{
|
||||
public static void applyLauncherEnv(LauncherConfig.LauncherEnvironment env) {
|
||||
switch (env) {
|
||||
case DEV:
|
||||
LogHelper.setDevEnabled(true);
|
||||
LogHelper.setStacktraceEnabled(true);
|
||||
|
|
|
@ -37,8 +37,7 @@ public int getLevel() //Уровень доверия, насколько уни
|
|||
|
||||
@Override
|
||||
public int compare(HWID hwid) {
|
||||
if(hwid instanceof OshiHWID)
|
||||
{
|
||||
if (hwid instanceof OshiHWID) {
|
||||
int rate = 0;
|
||||
OshiHWID oshi = (OshiHWID) hwid;
|
||||
if (Math.abs(oshi.totalMemory - totalMemory) < 1024 * 1024) rate += 5;
|
||||
|
|
|
@ -10,8 +10,10 @@
|
|||
|
||||
public class AuthRequestEvent implements EventInterface, ResultInterface {
|
||||
private static final UUID uuid = UUID.fromString("77e1bfd7-adf9-4f5d-87d6-a7dd068deb74");
|
||||
|
||||
public AuthRequestEvent() {
|
||||
}
|
||||
|
||||
@LauncherNetworkAPI
|
||||
public String error;
|
||||
@LauncherNetworkAPI
|
||||
|
|
|
@ -7,8 +7,7 @@
|
|||
|
||||
import java.util.UUID;
|
||||
|
||||
public class BatchProfileByUsernameRequestEvent implements EventInterface, ResultInterface
|
||||
{
|
||||
public class BatchProfileByUsernameRequestEvent implements EventInterface, ResultInterface {
|
||||
private static final UUID uuid = UUID.fromString("c1d6729e-be2c-48cc-b5ae-af8c012232c3");
|
||||
@LauncherNetworkAPI
|
||||
public String error;
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
public class ErrorRequestEvent implements ResultInterface, EventInterface {
|
||||
public static UUID uuid = UUID.fromString("0af22bc7-aa01-4881-bdbb-dc62b3cdac96");
|
||||
|
||||
public ErrorRequestEvent(String error) {
|
||||
this.error = error;
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ public class ExecCommandRequestEvent implements ResultInterface {
|
|||
public String getType() {
|
||||
return "execCmd";
|
||||
}
|
||||
|
||||
boolean success;
|
||||
|
||||
public ExecCommandRequestEvent(boolean success) {
|
||||
|
|
|
@ -13,6 +13,7 @@ public JoinServerRequestEvent(boolean allow) {
|
|||
}
|
||||
|
||||
public boolean allow;
|
||||
|
||||
@Override
|
||||
public UUID getUUID() {
|
||||
return uuid;
|
||||
|
|
|
@ -7,6 +7,7 @@ public class LogEvent implements ResultInterface {
|
|||
public String getType() {
|
||||
return "log";
|
||||
}
|
||||
|
||||
public String string;
|
||||
|
||||
public LogEvent(String string) {
|
||||
|
|
|
@ -7,8 +7,7 @@
|
|||
|
||||
import java.util.UUID;
|
||||
|
||||
public class ProfileByUUIDRequestEvent implements EventInterface, ResultInterface
|
||||
{
|
||||
public class ProfileByUUIDRequestEvent implements EventInterface, ResultInterface {
|
||||
private static final UUID uuid = UUID.fromString("b9014cf3-4b95-4d38-8c5f-867f190a18a0");
|
||||
@LauncherNetworkAPI
|
||||
public String error;
|
||||
|
|
|
@ -7,8 +7,7 @@
|
|||
|
||||
import java.util.UUID;
|
||||
|
||||
public class ProfileByUsernameRequestEvent implements EventInterface, ResultInterface
|
||||
{
|
||||
public class ProfileByUsernameRequestEvent implements EventInterface, ResultInterface {
|
||||
private static final UUID uuid = UUID.fromString("06204302-ff6b-4779-b97d-541e3bc39aa1");
|
||||
@LauncherNetworkAPI
|
||||
public String error;
|
||||
|
@ -18,6 +17,7 @@ public class ProfileByUsernameRequestEvent implements EventInterface, ResultInte
|
|||
public ProfileByUsernameRequestEvent(PlayerProfile playerProfile) {
|
||||
this.playerProfile = playerProfile;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getUUID() {
|
||||
return uuid;
|
||||
|
|
|
@ -8,8 +8,7 @@
|
|||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class ProfilesRequestEvent implements EventInterface, ResultInterface
|
||||
{
|
||||
public class ProfilesRequestEvent implements EventInterface, ResultInterface {
|
||||
private static final UUID uuid = UUID.fromString("2f26fbdf-598a-46dd-92fc-1699c0e173b1");
|
||||
@LauncherNetworkAPI
|
||||
public List<ClientProfile> profiles;
|
||||
|
@ -22,6 +21,7 @@ public ProfilesRequestEvent() {
|
|||
}
|
||||
|
||||
String error;
|
||||
|
||||
@Override
|
||||
public UUID getUUID() {
|
||||
return uuid;
|
||||
|
|
|
@ -15,6 +15,7 @@ public class UpdateListRequestEvent implements EventInterface, ResultInterface {
|
|||
public UpdateListRequestEvent(HashSet<String> dirs) {
|
||||
this.dirs = dirs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getUUID() {
|
||||
return uuid;
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
public class UpdateRequestEvent implements ResultInterface {
|
||||
@LauncherNetworkAPI
|
||||
public HashedDir hdir;
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return "update";
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package ru.gravit.launcher.hasher;
|
||||
|
||||
import ru.gravit.launcher.LauncherAPI;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
public final class FileNameMatcher {
|
||||
|
@ -9,8 +10,7 @@ public final class FileNameMatcher {
|
|||
private static boolean anyMatch(String[] entries, Collection<String> path) {
|
||||
//return path.stream().anyMatch(e -> Arrays.stream(entries).anyMatch(p -> p.endsWith(e)));
|
||||
String jpath = String.join("/", path);
|
||||
for(String e : entries)
|
||||
{
|
||||
for (String e : entries) {
|
||||
/*String[] split = e.split("/");
|
||||
//int index = 0;
|
||||
//for(String p : path)
|
||||
|
|
|
@ -23,33 +23,27 @@ public void printConfigurables() {
|
|||
LogHelper.info("Found %d configurables", CONFIGURABLE.size());
|
||||
}
|
||||
|
||||
public void save(String name) throws IOException
|
||||
{
|
||||
public void save(String name) throws IOException {
|
||||
CONFIGURABLE.get(name).saveConfig();
|
||||
}
|
||||
|
||||
public void load(String name) throws IOException
|
||||
{
|
||||
public void load(String name) throws IOException {
|
||||
CONFIGURABLE.get(name).loadConfig();
|
||||
}
|
||||
|
||||
public void save(String name, Path path) throws IOException
|
||||
{
|
||||
public void save(String name, Path path) throws IOException {
|
||||
CONFIGURABLE.get(name).saveConfig(path);
|
||||
}
|
||||
|
||||
public void reset(String name) throws IOException
|
||||
{
|
||||
public void reset(String name) throws IOException {
|
||||
CONFIGURABLE.get(name).resetConfig();
|
||||
}
|
||||
|
||||
public void load(String name, Path path) throws IOException
|
||||
{
|
||||
public void load(String name, Path path) throws IOException {
|
||||
CONFIGURABLE.get(name).loadConfig(path);
|
||||
}
|
||||
|
||||
public void reset(String name, Path path) throws IOException
|
||||
{
|
||||
public void reset(String name, Path path) throws IOException {
|
||||
CONFIGURABLE.get(name).resetConfig(path);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,5 +18,7 @@ public interface Module extends AutoCloseable {
|
|||
|
||||
default void finish(ModuleContext context) {
|
||||
// NOP
|
||||
};
|
||||
}
|
||||
|
||||
;
|
||||
}
|
||||
|
|
|
@ -286,33 +286,32 @@ public void pushOptionalFile(HashedDir dir, boolean digest) {
|
|||
}
|
||||
}
|
||||
|
||||
public void pushOptionalJvmArgs(Collection<String> jvmArgs1)
|
||||
{
|
||||
public void pushOptionalJvmArgs(Collection<String> jvmArgs1) {
|
||||
for (OptionalFile opt : updateOptional) {
|
||||
if (opt.type.equals(OptionalType.JVMARGS) && opt.mark) {
|
||||
jvmArgs1.addAll(Arrays.asList(opt.list));
|
||||
}
|
||||
}
|
||||
}
|
||||
public void pushOptionalClientArgs(Collection<String> clientArgs1)
|
||||
{
|
||||
|
||||
public void pushOptionalClientArgs(Collection<String> clientArgs1) {
|
||||
for (OptionalFile opt : updateOptional) {
|
||||
if (opt.type.equals(OptionalType.CLIENTARGS) && opt.mark) {
|
||||
clientArgs1.addAll(Arrays.asList(opt.list));
|
||||
}
|
||||
}
|
||||
}
|
||||
public void pushOptionalClassPath(pushOptionalClassPathCallback callback) throws IOException
|
||||
{
|
||||
|
||||
public void pushOptionalClassPath(pushOptionalClassPathCallback callback) throws IOException {
|
||||
for (OptionalFile opt : updateOptional) {
|
||||
if (opt.type.equals(OptionalType.CLASSPATH) && opt.mark) {
|
||||
callback.run(opt.list);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface pushOptionalClassPathCallback
|
||||
{
|
||||
public interface pushOptionalClassPathCallback {
|
||||
void run(String[] opt) throws IOException;
|
||||
}
|
||||
|
||||
|
@ -391,20 +390,16 @@ public void verify() {
|
|||
|
||||
// Client launcher
|
||||
VerifyHelper.verify(getTitle(), VerifyHelper.NOT_EMPTY, "Main class can't be empty");
|
||||
for(String s : classPath)
|
||||
{
|
||||
for (String s : classPath) {
|
||||
if (s == null) throw new IllegalArgumentException("Found null entry in classPath");
|
||||
}
|
||||
for(String s : jvmArgs)
|
||||
{
|
||||
for (String s : jvmArgs) {
|
||||
if (s == null) throw new IllegalArgumentException("Found null entry in jvmArgs");
|
||||
}
|
||||
for(String s : clientArgs)
|
||||
{
|
||||
for (String s : clientArgs) {
|
||||
if (s == null) throw new IllegalArgumentException("Found null entry in clientArgs");
|
||||
}
|
||||
for(OptionalFile f : updateOptional)
|
||||
{
|
||||
for (OptionalFile f : updateOptional) {
|
||||
if (f == null) throw new IllegalArgumentException("Found null entry in updateOptional");
|
||||
if (f.name == null) throw new IllegalArgumentException("Optional: name must not be null");
|
||||
if (f.list == null) throw new IllegalArgumentException("Optional: list must not be null");
|
||||
|
|
|
@ -48,31 +48,35 @@ public boolean equals(Object o) {
|
|||
public int hashCode() {
|
||||
return Objects.hash(name);
|
||||
}
|
||||
|
||||
@LauncherAPI
|
||||
public OptionalType getType() {
|
||||
return OptionalType.FILE;
|
||||
}
|
||||
|
||||
@LauncherAPI
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@LauncherAPI
|
||||
public boolean isVisible() {
|
||||
return visible;
|
||||
}
|
||||
|
||||
@LauncherAPI
|
||||
public boolean isMark() {
|
||||
return mark;
|
||||
}
|
||||
|
||||
@LauncherAPI
|
||||
public long getPermissions() {
|
||||
return permissions;
|
||||
}
|
||||
|
||||
@LauncherAPI
|
||||
public void writeType(HOutput output) throws IOException
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
public void writeType(HOutput output) throws IOException {
|
||||
switch (type) {
|
||||
|
||||
case FILE:
|
||||
output.writeInt(1);
|
||||
|
@ -91,13 +95,12 @@ public void writeType(HOutput output) throws IOException
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@LauncherAPI
|
||||
public static OptionalType readType(HInput input) throws IOException
|
||||
{
|
||||
public static OptionalType readType(HInput input) throws IOException {
|
||||
int t = input.readInt();
|
||||
OptionalType type;
|
||||
switch(t)
|
||||
{
|
||||
switch (t) {
|
||||
case 1:
|
||||
type = OptionalType.FILE;
|
||||
break;
|
||||
|
|
|
@ -3,8 +3,7 @@
|
|||
import ru.gravit.launcher.LauncherAPI;
|
||||
|
||||
@LauncherAPI
|
||||
public enum OptionalType
|
||||
{
|
||||
public enum OptionalType {
|
||||
@LauncherAPI
|
||||
FILE,
|
||||
@LauncherAPI
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package ru.gravit.launcher.request;
|
||||
|
||||
import com.google.gson.*;
|
||||
import ru.gravit.launcher.request.ResultInterface;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
|
||||
|
|
|
@ -60,8 +60,7 @@ public static JsonElement jsonRequest(JsonElement request, URL url) throws IOExc
|
|||
reader = new InputStreamReader(connection.getErrorStream(), StandardCharsets.UTF_8);
|
||||
try {
|
||||
return parser.parse(reader);
|
||||
} catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,12 +2,7 @@
|
|||
|
||||
import ru.gravit.launcher.LauncherAPI;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
|
||||
public final class Version {
|
||||
@LauncherAPI
|
||||
|
|
|
@ -76,8 +76,8 @@ public void registerCommand(String name, Command command) {
|
|||
VerifyHelper.putIfAbsent(commands, name.toLowerCase(), Objects.requireNonNull(command, "command"),
|
||||
String.format("Command has been already registered: '%s'", name.toLowerCase()));
|
||||
}
|
||||
public Command unregisterCommand(String name)
|
||||
{
|
||||
|
||||
public Command unregisterCommand(String name) {
|
||||
return commands.remove(name);
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,6 @@ public void run() {
|
|||
}
|
||||
|
||||
|
||||
|
||||
public abstract void bell() throws IOException;
|
||||
|
||||
|
||||
|
@ -103,5 +102,4 @@ public Map<String, Command> commandsMap() {
|
|||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue