Merge pull request #5 from Unary-Byte-Software/issue-1

Add new things from #1
This commit is contained in:
Garen Tyler 2020-07-09 11:02:35 -06:00 committed by GitHub
commit e9e0dc6b91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 156 additions and 67 deletions

2
.gitignore vendored
View File

@ -1,3 +1,3 @@
target/
log.txt
.DS_Store
log.txt

24
Cargo.lock generated
View File

@ -4,10 +4,12 @@
name = "Composition"
version = "0.1.0"
dependencies = [
"base64",
"chrono",
"colorful",
"lazy_static",
"ozelot",
"radix64",
"serde",
"toml",
]
@ -33,6 +35,12 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "567b077b825e468cc974f0020d4082ee6e03132512f207ef1a02fd5d00d1f32d"
[[package]]
name = "arrayref"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544"
[[package]]
name = "autocfg"
version = "1.0.0"
@ -53,6 +61,12 @@ dependencies = [
"rustc-demangle",
]
[[package]]
name = "base64"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff"
[[package]]
name = "bitflags"
version = "1.2.1"
@ -329,6 +343,16 @@ dependencies = [
"proc-macro2",
]
[[package]]
name = "radix64"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d22a338c2456e0b6ca64681985cbc1b60a50473474f224899b0ee932e244893e"
dependencies = [
"arrayref",
"cfg-if",
]
[[package]]
name = "redox_syscall"
version = "0.1.56"

View File

@ -13,3 +13,5 @@ lazy_static = "1.4.0"
ozelot = "0.9.0" # Ozelot 0.9.0 supports protocol version 578 (1.15.2)
toml = "0.5.6"
serde = { version = "1.0.114", features = ["serde_derive"]}
base64 = "0.12.3"
radix64 = "0.3.0"

View File

@ -1,4 +1,5 @@
port = 25565
protocol_version = 578
max_players = 420
motd = "ligma balls lol"
max_players = 20
motd = "Composition MOTD"
favicon = "server-icon.png"

BIN
composition_icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

86
log.txt
View File

