Merge branch 'release/4.4.1'

This commit is contained in:
Gravit 2019-03-10 19:07:18 +07:00
commit 9940202d64
No known key found for this signature in database
GPG key ID: 061981E1E85D3216
42 changed files with 562 additions and 315 deletions

View file

@ -18,8 +18,10 @@
bundle bundle
hikari hikari
pack pack
launch4j
launch4jCJ
bundleOnly.extendsFrom bundle bundleOnly.extendsFrom bundle
compile.extendsFrom bundle, hikari, pack compile.extendsFrom bundle, hikari, pack, launch4jCJ, launch4j
} }
jar { jar {
@ -58,7 +60,15 @@ pack project(':libLauncher')
exclude group: 'org.slf4j' exclude group: 'org.slf4j'
} }
compileOnly('net.sf.launch4j:launch4j:3.12') { // need user launch4j('net.sf.launch4j:launch4j:3.12') {
exclude group: '*'
}
launch4jCJ('net.sf.launch4j:launch4j:3.12:workdir-win32') {
exclude group: '*'
}
launch4jCJ('net.sf.launch4j:launch4j:3.12:workdir-linux') {
exclude group: '*' exclude group: '*'
} }
} }
@ -68,16 +78,49 @@ task hikari(type: Copy) {
from configurations.hikari from configurations.hikari
} }
task launch4jM(type: Copy) {
into "$buildDir/libs/libraries/launch4j"
from(configurations.launch4jCJ.collect { it.isDirectory() ? it : zipTree(it) })
includeEmptyDirs false
eachFile { FileCopyDetails fcp ->
if (fcp.relativePath.pathString.startsWith("launch4j-")) {
def segments = fcp.relativePath.segments
def pathSegments = segments[1..-1] as String[]
fcp.relativePath = new RelativePath(!fcp.file.isDirectory(), pathSegments)
fcp.mode = 0755
} else {
fcp.exclude()
}
}
}
task launch4jA(type: Copy) {
into "$buildDir/libs/libraries/launch4j"
from(configurations.launch4j)
includeEmptyDirs false
eachFile { FileCopyDetails fcp ->
if (fcp.name.startsWith("launch4j")) {
fcp.name = "launch4j.jar"
fcp.mode = 0755
} else {
fcp.exclude()
}
}
}
task dumpLibs(type: Copy) { task dumpLibs(type: Copy) {
dependsOn tasks.hikari dependsOn tasks.hikari, tasks.launch4jM, tasks.launch4jA
into "$buildDir/libs/libraries" into "$buildDir/libs/libraries"
from configurations.bundleOnly from configurations.bundleOnly
} }
task dumpClientLibs(type: Copy) { task bundle(type: Zip) {
dependsOn parent.childProjects.Launcher.tasks.build dependsOn parent.childProjects.Launcher.tasks.build, tasks.dumpLibs, tasks.jar
into "$buildDir/libs/launcher-libraries" archiveName 'LaunchServer.zip'
from parent.childProjects.Launcher.tasks.dumpLibs.destinationDir destinationDir file("$buildDir")
from(tasks.dumpLibs.destinationDir) { into 'libraries' }
from tasks.jar.archivePath
from(parent.childProjects.Launcher.tasks.dumpLibs) { into 'launcher-libraries' }
} }
build.dependsOn tasks.dumpLibs, tasks.dumpClientLibs build.dependsOn tasks.dumpLibs, tasks.bundle

View file

@ -18,9 +18,9 @@
import ru.gravit.launchserver.auth.provider.AuthProvider; import ru.gravit.launchserver.auth.provider.AuthProvider;
import ru.gravit.launchserver.auth.provider.RejectAuthProvider; import ru.gravit.launchserver.auth.provider.RejectAuthProvider;
import ru.gravit.launchserver.binary.*; import ru.gravit.launchserver.binary.*;
import ru.gravit.launchserver.command.handler.CommandHandler; import ru.gravit.utils.command.CommandHandler;
import ru.gravit.launchserver.command.handler.JLineCommandHandler; import ru.gravit.utils.command.JLineCommandHandler;
import ru.gravit.launchserver.command.handler.StdCommandHandler; import ru.gravit.utils.command.StdCommandHandler;
import ru.gravit.launchserver.config.*; import ru.gravit.launchserver.config.*;
import ru.gravit.launchserver.manangers.*; import ru.gravit.launchserver.manangers.*;
import ru.gravit.launchserver.manangers.hook.AuthHookManager; import ru.gravit.launchserver.manangers.hook.AuthHookManager;
@ -165,6 +165,10 @@ public void verify() {
if (env == null) { if (env == null) {
throw new NullPointerException("Env must not be null"); throw new NullPointerException("Env must not be null");
} }
if(netty == null)
{
throw new NullPointerException("Netty must not be null");
}
} }
} }
@ -349,12 +353,13 @@ public LaunchServer(Path dir, String[] args) throws IOException, InvalidKeySpecE
Class.forName("jline.Terminal"); Class.forName("jline.Terminal");
// JLine2 available // JLine2 available
localCommandHandler = new JLineCommandHandler(this); localCommandHandler = new JLineCommandHandler();
LogHelper.info("JLine2 terminal enabled"); LogHelper.info("JLine2 terminal enabled");
} catch (ClassNotFoundException ignored) { } catch (ClassNotFoundException ignored) {
localCommandHandler = new StdCommandHandler(this, true); localCommandHandler = new StdCommandHandler(true);
LogHelper.warning("JLine2 isn't in classpath, using std"); LogHelper.warning("JLine2 isn't in classpath, using std");
} }
ru.gravit.launchserver.command.handler.CommandHandler.registerCommands(localCommandHandler);
commandHandler = localCommandHandler; commandHandler = localCommandHandler;
// Set key pair // Set key pair

View file

@ -89,9 +89,9 @@ public synchronized Connection getConnection() throws SQLException {
// Set HikariCP pool // Set HikariCP pool
// Replace source with hds // Replace source with hds
source = new HikariDataSource(cfg); source = new HikariDataSource(cfg);
LogHelper.info("HikariCP pooling enabled for '%s'", poolName); LogHelper.warning("HikariCP pooling enabled for '%s'", poolName);
} catch (ClassNotFoundException ignored) { } catch (ClassNotFoundException ignored) {
LogHelper.warning("HikariCP isn't in classpath for '%s'", poolName); LogHelper.debug("HikariCP isn't in classpath for '%s'", poolName);
} }
} }
return source.getConnection(); return source.getConnection();

View file

@ -36,6 +36,11 @@ public class MysqlHWIDHandler extends HWIDHandler {
private String banMessage; private String banMessage;
private boolean compareMode = false;
//Using queryHWID "queryHwids": "SELECT * FROM `users_hwids` WHERE `totalMemory` = ? or `serialNumber` = ? or `HWDiskSerial` = ? or `processorID` = ?"
private int compare = 50; //При наборе схожести в 50 очков
private boolean oneCompareMode = false;
/* /*
//Добавить поля hwid в базу с пользователями //Добавить поля hwid в базу с пользователями
@ -136,12 +141,31 @@ public void onCheckInfo(OshiHWID hwid, String username, Connection c) throws HWI
a.setString(i + 1, CommonHelper.replace(paramsHwids[i], replaceParams)); a.setString(i + 1, CommonHelper.replace(paramsHwids[i], replaceParams));
} }
ResultSet set = a.executeQuery(); ResultSet set = a.executeQuery();
if (set.next()) { boolean isOne = false;
while(set.next()) {
if(!oneCompareMode) isOne = true;
if(compareMode)
{
OshiHWID db_hwid = new OshiHWID();
db_hwid.serialNumber = set.getString(hwidFieldSerialNumber);
db_hwid.processorID = set.getString(hwidFieldProcessorID);
db_hwid.HWDiskSerial = set.getString(hwidFieldHWDiskSerial);
db_hwid.totalMemory = Long.valueOf(set.getString(hwidFieldTotalMemory));
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
{
LogHelper.debug("User %s hwid check: found compare %d in %d", username, compare_point, set.getInt("id"));
}
}
if(oneCompareMode) isOne = true;
boolean isBanned = set.getBoolean(hwidFieldBanned); boolean isBanned = set.getBoolean(hwidFieldBanned);
if (isBanned) { if (isBanned) {
throw new HWIDException(banMessage); throw new HWIDException(banMessage);
} }
} else { }
if(isOne) {
onUpdateInfo(hwid, username, c); onUpdateInfo(hwid, username, c);
} }
} catch (SQLException e) { } catch (SQLException e) {

View file

@ -36,7 +36,7 @@ public void addModuleClass(String fullName) {
moduleBody.append("();"); moduleBody.append("();");
moduleBody.append("ru.gravit.launcher.Launcher.modulesManager.registerModule( mod"); moduleBody.append("ru.gravit.launcher.Launcher.modulesManager.registerModule( mod");
moduleBody.append(autoincrement); moduleBody.append(autoincrement);
moduleBody.append(" , true );"); moduleBody.append(");");
autoincrement++; autoincrement++;
} }

View file

@ -1,28 +1,12 @@
package ru.gravit.launchserver.command; package ru.gravit.launchserver.command;
import ru.gravit.launchserver.LaunchServer; import ru.gravit.launchserver.LaunchServer;
import ru.gravit.utils.command.CommandException;
import ru.gravit.utils.helper.VerifyHelper; import ru.gravit.utils.helper.VerifyHelper;
import java.util.UUID; import java.util.UUID;
public abstract class Command { public abstract class Command extends ru.gravit.utils.command.Command {
protected static String parseUsername(String username) throws CommandException {
try {
return VerifyHelper.verifyUsername(username);
} catch (IllegalArgumentException e) {
throw new CommandException(e.getMessage());
}
}
protected static UUID parseUUID(String s) throws CommandException {
try {
return UUID.fromString(s);
} catch (IllegalArgumentException ignored) {
throw new CommandException(String.format("Invalid UUID: '%s'", s));
}
}
protected final LaunchServer server; protected final LaunchServer server;
@ -31,19 +15,4 @@ protected static UUID parseUUID(String s) throws CommandException {
protected Command(LaunchServer server) { protected Command(LaunchServer server) {
this.server = server; this.server = server;
} }
public abstract String getArgsDescription(); // "<required> [optional]"
public abstract String getUsageDescription();
public abstract void invoke(String... args) throws Exception;
protected final void verifyArgs(String[] args, int min) throws CommandException {
if (args.length < min)
throw new CommandException("Command usage: " + getArgsDescription());
}
} }

View file

@ -2,7 +2,7 @@
import ru.gravit.launchserver.LaunchServer; import ru.gravit.launchserver.LaunchServer;
import ru.gravit.launchserver.command.Command; import ru.gravit.launchserver.command.Command;
import ru.gravit.launchserver.command.CommandException; import ru.gravit.utils.command.CommandException;
import ru.gravit.utils.helper.LogHelper; import ru.gravit.utils.helper.LogHelper;
import java.io.IOException; import java.io.IOException;

View file

@ -2,7 +2,7 @@
import ru.gravit.launchserver.LaunchServer; import ru.gravit.launchserver.LaunchServer;
import ru.gravit.launchserver.command.Command; import ru.gravit.launchserver.command.Command;
import ru.gravit.launchserver.command.CommandException; import ru.gravit.utils.command.CommandException;
import ru.gravit.utils.helper.LogHelper; import ru.gravit.utils.helper.LogHelper;
import java.io.IOException; import java.io.IOException;

View file

@ -1,13 +1,13 @@
package ru.gravit.launchserver.command.basic; package ru.gravit.launchserver.command.basic;
import ru.gravit.launchserver.LaunchServer; import ru.gravit.launchserver.LaunchServer;
import ru.gravit.launchserver.command.Command; import ru.gravit.utils.command.Command;
import ru.gravit.launchserver.command.CommandException; import ru.gravit.utils.command.CommandException;
import ru.gravit.utils.helper.LogHelper; import ru.gravit.utils.helper.LogHelper;
import java.util.Map.Entry; import java.util.Map.Entry;
public final class HelpCommand extends Command { public final class HelpCommand extends ru.gravit.launchserver.command.Command {
private static void printCommand(String name, Command command) { private static void printCommand(String name, Command command) {
String args = command.getArgsDescription(); String args = command.getArgsDescription();
LogHelper.subInfo("%s %s - %s", name, args == null ? "[nothing]" : args, command.getUsageDescription()); LogHelper.subInfo("%s %s - %s", name, args == null ? "[nothing]" : args, command.getUsageDescription());

View file

@ -2,7 +2,7 @@
import ru.gravit.launchserver.LaunchServer; import ru.gravit.launchserver.LaunchServer;
import ru.gravit.launchserver.command.Command; import ru.gravit.launchserver.command.Command;
import ru.gravit.launchserver.command.CommandException; import ru.gravit.utils.command.CommandException;
import ru.gravit.launchserver.command.auth.*; import ru.gravit.launchserver.command.auth.*;
import ru.gravit.launchserver.command.basic.*; import ru.gravit.launchserver.command.basic.*;
import ru.gravit.launchserver.command.dump.DumpEntryCacheCommand; import ru.gravit.launchserver.command.dump.DumpEntryCacheCommand;
@ -13,6 +13,7 @@
import ru.gravit.launchserver.command.modules.LoadModuleCommand; import ru.gravit.launchserver.command.modules.LoadModuleCommand;
import ru.gravit.launchserver.command.modules.ModulesCommand; import ru.gravit.launchserver.command.modules.ModulesCommand;
import ru.gravit.launchserver.command.service.*; import ru.gravit.launchserver.command.service.*;
import ru.gravit.utils.helper.CommonHelper;
import ru.gravit.utils.helper.LogHelper; import ru.gravit.utils.helper.LogHelper;
import ru.gravit.utils.helper.VerifyHelper; import ru.gravit.utils.helper.VerifyHelper;
@ -22,191 +23,59 @@
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
public abstract class CommandHandler implements Runnable { public abstract class CommandHandler extends ru.gravit.utils.command.CommandHandler {
private static String[] parse(CharSequence line) throws CommandException { public static void registerCommands(ru.gravit.utils.command.CommandHandler handler)
boolean quoted = false; {
boolean wasQuoted = false; LaunchServer server = LaunchServer.server;
// Read line char by char
Collection<String> result = new LinkedList<>();
StringBuilder builder = new StringBuilder(100);
for (int i = 0; i <= line.length(); i++) {
boolean end = i >= line.length();
char ch = end ? '\0' : line.charAt(i);
// Maybe we should read next argument?
if (end || !quoted && Character.isWhitespace(ch)) {
if (end && quoted)
throw new CommandException("Quotes wasn't closed");
// Empty args are ignored (except if was quoted)
if (wasQuoted || builder.length() > 0)
result.add(builder.toString());
// Reset file builder
wasQuoted = false;
builder.setLength(0);
continue;
}
// Append next char
switch (ch) {
case '"': // "abc"de, "abc""de" also allowed
quoted = !quoted;
wasQuoted = true;
break;
case '\\': // All escapes, including spaces etc
if (i + 1 >= line.length())
throw new CommandException("Escape character is not specified");
char next = line.charAt(i + 1);
builder.append(next);
i++;
break;
default: // Default char, simply append
builder.append(ch);
break;
}
}
// Return result as array
return result.toArray(new String[0]);
}
private final Map<String, Command> commands = new ConcurrentHashMap<>(32);
protected CommandHandler(LaunchServer server) {
// Register basic commands // Register basic commands
registerCommand("help", new HelpCommand(server)); handler.registerCommand("help", new HelpCommand(server));
registerCommand("version", new VersionCommand(server)); handler.registerCommand("version", new VersionCommand(server));
registerCommand("build", new BuildCommand(server)); handler.registerCommand("build", new BuildCommand(server));
registerCommand("stop", new StopCommand(server)); handler.registerCommand("stop", new StopCommand(server));
registerCommand("restart", new RestartCommand(server)); handler.registerCommand("restart", new RestartCommand(server));
registerCommand("rebind", new RebindCommand(server)); handler.registerCommand("rebind", new RebindCommand(server));
registerCommand("debug", new DebugCommand(server)); handler.registerCommand("debug", new DebugCommand(server));
registerCommand("clear", new ClearCommand(server)); handler.registerCommand("clear", new ClearCommand(server));
registerCommand("gc", new GCCommand(server)); handler.registerCommand("gc", new GCCommand(server));
registerCommand("proguardClean", new ProguardCleanCommand(server)); handler.registerCommand("proguardClean", new ProguardCleanCommand(server));
registerCommand("proguardDictRegen", new RegenProguardDictCommand(server)); handler.registerCommand("proguardDictRegen", new RegenProguardDictCommand(server));
registerCommand("proguardMappingsRemove", new RemoveMappingsProguardCommand(server)); handler.registerCommand("proguardMappingsRemove", new RemoveMappingsProguardCommand(server));
registerCommand("logConnections", new LogConnectionsCommand(server)); handler.registerCommand("logConnections", new LogConnectionsCommand(server));
registerCommand("loadModule", new LoadModuleCommand(server)); handler.registerCommand("loadModule", new LoadModuleCommand(server));
registerCommand("modules", new ModulesCommand(server)); handler.registerCommand("modules", new ModulesCommand(server));
registerCommand("test", new TestCommand(server)); handler.registerCommand("test", new TestCommand(server));
// Register sync commands // Register sync commands
registerCommand("indexAsset", new IndexAssetCommand(server)); handler.registerCommand("indexAsset", new IndexAssetCommand(server));
registerCommand("unindexAsset", new UnindexAssetCommand(server)); handler.registerCommand("unindexAsset", new UnindexAssetCommand(server));
registerCommand("downloadAsset", new DownloadAssetCommand(server)); handler.registerCommand("downloadAsset", new DownloadAssetCommand(server));
registerCommand("downloadClient", new DownloadClientCommand(server)); handler.registerCommand("downloadClient", new DownloadClientCommand(server));
registerCommand("syncBinaries", new SyncBinariesCommand(server)); handler.registerCommand("syncBinaries", new SyncBinariesCommand(server));
registerCommand("syncUpdates", new SyncUpdatesCommand(server)); handler.registerCommand("syncUpdates", new SyncUpdatesCommand(server));
registerCommand("syncProfiles", new SyncProfilesCommand(server)); handler.registerCommand("syncProfiles", new SyncProfilesCommand(server));
// Register auth commands // Register auth commands
registerCommand("auth", new AuthCommand(server)); handler.registerCommand("auth", new AuthCommand(server));
registerCommand("usernameToUUID", new UsernameToUUIDCommand(server)); handler.registerCommand("usernameToUUID", new UsernameToUUIDCommand(server));
registerCommand("uuidToUsername", new UUIDToUsernameCommand(server)); handler.registerCommand("uuidToUsername", new UUIDToUsernameCommand(server));
registerCommand("ban", new BanCommand(server)); handler.registerCommand("ban", new BanCommand(server));
registerCommand("unban", new UnbanCommand(server)); handler.registerCommand("unban", new UnbanCommand(server));
//Register dump commands //Register dump commands
registerCommand("dumpSessions", new DumpSessionsCommand(server)); handler.registerCommand("dumpSessions", new DumpSessionsCommand(server));
registerCommand("dumpEntryCache", new DumpEntryCacheCommand(server)); handler.registerCommand("dumpEntryCache", new DumpEntryCacheCommand(server));
//Register service commands //Register service commands
registerCommand("reload", new ReloadCommand(server)); handler.registerCommand("reload", new ReloadCommand(server));
registerCommand("reloadAll", new ReloadAllCommand(server)); handler.registerCommand("reloadAll", new ReloadAllCommand(server));
registerCommand("reloadList", new ReloadListCommand(server)); handler.registerCommand("reloadList", new ReloadListCommand(server));
registerCommand("config", new ConfigCommand(server)); handler.registerCommand("config", new ConfigCommand(server));
registerCommand("configHelp", new ConfigHelpCommand(server)); handler.registerCommand("configHelp", new ConfigHelpCommand(server));
registerCommand("configList", new ConfigListCommand(server)); handler.registerCommand("configList", new ConfigListCommand(server));
registerCommand("swapAuthProvider", new SwapAuthProviderCommand(server)); handler.registerCommand("swapAuthProvider", new SwapAuthProviderCommand(server));
registerCommand("serverStatus", new ServerStatusCommand(server)); handler.registerCommand("serverStatus", new ServerStatusCommand(server));
registerCommand("checkInstall", new CheckInstallCommand(server)); handler.registerCommand("checkInstall", new CheckInstallCommand(server));
registerCommand("multi", new MultiCommand(server)); handler.registerCommand("multi", new MultiCommand(server));
registerCommand("getModulus", new GetModulusCommand(server)); handler.registerCommand("getModulus", new GetModulusCommand(server));
}
public abstract void bell() throws IOException;
public abstract void clear() throws IOException;
public final Map<String, Command> commandsMap() {
return Collections.unmodifiableMap(commands);
}
public final void eval(String line, boolean bell) {
LogHelper.info("Command '%s'", line);
// Parse line to tokens
String[] args;
try {
args = parse(line);
} catch (Exception e) {
LogHelper.error(e);
return;
}
// Evaluate command
eval(args, bell);
}
public final void eval(String[] args, boolean bell) {
if (args.length == 0)
return;
// Measure start time and invoke command
Instant startTime = Instant.now();
try {
lookup(args[0]).invoke(Arrays.copyOfRange(args, 1, args.length));
} catch (Exception e) {
LogHelper.error(e);
}
// Bell if invocation took > 1s
Instant endTime = Instant.now();
if (bell && Duration.between(startTime, endTime).getSeconds() >= 5)
try {
bell();
} catch (IOException e) {
LogHelper.error(e);
}
}
public final Command lookup(String name) throws CommandException {
Command command = commands.get(name);
if (command == null)
throw new CommandException(String.format("Unknown command: '%s'", name));
return command;
}
public abstract String readLine() throws IOException;
private void readLoop() throws IOException {
for (String line = readLine(); line != null; line = readLine())
eval(line, true);
}
public final void registerCommand(String name, Command command) {
VerifyHelper.verifyIDName(name);
VerifyHelper.putIfAbsent(commands, name, Objects.requireNonNull(command, "command"),
String.format("Command has been already registered: '%s'", name));
}
@Override
public final void run() {
try {
readLoop();
} catch (IOException e) {
LogHelper.error(e);
}
} }
} }

View file

@ -4,7 +4,7 @@
import ru.gravit.launcher.profiles.ClientProfile.Version; import ru.gravit.launcher.profiles.ClientProfile.Version;
import ru.gravit.launchserver.LaunchServer; import ru.gravit.launchserver.LaunchServer;
import ru.gravit.launchserver.command.Command; import ru.gravit.launchserver.command.Command;
import ru.gravit.launchserver.command.CommandException; import ru.gravit.utils.command.CommandException;
import ru.gravit.utils.HttpDownloader; import ru.gravit.utils.HttpDownloader;
import ru.gravit.utils.helper.IOHelper; import ru.gravit.utils.helper.IOHelper;
import ru.gravit.utils.helper.LogHelper; import ru.gravit.utils.helper.LogHelper;

View file

@ -4,7 +4,7 @@
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
import ru.gravit.launchserver.LaunchServer; import ru.gravit.launchserver.LaunchServer;
import ru.gravit.launchserver.command.Command; import ru.gravit.launchserver.command.Command;
import ru.gravit.launchserver.command.CommandException; import ru.gravit.utils.command.CommandException;
import ru.gravit.utils.helper.IOHelper; import ru.gravit.utils.helper.IOHelper;
import ru.gravit.utils.helper.LogHelper; import ru.gravit.utils.helper.LogHelper;
import ru.gravit.utils.helper.SecurityHelper; import ru.gravit.utils.helper.SecurityHelper;

View file

@ -5,7 +5,7 @@
import com.google.gson.JsonParser; import com.google.gson.JsonParser;
import ru.gravit.launchserver.LaunchServer; import ru.gravit.launchserver.LaunchServer;
import ru.gravit.launchserver.command.Command; import ru.gravit.launchserver.command.Command;
import ru.gravit.launchserver.command.CommandException; import ru.gravit.utils.command.CommandException;
import ru.gravit.utils.helper.IOHelper; import ru.gravit.utils.helper.IOHelper;
import ru.gravit.utils.helper.LogHelper; import ru.gravit.utils.helper.LogHelper;

View file

@ -2,6 +2,7 @@
import ru.gravit.launchserver.LaunchServer; import ru.gravit.launchserver.LaunchServer;
import ru.gravit.launchserver.command.Command; import ru.gravit.launchserver.command.Command;
import ru.gravit.utils.helper.JVMHelper;
import ru.gravit.utils.helper.LogHelper; import ru.gravit.utils.helper.LogHelper;
public class CheckInstallCommand extends Command { public class CheckInstallCommand extends Command {
@ -22,5 +23,6 @@ public String getUsageDescription() {
@Override @Override
public void invoke(String... args) throws Exception { public void invoke(String... args) throws Exception {
LogHelper.info("Check install success"); LogHelper.info("Check install success");
JVMHelper.RUNTIME.exit(0);
} }
} }

View file

@ -130,22 +130,6 @@ public void channelRead0(ChannelHandlerContext ctx, FullHttpRequest request) thr
lastContentFuture = sendFileFuture; lastContentFuture = sendFileFuture;
} }
sendFileFuture.addListener(new ChannelProgressiveFutureListener() {
@Override
public void operationProgressed(ChannelProgressiveFuture future, long progress, long total) {
if (total < 0) { // total unknown
System.err.println(future.channel() + " Transfer progress: " + progress);
} else {
System.err.println(future.channel() + " Transfer progress: " + progress + " / " + total);
}
}
@Override
public void operationComplete(ChannelProgressiveFuture future) {
System.err.println(future.channel() + " Transfer complete.");
}
});
// Decide whether to close the connection or not. // Decide whether to close the connection or not.
if (!HttpUtil.isKeepAlive(request)) { if (!HttpUtil.isKeepAlive(request)) {
lastContentFuture.addListener(new ClosingChannelFutureListener(raf)); lastContentFuture.addListener(new ClosingChannelFutureListener(raf));

View file

@ -28,7 +28,7 @@ public void reply() throws IOException {
debug("Username: %s, Server ID: %s", username, serverID); debug("Username: %s, Server ID: %s", username, serverID);
Client clientData = server.sessionManager.getClient(session); Client clientData = server.sessionManager.getClient(session);
if (!clientData.isAuth || clientData.type != Client.Type.SERVER) { if (!clientData.isAuth || clientData.type != Client.Type.SERVER) {
requestError("Assess denied"); requestError("Access denied");
return; return;
} }
// Try check server with auth handler // Try check server with auth handler

View file

@ -26,7 +26,7 @@ public void reply() throws IOException {
String serverID = VerifyHelper.verifyServerID(input.readASCII(SerializeLimits.MAX_SERVERID)); // With minus sign String serverID = VerifyHelper.verifyServerID(input.readASCII(SerializeLimits.MAX_SERVERID)); // With minus sign
Client clientData = server.sessionManager.getClient(session); Client clientData = server.sessionManager.getClient(session);
if (!clientData.isAuth || clientData.type != Client.Type.USER) { if (!clientData.isAuth || clientData.type != Client.Type.USER) {
requestError("Assess denied"); requestError("Access denied");
return; return;
} }
// Try join server with auth handler // Try join server with auth handler

View file

@ -25,7 +25,7 @@ public void reply() throws IOException {
input.readBoolean(); input.readBoolean();
if (client.type == Client.Type.USER && !client.checkSign) { if (client.type == Client.Type.USER && !client.checkSign) {
LogHelper.warning("User session: %d ip %s try get profiles", session, ip); LogHelper.warning("User session: %d ip %s try get profiles", session, ip);
requestError("Assess denied"); requestError("Access denied");
return; return;
} }
writeNoError(output); writeNoError(output);

View file

@ -39,7 +39,7 @@ public void reply() throws IOException {
} }
Client clientData = server.sessionManager.getClient(session); Client clientData = server.sessionManager.getClient(session);
if (!clientData.isAuth || clientData.type != Client.Type.USER || clientData.profile == null) { if (!clientData.isAuth || clientData.type != Client.Type.USER || clientData.profile == null) {
requestError("Assess denied"); requestError("Access denied");
return; return;
} }
if (!clientData.permissions.canAdmin) { if (!clientData.permissions.canAdmin) {

View file

@ -19,7 +19,7 @@ public String getType() {
@Override @Override
public void execute(WebSocketService service, ChannelHandlerContext ctx, Client client) throws Exception { public void execute(WebSocketService service, ChannelHandlerContext ctx, Client client) throws Exception {
if (!client.isAuth || client.type != Client.Type.USER || client.profile == null) { if (!client.isAuth || client.type != Client.Type.USER || client.profile == null) {
service.sendObject(ctx,new ErrorRequestEvent("Assess denied")); service.sendObject(ctx,new ErrorRequestEvent("Access denied"));
return; return;
} }
if (!client.permissions.canAdmin) { if (!client.permissions.canAdmin) {

View file

@ -0,0 +1,20 @@
String mainClassName = "ru.gravit.launchserver.console.ConsoleMain"
repositories {
maven {
url "http://repo.spring.io/plugins-release/"
}
}
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
jar {
from { configurations.runtime.collect { it.isDirectory() ? it : zipTree(it) } }
manifest.attributes("Main-Class": mainClassName)
}
dependencies {
compileOnly project(':ServerWrapper')
}

View file

@ -0,0 +1,35 @@
package ru.gravit.launchserver.console;
import ru.gravit.launcher.server.ServerWrapper;
import ru.gravit.utils.command.CommandHandler;
import ru.gravit.utils.command.JLineCommandHandler;
import ru.gravit.utils.command.StdCommandHandler;
import ru.gravit.utils.helper.LogHelper;
import java.io.IOException;
public class ConsoleMain {
public static CommandHandler commandHandler;
public static void main(String[] args) throws IOException {
if(ServerWrapper.config == null)
{
LogHelper.warning("ServerWrapper not found");
}
if(!ServerWrapper.permissions.canAdmin)
{
LogHelper.warning("Permission canAdmin not found");
}
try {
Class.forName("jline.Terminal");
// JLine2 available
commandHandler = new RemoteJLineCommandHandler();
LogHelper.info("JLine2 terminal enabled");
} catch (ClassNotFoundException ignored) {
commandHandler = new RemoteStdCommandHandler(true);
LogHelper.warning("JLine2 isn't in classpath, using std");
}
LogHelper.info("CommandHandler started. Use 'exit' to exit this console");
commandHandler.run();
}
}

View file

@ -0,0 +1,24 @@
package ru.gravit.launchserver.console;
import ru.gravit.launcher.request.admin.ExecCommandRequest;
import ru.gravit.utils.command.Command;
import ru.gravit.utils.command.JLineCommandHandler;
import ru.gravit.utils.helper.LogHelper;
import java.io.IOException;
public class RemoteJLineCommandHandler extends JLineCommandHandler {
public RemoteJLineCommandHandler() throws IOException {
}
@Override
public void eval(String line, boolean bell)
{
if(line.equals("exit")) System.exit(0);
ExecCommandRequest request = new ExecCommandRequest(System.out::println, line);
try {
request.request();
} catch (Exception e) {
LogHelper.error(e);
}
}
}

View file

@ -0,0 +1,24 @@
package ru.gravit.launchserver.console;
import ru.gravit.launcher.request.admin.ExecCommandRequest;
import ru.gravit.utils.command.Command;
import ru.gravit.utils.command.CommandHandler;
import ru.gravit.utils.command.StdCommandHandler;
import ru.gravit.utils.helper.LogHelper;
public class RemoteStdCommandHandler extends StdCommandHandler {
public RemoteStdCommandHandler(boolean readCommands) {
super(readCommands);
}
@Override
public void eval(String line, boolean bell)
{
if(line.equals("exit")) System.exit(0);
ExecCommandRequest request = new ExecCommandRequest(System.out::println, line);
try {
request.request();
} catch (Exception e) {
LogHelper.error(e);
}
}
}

View file

@ -44,9 +44,9 @@ public static void main(String[] arguments) throws IOException, InterruptedExcep
if (!process.isAlive()) { if (!process.isAlive()) {
int errorcode = process.exitValue(); int errorcode = process.exitValue();
if (errorcode != 0) if (errorcode != 0)
LogHelper.error("Process exit witch error code: %d", errorcode); LogHelper.error("Process exit with error code: %d", errorcode);
else else
LogHelper.info("Process exit witch code 0"); LogHelper.info("Process exit with code 0");
} else { } else {
LogHelper.debug("Process started success"); LogHelper.debug("Process started success");
} }

View file

@ -62,6 +62,29 @@ public String getHWDisk() {
} }
} }
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())
{
if(ipv4.startsWith("127.")) continue;
if(ipv4.startsWith("10.")) continue;
return networkIF.getMacaddr();
}
}
return "";
}
public long getTotalMemory() { public long getTotalMemory() {
if (noHWID) return -1; if (noHWID) return -1;
if (hardware == null) hardware = systemInfo.getHardware(); if (hardware == null) hardware = systemInfo.getHardware();
@ -85,6 +108,20 @@ public void printHardwareInformation() {
for (UsbDevice s : hardware.getUsbDevices(true)) { for (UsbDevice s : hardware.getUsbDevices(true)) {
LogHelper.debug("USBDevice Serial: %s Name: %s", s.getSerialNumber(), s.getName()); LogHelper.debug("USBDevice Serial: %s Name: %s", s.getSerialNumber(), s.getName());
} }
for(NetworkIF networkIF : hardware.getNetworkIFs())
{
LogHelper.debug("Network Interface: %s mac: %s", networkIF.getName(), networkIF.getMacaddr());
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())
{
LogHelper.debug("SoundCard %s", soundcard.getName());
}
CentralProcessor processor = hardware.getProcessor(); CentralProcessor processor = hardware.getProcessor();
LogHelper.debug("Processor Model: %s ID: %s", processor.getModel(), processor.getProcessorID()); LogHelper.debug("Processor Model: %s ID: %s", processor.getModel(), processor.getProcessorID());
} catch (Throwable e) { } catch (Throwable e) {
@ -100,6 +137,7 @@ public HWID getHWID() {
hwid.totalMemory = getTotalMemory(); hwid.totalMemory = getTotalMemory();
hwid.HWDiskSerial = getHWDisk(); hwid.HWDiskSerial = getHWDisk();
hwid.processorID = getProcessorID(); hwid.processorID = getProcessorID();
hwid.macAddr = getMacAddr();
printHardwareInformation(); printHardwareInformation();
return hwid; return hwid;
} }

View file

@ -3,5 +3,6 @@
dependencies { dependencies {
compileOnly 'org.fusesource.jansi:jansi:1.17.1' compileOnly 'org.fusesource.jansi:jansi:1.17.1'
compileOnly 'jline:jline:2.14.6'
compile 'com.google.code.gson:gson:2.8.5' compile 'com.google.code.gson:gson:2.8.5'
} }

View file

@ -5,5 +5,7 @@ public interface HWID {
int getLevel(); //Уровень доверия, насколько уникальные значения int getLevel(); //Уровень доверия, насколько уникальные значения
int compare(HWID hwid);
boolean isNull(); boolean isNull();
} }

View file

@ -60,7 +60,7 @@ public final class Launcher {
private static final Pattern UUID_PATTERN = Pattern.compile("-", Pattern.LITERAL); private static final Pattern UUID_PATTERN = Pattern.compile("-", Pattern.LITERAL);
public static final int MAJOR = 4; public static final int MAJOR = 4;
public static final int MINOR = 4; public static final int MINOR = 4;
public static final int PATCH = 0; public static final int PATCH = 1;
public static final int BUILD = 1; public static final int BUILD = 1;
public static final Version.Type RELEASE = Version.Type.STABLE; public static final Version.Type RELEASE = Version.Type.STABLE;
public static GsonBuilder gsonBuilder; public static GsonBuilder gsonBuilder;

View file

@ -12,6 +12,8 @@ public class OshiHWID implements HWID {
public String HWDiskSerial; public String HWDiskSerial;
@LauncherAPI @LauncherAPI
public String processorID; public String processorID;
@LauncherAPI
public String macAddr;
@Override @Override
public String getSerializeString() { public String getSerializeString() {
@ -22,15 +24,33 @@ public String getSerializeString() {
public int getLevel() //Уровень доверия, насколько уникальные значения public int getLevel() //Уровень доверия, насколько уникальные значения
{ {
int result = 0; int result = 0;
if (totalMemory != 0) result++; if (totalMemory != 0) result+=8;
if (serialNumber != null && !serialNumber.equals("unknown")) result += 4; if (serialNumber != null && !serialNumber.equals("unknown")) result += 12;
if (HWDiskSerial != null && !HWDiskSerial.equals("unknown")) result += 15; if (HWDiskSerial != null && !HWDiskSerial.equals("unknown")) result += 30;
if (processorID != null && !processorID.equals("unknown")) result += 6; if (processorID != null && !processorID.equals("unknown")) result += 10;
if (macAddr != null && !macAddr.equals("00:00:00:00:00:00")) result += 15;
return result; return result;
} }
@Override
public int compare(HWID hwid) {
if(hwid instanceof OshiHWID)
{
int rate = 0;
OshiHWID oshi = (OshiHWID) hwid;
if(Math.abs(oshi.totalMemory - totalMemory) < 1024*1024) rate+=5;
if(oshi.totalMemory == totalMemory) rate+=15;
if(oshi.HWDiskSerial.equals(HWDiskSerial)) rate+=45;
if(oshi.processorID.equals(processorID)) rate+=18;
if(oshi.serialNumber.equals(serialNumber)) rate+=15;
if(oshi.macAddr.equals(macAddr)) rate+=19;
return rate;
}
return 0;
}
@Override @Override
public boolean isNull() { public boolean isNull() {
return getLevel() < 2; return getLevel() < 15;
} }
} }

View file

@ -132,7 +132,7 @@ public void printModules() {
@Override @Override
public void registerModule(Module module) { public void registerModule(Module module) {
load(module); modules.add(module);
LogHelper.info("Module %s version: %s registered", module.getName(), module.getVersion()); LogHelper.info("Module %s version: %s registered", module.getName(), module.getVersion());
} }

View file

@ -391,6 +391,24 @@ public void verify() {
// Client launcher // Client launcher
VerifyHelper.verify(getTitle(), VerifyHelper.NOT_EMPTY, "Main class can't be empty"); VerifyHelper.verify(getTitle(), VerifyHelper.NOT_EMPTY, "Main class can't be empty");
for(String s : classPath)
{
if(s == null) throw new IllegalArgumentException("Found null entry in classPath");
}
for(String s : jvmArgs)
{
if(s == null) throw new IllegalArgumentException("Found null entry in jvmArgs");
}
for(String s : clientArgs)
{
if(s == null) throw new IllegalArgumentException("Found null entry in clientArgs");
}
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");
}
} }
@Override @Override

View file

@ -0,0 +1,40 @@
package ru.gravit.utils.command;
import ru.gravit.utils.helper.VerifyHelper;
import java.util.UUID;
public abstract class Command {
protected static String parseUsername(String username) throws CommandException {
try {
return VerifyHelper.verifyUsername(username);
} catch (IllegalArgumentException e) {
throw new CommandException(e.getMessage());
}
}
protected static UUID parseUUID(String s) throws CommandException {
try {
return UUID.fromString(s);
} catch (IllegalArgumentException ignored) {
throw new CommandException(String.format("Invalid UUID: '%s'", s));
}
}
public abstract String getArgsDescription(); // "<required> [optional]"
public abstract String getUsageDescription();
public abstract void invoke(String... args) throws Exception;
protected final void verifyArgs(String[] args, int min) throws CommandException {
if (args.length < min)
throw new CommandException("Command usage: " + getArgsDescription());
}
}

View file

@ -1,4 +1,4 @@
package ru.gravit.launchserver.command; package ru.gravit.utils.command;
public final class CommandException extends Exception { public final class CommandException extends Exception {
private static final long serialVersionUID = -6588814993972117772L; private static final long serialVersionUID = -6588814993972117772L;

View file

@ -0,0 +1,104 @@
package ru.gravit.utils.command;
import ru.gravit.utils.helper.CommonHelper;
import ru.gravit.utils.helper.LogHelper;
import ru.gravit.utils.helper.VerifyHelper;
import java.io.IOException;
import java.time.Duration;
import java.time.Instant;
import java.util.Arrays;
import java.util.Collections;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
public abstract class CommandHandler implements Runnable {
private final Map<String, Command> commands = new ConcurrentHashMap<>(32);
public void eval(String line, boolean bell) {
LogHelper.info("Command '%s'", line);
// Parse line to tokens
String[] args;
try {
args = CommonHelper.parseCommand(line);
} catch (Exception e) {
LogHelper.error(e);
return;
}
// Evaluate command
eval(args, bell);
}
public void eval(String[] args, boolean bell) {
if (args.length == 0)
return;
// Measure start time and invoke command
Instant startTime = Instant.now();
try {
lookup(args[0]).invoke(Arrays.copyOfRange(args, 1, args.length));
} catch (Exception e) {
LogHelper.error(e);
}
// Bell if invocation took > 1s
Instant endTime = Instant.now();
if (bell && Duration.between(startTime, endTime).getSeconds() >= 5)
try {
bell();
} catch (IOException e) {
LogHelper.error(e);
}
}
public Command lookup(String name) throws CommandException {
Command command = commands.get(name);
if (command == null)
throw new CommandException(String.format("Unknown command: '%s'", name));
return command;
}
public abstract String readLine() throws IOException;
private void readLoop() throws IOException {
for (String line = readLine(); line != null; line = readLine())
eval(line, true);
}
public void registerCommand(String name, Command command) {
VerifyHelper.verifyIDName(name);
VerifyHelper.putIfAbsent(commands, name, Objects.requireNonNull(command, "command"),
String.format("Command has been already registered: '%s'", name));
}
@Override
public void run() {
try {
readLoop();
} catch (IOException e) {
LogHelper.error(e);
}
}
public abstract void bell() throws IOException;
public abstract void clear() throws IOException;
public Map<String, Command> commandsMap() {
return Collections.unmodifiableMap(commands);
}
}

View file

@ -1,13 +1,12 @@
package ru.gravit.launchserver.command.handler; package ru.gravit.utils.command;
import jline.console.ConsoleReader; import jline.console.ConsoleReader;
import ru.gravit.launchserver.LaunchServer;
import ru.gravit.utils.helper.LogHelper; import ru.gravit.utils.helper.LogHelper;
import ru.gravit.utils.helper.LogHelper.Output; import ru.gravit.utils.helper.LogHelper.Output;
import java.io.IOException; import java.io.IOException;
public final class JLineCommandHandler extends CommandHandler { public class JLineCommandHandler extends CommandHandler {
private final class JLineOutput implements Output { private final class JLineOutput implements Output {
@Override @Override
public void println(String message) { public void println(String message) {
@ -23,8 +22,8 @@ public void println(String message) {
private final ConsoleReader reader; private final ConsoleReader reader;
public JLineCommandHandler(LaunchServer server) throws IOException { public JLineCommandHandler() throws IOException {
super(server); super();
// Set reader // Set reader
reader = new ConsoleReader(); reader = new ConsoleReader();

View file

@ -1,16 +1,15 @@
package ru.gravit.launchserver.command.handler; package ru.gravit.utils.command;
import ru.gravit.launchserver.LaunchServer;
import ru.gravit.utils.helper.IOHelper; import ru.gravit.utils.helper.IOHelper;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;
public final class StdCommandHandler extends CommandHandler { public class StdCommandHandler extends CommandHandler {
private final BufferedReader reader; private final BufferedReader reader;
public StdCommandHandler(LaunchServer server, boolean readCommands) { public StdCommandHandler(boolean readCommands) {
super(server); super();
reader = readCommands ? IOHelper.newReader(System.in) : null; reader = readCommands ? IOHelper.newReader(System.in) : null;
} }

View file

@ -39,6 +39,8 @@ public interface Handler {
private final int skip; private final int skip;
private final Handler handler; private final Handler handler;
private HttpURLConnection connect = null;
public Downloader(URL url, File file) { public Downloader(URL url, File file) {
this.requestProps = new HashMap<>(requestClient); this.requestProps = new HashMap<>(requestClient);
this.file = file; this.file = file;
@ -128,6 +130,7 @@ public void downloadFile() throws IOException {
interrupted.set(false); interrupted.set(false);
if (url.getProtocol().equalsIgnoreCase("http")) { if (url.getProtocol().equalsIgnoreCase("http")) {
HttpURLConnection connect = (HttpURLConnection) (url).openConnection(); HttpURLConnection connect = (HttpURLConnection) (url).openConnection();
this.connect = connect;
if (method != null) connect.setRequestMethod(method); if (method != null) connect.setRequestMethod(method);
for (Map.Entry<String, String> ent : requestProps.entrySet()) { for (Map.Entry<String, String> ent : requestProps.entrySet()) {
connect.setRequestProperty(ent.getKey(), ent.getValue()); connect.setRequestProperty(ent.getKey(), ent.getValue());
@ -158,6 +161,7 @@ public void downloadFile() throws IOException {
} }
} else { } else {
HttpsURLConnection connect = (HttpsURLConnection) (url).openConnection(); HttpsURLConnection connect = (HttpsURLConnection) (url).openConnection();
this.connect = connect;
if (method != null) connect.setRequestMethod(method); if (method != null) connect.setRequestMethod(method);
for (Map.Entry<String, String> ent : requestProps.entrySet()) { for (Map.Entry<String, String> ent : requestProps.entrySet()) {
connect.setRequestProperty(ent.getKey(), ent.getValue()); connect.setRequestProperty(ent.getKey(), ent.getValue());
@ -200,5 +204,9 @@ public void run() {
this.ex.set(ex); this.ex.set(ex);
LogHelper.error(ex); LogHelper.error(ex);
} }
if (connect != null)
try {
connect.disconnect();
} catch (Throwable ignored) { }
} }
} }

View file

@ -1,34 +0,0 @@
package ru.gravit.utils.downloader;
import java.io.File;
import java.net.URL;
public class DownloadingThread extends Thread {
private final Downloader runnable;
public DownloadingThread(File file, URL url, String name) {
super(name);
runnable = new Downloader(url, file);
}
public Downloader getDownloader() {
return runnable;
}
@Override
public void interrupt() {
runnable.interrupt.set(true);
while (!runnable.interrupted.get()) {
}
super.interrupt();
}
public void hardInterrupt() {
super.interrupt();
}
@Override
public void run() {
runnable.run();
}
}

View file

@ -1,10 +1,13 @@
package ru.gravit.utils.helper; package ru.gravit.utils.helper;
import ru.gravit.launcher.LauncherAPI; import ru.gravit.launcher.LauncherAPI;
import ru.gravit.utils.command.CommandException;
import javax.script.ScriptEngine; import javax.script.ScriptEngine;
import javax.script.ScriptEngineFactory; import javax.script.ScriptEngineFactory;
import javax.script.ScriptEngineManager; import javax.script.ScriptEngineManager;
import java.util.Collection;
import java.util.LinkedList;
import java.util.Locale; import java.util.Locale;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
@ -68,4 +71,53 @@ public static String replace(String source, String... params) {
private CommonHelper() { private CommonHelper() {
} }
public static String[] parseCommand(CharSequence line) throws CommandException {
boolean quoted = false;
boolean wasQuoted = false;
// Read line char by char
Collection<String> result = new LinkedList<>();
StringBuilder builder = new StringBuilder(100);
for (int i = 0; i <= line.length(); i++) {
boolean end = i >= line.length();
char ch = end ? '\0' : line.charAt(i);
// Maybe we should read next argument?
if (end || !quoted && Character.isWhitespace(ch)) {
if (end && quoted)
throw new CommandException("Quotes wasn't closed");
// Empty args are ignored (except if was quoted)
if (wasQuoted || builder.length() > 0)
result.add(builder.toString());
// Reset file builder
wasQuoted = false;
builder.setLength(0);
continue;
}
// Append next char
switch (ch) {
case '"': // "abc"de, "abc""de" also allowed
quoted = !quoted;
wasQuoted = true;
break;
case '\\': // All escapes, including spaces etc
if (i + 1 >= line.length())
throw new CommandException("Escape character is not specified");
char next = line.charAt(i + 1);
builder.append(next);
i++;
break;
default: // Default char, simply append
builder.append(ch);
break;
}
}
// Return result as array
return result.toArray(new String[0]);
}
} }

@ -1 +1 @@
Subproject commit d4320ce29b8a142a75b86237139e92a72e00b481 Subproject commit b7fbe50c08a3e274aadb93292fed6d05918647b3

View file

@ -5,6 +5,7 @@
include 'LauncherAPI' include 'LauncherAPI'
include 'ServerWrapper' include 'ServerWrapper'
include 'LaunchServer' include 'LaunchServer'
include 'LaunchServerConsole'
include 'modules' include 'modules'
file('modules').eachDir { sub -> file('modules').eachDir { sub ->
if (sub.name.endsWith('_module')) include 'modules:' + sub.name if (sub.name.endsWith('_module')) include 'modules:' + sub.name