Minecraft implementation (#6)

* Initial minecraft support

* Made previews_chat an option

* Better error handling and removed version structure

* Minecraft Server types

* Fixed compilation and renamed stuff

* 'extract till you drop!' extracted sockets

* extracted java version and fixed socket udp receive

* Legacy 1.4 and 1.6 implementation (incomplete)

* Furter implementation

* Implementations work

* Protocol beta v1.8+ implemented

* Removed bedrock support

* Added auto query

* Renamed minecraft to mc and added to md's

* Docs, renames and small optimization changes

* Changed java version to be able to return None on players sample
This commit is contained in:
CosminPerRam 2022-11-24 22:52:54 +02:00 committed by GitHub
parent 974e093e23
commit ee0223a7a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 810 additions and 80 deletions

View file

@ -1,6 +1,7 @@
use std::env;
use gamedig::{aliens, asrd, cscz, csgo, css, dod, dods, GDResult, gm, hl2dm, ins, insmic, inss, l4d, l4d2, tf2, ts};
use gamedig::{aliens, asrd, cscz, csgo, css, dod, dods, GDResult, gm, hl2dm, ins, insmic, inss, l4d, l4d2, mc, tf2, ts};
use gamedig::protocols::minecraft::{LegacyGroup, Server};
use gamedig::protocols::valve;
use gamedig::protocols::valve::App;
@ -41,6 +42,11 @@ fn main() -> GDResult<()> {
"ts" => println!("{:?}", ts::query(ip, port)?),
"cscz" => println!("{:?}", cscz::query(ip, port)?),
"dod" => println!("{:?}", dod::query(ip, port)?),
"mc" => println!("{:?}", mc::query(ip, port)?),
"mc_java" => println!("{:?}", mc::query_specific(Server::Java, ip, port)?),
"mc_legacy_v1_4" => println!("{:?}", mc::query_specific(Server::Legacy(LegacyGroup::V1_4), ip, port)?),
"mc_legacy_v1_6" => println!("{:?}", mc::query_specific(Server::Legacy(LegacyGroup::V1_6), ip, port)?),
"mc_legacy_vb1_8" => println!("{:?}", mc::query_specific(Server::Legacy(LegacyGroup::VB1_8), ip, port)?),
"_src" => println!("{:?}", valve::query(ip, 27015, App::Source(None), None, None)?),
"_gld" => println!("{:?}", valve::query(ip, 27015, App::GoldSrc(false), None, None)?),
"_gld_f" => println!("{:?}", valve::query(ip, 27015, App::GoldSrc(true), None, None)?),

10
examples/minecraft.rs Normal file
View file

@ -0,0 +1,10 @@
use gamedig::games::mc;
fn main() {
let response = mc::query("localhost", None); //or Some(25565), None is the default protocol port (which is 25565)
match response {
Err(error) => println!("Couldn't query, error: {error}"),
Ok(r) => println!("{:?}", r)
}
}