Merge remote-tracking branch 'origin/dev' into fixes

This commit is contained in:
Zaxar163 2019-03-28 11:07:22 +03:00
commit 8e82b3e259
7 changed files with 24 additions and 15 deletions

View file

@ -11,16 +11,16 @@ public class ReconfigurableManager {
private final HashMap<String, Reconfigurable> RECONFIGURABLE = new HashMap<>();
public void registerReconfigurable(String name, Reconfigurable reconfigurable) {
VerifyHelper.putIfAbsent(RECONFIGURABLE, name, Objects.requireNonNull(reconfigurable, "adapter"),
VerifyHelper.putIfAbsent(RECONFIGURABLE, name.toLowerCase(), Objects.requireNonNull(reconfigurable, "adapter"),
String.format("Reloadable has been already registered: '%s'", name));
}
public void printHelp(String name) {
RECONFIGURABLE.get(name).printConfigHelp();
RECONFIGURABLE.get(name.toLowerCase()).printConfigHelp();
}
public void call(String name, String action, String[] args) {
RECONFIGURABLE.get(name).reconfig(action, args);
RECONFIGURABLE.get(name.toLowerCase()).reconfig(action.toLowerCase(), args);
}
public void printReconfigurables() {

View file

@ -11,8 +11,8 @@ public class ReloadManager {
private final HashMap<String, Reloadable> RELOADABLES = new HashMap<>();
public void registerReloadable(String name, Reloadable reloadable) {
VerifyHelper.putIfAbsent(RELOADABLES, name, Objects.requireNonNull(reloadable, "adapter"),
String.format("Reloadable has been already registered: '%s'", name));
VerifyHelper.putIfAbsent(RELOADABLES, name.toLowerCase(), Objects.requireNonNull(reloadable, "adapter"),
String.format("Reloadable has been already registered: '%s'", name.toLowerCase()));
}
public void reloadAll() {
@ -26,7 +26,7 @@ public void reloadAll() {
}
public void reload(String name) throws Exception {
RELOADABLES.get(name).reload();
RELOADABLES.get(name.toLowerCase()).reload();
}
public void printReloadables() {

View file

@ -294,6 +294,7 @@ private static void launch(ClientProfile profile, Params params) throws Throwabl
private static Process process = null;
private static boolean clientStarted = false;
private static Thread writeParamsThread;
@LauncherAPI
public static Process launch(
@ -302,7 +303,11 @@ public static Process launch(
LogHelper.debug("Writing ClientLauncher params");
ClientLauncherContext context = new ClientLauncherContext();
clientStarted = false;
CommonHelper.newThread("Client params writter", true, () ->
if(writeParamsThread != null && writeParamsThread.isAlive())
{
writeParamsThread.interrupt();
}
writeParamsThread = CommonHelper.newThread("Client params writter", true, () ->
{
try {
try (ServerSocket socket = new ServerSocket()) {
@ -331,7 +336,8 @@ public static Process launch(
} catch (IOException e) {
LogHelper.error(e);
}
}).start();
});
writeParamsThread.start();
checkJVMBitsAndVersion();
LogHelper.debug("Resolving JVM binary");
Path javaBin = LauncherGuardManager.getGuardJavaBinPath();
@ -393,6 +399,7 @@ public static Process launch(
{
int exitCode = process.exitValue();
LogHelper.error("Process exit code %d", exitCode);
if(writeParamsThread != null && writeParamsThread.isAlive()) writeParamsThread.interrupt();
break;
}
if(clientStarted)

View file

@ -65,7 +65,8 @@ public void addCustomEnv(ClientLauncherContext context) {
env.put("GUARD_USERNAME", context.playerProfile.username);
env.put("GUARD_PUBLICKEY", config.publicKey.getModulus().toString(16));
env.put("GUARD_PROJECTNAME", config.projectname);
env.put("GUARD_TOKEN", protectToken);
if(protectToken != null)
env.put("GUARD_TOKEN", protectToken);
if(config.guardLicenseName != null)
env.put("GUARD_LICENSE_NAME", config.guardLicenseName);
if(config.guardLicenseKey != null)

View file

@ -59,10 +59,10 @@ public final class Launcher {
private static final Pattern UUID_PATTERN = Pattern.compile("-", Pattern.LITERAL);
public static final int MAJOR = 4;
public static final int MINOR = 4;
public static final int PATCH = 2;
public static final int MINOR = 5;
public static final int PATCH = 1;
public static final int BUILD = 1;
public static final Version.Type RELEASE = Version.Type.STABLE;
public static final Version.Type RELEASE = Version.Type.DEV;
public static GsonBuilder gsonBuilder;
public static Gson gson;

View file

@ -21,6 +21,7 @@ public void eval(String line, boolean bell) {
String[] args;
try {
args = CommonHelper.parseCommand(line);
if(args.length > 0) args[0] = args[0].toLowerCase();
} catch (Exception e) {
LogHelper.error(e);
return;
@ -72,8 +73,8 @@ private void readLoop() throws IOException {
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));
VerifyHelper.putIfAbsent(commands, name.toLowerCase(), Objects.requireNonNull(command, "command"),
String.format("Command has been already registered: '%s'", name.toLowerCase()));
}
@Override

@ -1 +1 @@
Subproject commit eb7d2c33d499ea1a0037679b0a70584c68c40e89
Subproject commit 27773ae6469dd745ba9fb6f18614c0bbe1e23374