Skip to content

Commit 3e96d2e

Browse files
authored
Add --username option to set offline username (#290)
1 parent 50befb5 commit 3e96d2e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/main.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,10 @@ struct Opt {
170170
#[structopt(short = "s", long = "server")]
171171
server: Option<String>,
172172

173+
/// Username for offline servers
174+
#[structopt(short = "u", long = "username")]
175+
username: Option<String>,
176+
173177
/// Log decoded packets received from network
174178
#[structopt(short = "n", long = "network-debug")]
175179
network_debug: bool,
@@ -267,6 +271,10 @@ fn main2() {
267271
}
268272
}
269273

274+
if let Some(username) = opt.username{
275+
vars.set(auth::CL_USERNAME, username);
276+
}
277+
270278
let textures = renderer.get_textures();
271279
let dpi_factor = window.window().current_monitor().hidpi_factor();
272280
let default_protocol_version = protocol::versions::protocol_name_to_protocol_version(

0 commit comments

Comments
 (0)