Skip to content

Commit

Permalink
Merge pull request #167 from 3arthqu4ke/1.11
Browse files Browse the repository at this point in the history
Set Offline username
  • Loading branch information
3arthqu4ke authored Jul 28, 2024
2 parents 61bd902 + c5118c7 commit 8362acd
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,16 @@ public interface LauncherProperties extends HmcProperties {
Property<String> PROFILE_PROPERTIES = string("hmc.profileproperties");

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");

Property<Boolean> OFFLINE = bool("hmc.offline");
Property<String> OFFLINE_USERNAME = string("hmc.offline.username");
Property<String> OFFLINE_UUID = string("hmc.offline.uuid");
Property<String> OFFLINE_TOKEN = string("hmc.offline.token");
Property<String> OFFLINE_REFRESH_TOKEN = string("hmc.offline.refresh.token");
Property<String> OFFLINE_XUID = string("hmc.offline.xuid");
Property<String> OFFLINE_CLIENT_ID = string("hmc.offline.client.id");

// TODO: also check hashes for the libraries?
Property<Long> ASSETS_DELAY = number("hmc.assets.delay");
Property<Long> ASSETS_RETRIES = number("hmc.assets.retries");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,13 @@ public Account login(Config config) throws AuthException {
}

if (offlineChecker.isOffline()) {
return new Account("Offline", OFFLINE_UUID, "", "", "", "");
return new Account(
config.get(LauncherProperties.OFFLINE_USERNAME, "Offline"),
config.get(LauncherProperties.OFFLINE_UUID, OFFLINE_UUID),
config.get(LauncherProperties.OFFLINE_TOKEN, ""),
config.get(LauncherProperties.OFFLINE_REFRESH_TOKEN, ""),
config.get(LauncherProperties.OFFLINE_XUID, ""),
config.get(LauncherProperties.OFFLINE_CLIENT_ID, ""));
}

log.warning("No valid account found!");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import lombok.RequiredArgsConstructor;
import lombok.val;
import lombok.var;
import me.earth.headlessmc.api.command.CommandException;
import me.earth.headlessmc.launcher.Launcher;
import me.earth.headlessmc.launcher.files.FileManager;
import me.earth.headlessmc.launcher.instrumentation.ResourceExtractor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import lombok.CustomLog;
import lombok.RequiredArgsConstructor;
import me.earth.headlessmc.api.config.HasConfig;
import me.earth.headlessmc.launcher.Main;
import me.earth.headlessmc.launcher.auth.AuthException;
import me.earth.headlessmc.launcher.files.FileManager;
import me.earth.headlessmc.launcher.os.OS;
Expand Down

0 comments on commit 8362acd

Please sign in to comment.