aboutsummaryrefslogtreecommitdiff
path: root/azalea-client/src/ping.rs
diff options
context:
space:
mode:
authormat <27899617+mat-1@users.noreply.github.com>2022-07-30 22:57:02 +0000
committerGitHub <noreply@github.com>2022-07-30 22:57:02 +0000
commitbc71c74bef5f82de7224f97a65614251f3ed7cb1 (patch)
tree254a58c1ac77b047df0b86d75d3c6d9dd52c14fc /azalea-client/src/ping.rs
parent060d2f1592b98bca64b2ee15e103aa14db816227 (diff)
parent9ef1e8d653acd7e8e026cbde9c0320cedb8cf1d3 (diff)
downloadazalea-drasl-bc71c74bef5f82de7224f97a65614251f3ed7cb1.tar.xz
Merge pull request #13 from mat-1/split-clientbound-serverbound
Split clientbound and serverbound packets
Diffstat (limited to 'azalea-client/src/ping.rs')
-rwxr-xr-xazalea-client/src/ping.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/azalea-client/src/ping.rs b/azalea-client/src/ping.rs
index 8ecff7ca..e4acfc34 100755
--- a/azalea-client/src/ping.rs
+++ b/azalea-client/src/ping.rs
@@ -1,11 +1,12 @@
///! Ping Minecraft servers.
use azalea_protocol::{
- connect::HandshakeConnection,
+ connect::Connection,
packets::{
handshake::client_intention_packet::ClientIntentionPacket,
status::{
clientbound_status_response_packet::ClientboundStatusResponsePacket,
- serverbound_status_request_packet::ServerboundStatusRequestPacket, StatusPacket,
+ serverbound_status_request_packet::ServerboundStatusRequestPacket,
+ ClientboundStatusPacket,
},
ConnectionProtocol, PROTOCOL_VERSION,
},
@@ -17,7 +18,7 @@ pub async fn ping_server(
) -> Result<ClientboundStatusResponsePacket, String> {
let resolved_address = resolver::resolve_address(address).await?;
- let mut conn = HandshakeConnection::new(&resolved_address).await?;
+ let mut conn = Connection::new(&resolved_address).await?;
// send the client intention packet and switch to the status state
conn.write(
@@ -38,7 +39,6 @@ pub async fn ping_server(
let packet = conn.read().await.unwrap();
match packet {
- StatusPacket::ClientboundStatusResponsePacket(p) => Ok(p),
- _ => Err("Invalid packet type".to_string()),
+ ClientboundStatusPacket::ClientboundStatusResponsePacket(p) => Ok(p),
}
}