@ -314,3 +314,89 @@
2020-07-08 21:23:12 [INFO] - Handshake { protocol_version: MCVarInt { value: 736 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 2 } }
2020-07-08 21:23:12 [INFO] - Next state: Closed
2020-07-08 21:23:12 [INFO] - Client at 192.168.0.88:55745 closed connection
2020-07-08 21:38:26 [INFO] - Network thread started
2020-07-08 21:38:26 [IMPORTANT] - Started server on 0.0.0.0:25565
2020-07-08 21:38:38 [INFO] - Got a client!
2020-07-08 21:38:38 [INFO] - Handshake { protocol_version: MCVarInt { value: 578 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 21:38:38 [INFO] - Next state: Status
2020-07-08 21:38:38 [ERROR] - Error when handling client: failed to fill whole buffer
2020-07-08 21:38:38 [INFO] - Got a client!
2020-07-08 21:38:38 [INFO] - Handshake { protocol_version: MCVarInt { value: 11 }, server_address: MCString { value: "" }, server_port: MCUnsignedShort { value: 19712 }, next_state: MCVarInt { value: 67 } }
2020-07-08 21:38:38 [INFO] - Next state: Closed
2020-07-08 21:38:38 [INFO] - Client at 192.168.0.88:55778 closed connection
2020-07-08 21:39:45 [INFO] - Network thread started
2020-07-08 21:39:45 [IMPORTANT] - Started server on 0.0.0.0:25565
2020-07-08 21:39:52 [INFO] - Got a client!
2020-07-08 21:39:52 [INFO] - Handshake { protocol_version: MCVarInt { value: 578 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 21:39:52 [INFO] - Next state: Status
2020-07-08 21:40:01 [ERROR] - Error when handling client: Connection reset by peer (os error 54)
2020-07-08 21:40:04 [INFO] - Got a client!
2020-07-08 21:40:04 [INFO] - Handshake { protocol_version: MCVarInt { value: 578 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 21:40:04 [INFO] - Next state: Status
2020-07-08 21:40:04 [INFO] - Ping number: MCLong { value: 1803114 }
2020-07-08 21:40:04 [INFO] - Client at 192.168.0.88:55790 closed connection
2020-07-08 21:40:16 [INFO] - Got a client!
2020-07-08 21:40:16 [INFO] - Handshake { protocol_version: MCVarInt { value: 736 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 21:40:16 [INFO] - Next state: Status
2020-07-08 21:40:16 [INFO] - Ping number: MCLong { value: 1815195 }
2020-07-08 21:40:16 [INFO] - Client at 192.168.0.88:55796 closed connection
2020-07-08 21:40:47 [INFO] - Network thread started
2020-07-08 21:40:47 [IMPORTANT] - Started server on 0.0.0.0:25565
2020-07-08 21:40:59 [INFO] - Got a client!
2020-07-08 21:40:59 [INFO] - Handshake { protocol_version: MCVarInt { value: 736 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 21:40:59 [INFO] - Next state: Status
2020-07-08 21:41:00 [INFO] - Ping number: MCLong { value: 1858861 }
2020-07-08 21:41:00 [INFO] - Client at 192.168.0.88:55802 closed connection
2020-07-08 21:54:37 [INFO] - Network thread started
2020-07-08 21:54:37 [IMPORTANT] - Started server on 0.0.0.0:25565
2020-07-08 21:54:45 [INFO] - Got a client!
2020-07-08 21:54:45 [INFO] - Handshake { protocol_version: MCVarInt { value: 736 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 21:54:45 [INFO] - Next state: Status
2020-07-08 21:54:45 [INFO] - Ping number: MCLong { value: 2684003 }
2020-07-08 21:54:45 [INFO] - Client at 192.168.0.88:55845 closed connection
2020-07-08 21:54:54 [INFO] - Got a client!
2020-07-08 21:54:54 [INFO] - Handshake { protocol_version: MCVarInt { value: 578 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 21:54:54 [INFO] - Next state: Status
2020-07-08 21:54:54 [INFO] - Ping number: MCLong { value: 2693231 }
2020-07-08 21:54:54 [INFO] - Client at 192.168.0.88:55851 closed connection
2020-07-08 22:08:35 [INFO] - Network thread started
2020-07-08 22:08:35 [IMPORTANT] - Started server on 0.0.0.0:25565
2020-07-08 22:08:42 [INFO] - Got a client!
2020-07-08 22:08:42 [INFO] - Handshake { protocol_version: MCVarInt { value: 578 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 22:08:42 [INFO] - Next state: Status
2020-07-08 22:08:42 [INFO] - Ping number: MCLong { value: 3521389 }
2020-07-08 22:08:42 [INFO] - Client at 192.168.0.88:55885 closed connection
2020-07-08 22:08:49 [INFO] - Got a client!
2020-07-08 22:08:49 [INFO] - Handshake { protocol_version: MCVarInt { value: 736 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 22:08:49 [INFO] - Next state: Status
2020-07-08 22:08:49 [INFO] - Ping number: MCLong { value: 3528562 }
2020-07-08 22:08:49 [INFO] - Client at 192.168.0.88:55891 closed connection
2020-07-08 22:15:19 [INFO] - Network thread started
2020-07-08 22:15:19 [IMPORTANT] - Started server on 0.0.0.0:25565
2020-07-08 22:15:39 [INFO] - Got a client!
2020-07-08 22:15:39 [INFO] - Handshake { protocol_version: MCVarInt { value: 578 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 22:15:39 [INFO] - Next state: Status
2020-07-08 22:15:39 [INFO] - Ping number: MCLong { value: 3938584 }
2020-07-08 22:15:39 [INFO] - Client at 192.168.0.88:55909 closed connection
2020-07-08 22:23:14 [INFO] - Network thread started
2020-07-08 22:23:14 [IMPORTANT] - Started server on 0.0.0.0:25565
2020-07-08 22:23:20 [INFO] - Got a client!
2020-07-08 22:23:20 [INFO] - Handshake { protocol_version: MCVarInt { value: 498 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 22:23:20 [INFO] - Next state: Status
2020-07-08 22:23:20 [INFO] - Ping number: MCLong { value: 4398964 }
2020-07-08 22:23:20 [INFO] - Client at 192.168.0.88:55921 closed connection
2020-07-08 22:23:22 [INFO] - Got a client!
2020-07-08 22:23:22 [INFO] - Handshake { protocol_version: MCVarInt { value: 498 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 22:23:22 [INFO] - Next state: Status
2020-07-08 22:23:22 [INFO] - Ping number: MCLong { value: 4401109 }
2020-07-08 22:23:22 [INFO] - Client at 192.168.0.88:55927 closed connection
2020-07-08 22:23:41 [INFO] - Got a client!
2020-07-08 22:23:42 [INFO] - Handshake { protocol_version: MCVarInt { value: 578 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 22:23:42 [INFO] - Next state: Status
2020-07-08 22:23:42 [INFO] - Ping number: MCLong { value: 4420928 }
2020-07-08 22:23:42 [INFO] - Client at 192.168.0.88:55934 closed connection
2020-07-08 22:25:40 [INFO] - Got a client!
2020-07-08 22:25:40 [INFO] - Handshake { protocol_version: MCVarInt { value: 316 }, server_address: MCString { value: "192.168.0.98" }, server_port: MCUnsignedShort { value: 25565 }, next_state: MCVarInt { value: 1 } }
2020-07-08 22:25:40 [INFO] - Next state: Status
2020-07-08 22:25:40 [INFO] - Ping number: MCLong { value: 4539076 }
2020-07-08 22:25:40 [INFO] - Client at 192.168.0.88:55943 closed connection

BIN
server-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -1,3 +1,8 @@
// main.rs
// authors: Garen Tyler, Danton Hou
// description:
// Main Game loop, config handler.
#![allow(non_snake_case)]
#![allow(non_upper_case_globals)]
@ -31,12 +36,18 @@ fn main() {
pub struct Config {
pub port: u16,
pub protocol_version: u16,
pub max_players: u32,
pub motd: String,
pub favicon: Option<String>,
}
impl Config {
pub fn default() -> Config {
Config {
port: 25565,
protocol_version: 578,
max_players: 250,
motd: "Hello world!".to_owned(),
favicon: None,
}
}
pub fn from_file(filename: &str) -> Config {

File diff suppressed because one or more lines are too long