Handle older/newer Clients

This commit is contained in:
Snowiiii committed 2024-08-13 13:05:04 +02:00
1 parent 32a172f3c0
commit c5612f6ddb
4 files changed
+30 -13

No files matched your search

+15 -8
View File
@@ -17,7 +17,10 @@ impl<'a> Command<'a> for GamemodeCommand {
let args: Vec<&str> = command.split_whitespace().collect();
if args.len() != 2 {
player.send_system_message(TextComponent::from("Usage: /gamemode <mode>").color_named(pumpkin_text::color::NamedColor::Red));
player.send_system_message(
TextComponent::from("Usage: /gamemode <mode>")
.color_named(pumpkin_text::color::NamedColor::Red),
);
return;
}
@@ -33,16 +36,20 @@ impl<'a> Command<'a> for GamemodeCommand {
Ok(i) => match GameMode::from_u8(i) {
Some(mode) => {
player.set_gamemode(mode);
player.send_system_message(format!("Set own game mode to {:?}", mode).into());
player.send_system_message(
format!("Set own game mode to {:?}", mode).into(),
);
return;
},
None => {},
}
None => {}
},
Err(_) => {},
Err(_) => {}
}
player.send_system_message(TextComponent::from("Invalid gamemode").color_named(pumpkin_text::color::NamedColor::Red));
player.send_system_message(
TextComponent::from("Invalid gamemode")
.color_named(pumpkin_text::color::NamedColor::Red),
);
}
}
}