mirror of
https://github.com/tribufu/rust-gamedig
synced 2026-06-01 09:42:41 +00:00
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:
parent
974e093e23
commit
ee0223a7a3
23 changed files with 810 additions and 80 deletions
|
|
@ -2,6 +2,7 @@ use std::time::Duration;
|
|||
use crate::{GDError, GDResult};
|
||||
|
||||
/// Timeout settings for socket operations
|
||||
#[derive(Clone)]
|
||||
pub struct TimeoutSettings {
|
||||
read: Option<Duration>,
|
||||
write: Option<Duration>
|
||||
|
|
@ -12,13 +13,13 @@ impl TimeoutSettings {
|
|||
pub fn new(read: Option<Duration>, write: Option<Duration>) -> GDResult<Self> {
|
||||
if let Some(read_duration) = read {
|
||||
if read_duration == Duration::new(0, 0) {
|
||||
return Err(GDError::InvalidInput("Can't pass duration 0 to timeout settings".to_owned()))
|
||||
return Err(GDError::InvalidInput("Can't pass duration 0 to timeout settings".to_string()))
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(write_duration) = write {
|
||||
if write_duration == Duration::new(0, 0) {
|
||||
return Err(GDError::InvalidInput("Can't pass duration 0 to timeout settings".to_owned()))
|
||||
return Err(GDError::InvalidInput("Can't pass duration 0 to timeout settings".to_string()))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue