Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set Offline username #167

Merged
merged 3 commits into from
Jul 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading