Skip to content

Commit

Permalink
Merge pull request #133 from 3arthqu4ke/1.9.2
Browse files Browse the repository at this point in the history
1.9.2
  • Loading branch information
3arthqu4ke authored Apr 1, 2024
2 parents fe6f8ca + a737289 commit 7b64773
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 13 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
project_version=1.9.1
project_version=1.9.2
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@
package me.earth.headlessmc.command;

import lombok.RequiredArgsConstructor;
import lombok.experimental.Delegate;
import lombok.val;
import me.earth.headlessmc.api.HeadlessMc;
import me.earth.headlessmc.api.command.Command;
import me.earth.headlessmc.api.command.CommandContext;
import me.earth.headlessmc.api.command.CommandException;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.*;

import static me.earth.headlessmc.command.CommandUtil.levenshtein;

@RequiredArgsConstructor
@SuppressWarnings({"unchecked", "RedundantSuppression"}) // delegate
public class CommandContextImpl implements CommandContext {
@Delegate(types = Iterable.class)
protected final List<Command> commands = new ArrayList<>();
protected final HeadlessMc log;

Expand Down Expand Up @@ -72,4 +67,9 @@ protected void fail(String... args) {
}
}

@Override
public Iterator<Command> iterator() {
return commands.iterator();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
@Getter
@RequiredArgsConstructor
public class Launcher implements HeadlessMc {
public static final String VERSION = "1.9.1";
public static final String VERSION = "1.9.2";

@Delegate
private final HeadlessMc headlessMc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,6 @@ public interface LauncherProperties extends HmcProperties {

Property<String> FABRIC_URL = string("hmc.fabric.url");
Property<Boolean> OFFLINE = bool("hmc.offline");
Property<Boolean> RE_THROW_LAUNCH_EXCEPTIONS = bool("hmc.rethrow.launch.exceptions");

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class AccountManager implements Iterable<Account> {
private final Map<Integer, Account> cache = new ConcurrentHashMap<>();
private final AccountStore accountStore;
private final AccountValidator validator;
@Getter
private final OfflineChecker offlineChecker;
@Getter
private Account lastAccount;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import java.io.IOException;
import java.util.UUID;

import static me.earth.headlessmc.launcher.LauncherProperties.RE_THROW_LAUNCH_EXCEPTIONS;

@CustomLog
public class LaunchCommand extends AbstractVersionCommand {
public LaunchCommand(Launcher launcher) {
Expand Down Expand Up @@ -70,6 +72,9 @@ public void execute(Version version, String... args)
e.printStackTrace();
ctx.log(String.format(
"Couldn't launch %s: %s", version.getName(), e.getMessage()));
if (ctx.getConfig().get(RE_THROW_LAUNCH_EXCEPTIONS, false)) {
throw new RuntimeException(e);
}
} catch (Throwable t) {
val msg = String.format(
"Couldn't launch %s: %s", version.getName(), t.getMessage());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ private LaunchOptionsBuilder() {
public LaunchOptionsBuilder parseFlags(
Launcher ctx, boolean quit, String... args) {
return this
.runtime(CommandUtil.hasFlag("-commands", args))
.lwjgl(flag(ctx, "-lwjgl", INVERT_LWJGL_FLAG, args))
.runtime(CommandUtil.hasFlag("-commands", args)) // if offline only allow launching with the lwjgl flag!
.lwjgl(flag(ctx, "-lwjgl", INVERT_LWJGL_FLAG, args) || launcher.getAccountManager().getOfflineChecker().isOffline())
.jndi(flag(ctx, "-jndi", INVERT_JNDI_FLAG, args))
.lookup(flag(ctx, "-lookup", INVERT_LOOKUP_FLAG, args))
.paulscode(flag(ctx, "-paulscode", INVERT_PAULS_FLAG, args))
Expand Down
2 changes: 1 addition & 1 deletion headlessmc-scripts/hmc
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/usr/bin/env sh
java -jar headlessmc-launcher-1.9.1.jar --command $@
java -jar headlessmc-launcher-1.9.2.jar --command $@
2 changes: 1 addition & 1 deletion headlessmc-scripts/hmc.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
@echo off
"%JAVA_HOME%\bin\java" -jar headlessmc-launcher-1.9.1.jar --command %*
"%JAVA_HOME%\bin\java" -jar headlessmc-launcher-1.9.2.jar --command %*
2 changes: 1 addition & 1 deletion headlessmc-scripts/hmw
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash
# when running in docker on windows bash seems to be at /bin/bash TODO: can we make this one script?
java -jar headlessmc-launcher-1.9.1.jar --command $@
java -jar headlessmc-launcher-1.9.2.jar --command $@

0 comments on commit 7b64773

Please sign in to comment.