-
-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split all client requests into seperate files
- Loading branch information
Showing
30 changed files
with
881 additions
and
793 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
use crate::bytebuf::packet_id::Packet; | ||
|
||
#[derive(serde::Serialize)] | ||
pub struct CConfigDisconnect<'a> { | ||
reason: &'a str, | ||
} | ||
|
||
impl<'a> Packet for CConfigDisconnect<'a> { | ||
const PACKET_ID: i32 = 0x02; | ||
} | ||
|
||
impl<'a> CConfigDisconnect<'a> { | ||
pub fn new(reason: &'a str) -> Self { | ||
Self { reason } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
use crate::{ | ||
bytebuf::{packet_id::Packet, ByteBuffer}, | ||
ClientPacket, Identifier, VarInt, | ||
}; | ||
|
||
pub struct CCookieRequest { | ||
key: Identifier, | ||
} | ||
|
||
impl Packet for CCookieRequest { | ||
const PACKET_ID: VarInt = 0x00; | ||
} | ||
|
||
impl ClientPacket for CCookieRequest { | ||
fn write(&self, bytebuf: &mut ByteBuffer) { | ||
bytebuf.put_string(&self.key); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
use crate::{bytebuf::packet_id::Packet, VarInt}; | ||
|
||
#[derive(serde::Serialize)] | ||
pub struct CFinishConfig {} | ||
|
||
impl Default for CFinishConfig { | ||
fn default() -> Self { | ||
Self::new() | ||
} | ||
} | ||
|
||
impl CFinishConfig { | ||
pub fn new() -> Self { | ||
Self {} | ||
} | ||
} | ||
|
||
impl Packet for CFinishConfig { | ||
const PACKET_ID: VarInt = 0x03; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
use crate::{ | ||
bytebuf::{packet_id::Packet, ByteBuffer}, | ||
ClientPacket, KnownPack, VarInt, | ||
}; | ||
|
||
pub struct CKnownPacks<'a> { | ||
known_packs: &'a [KnownPack<'a>], | ||
} | ||
|
||
impl<'a> CKnownPacks<'a> { | ||
pub fn new(known_packs: &'a [KnownPack]) -> Self { | ||
Self { known_packs } | ||
} | ||
} | ||
|
||
impl<'a> Packet for CKnownPacks<'a> { | ||
const PACKET_ID: VarInt = 0x0E; | ||
} | ||
|
||
impl<'a> ClientPacket for CKnownPacks<'a> { | ||
fn write(&self, bytebuf: &mut ByteBuffer) { | ||
bytebuf.put_list::<KnownPack>(self.known_packs, |p, v| { | ||
p.put_string(v.namespace); | ||
p.put_string(v.id); | ||
p.put_string(v.version); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use crate::{ | ||
bytebuf::{packet_id::Packet, ByteBuffer}, | ||
ClientPacket, VarInt, | ||
}; | ||
|
||
pub struct CPluginMessage<'a> { | ||
channel: &'a str, | ||
data: &'a [u8], | ||
} | ||
|
||
impl<'a> CPluginMessage<'a> { | ||
pub fn new(channel: &'a str, data: &'a [u8]) -> Self { | ||
Self { channel, data } | ||
} | ||
} | ||
|
||
impl<'a> Packet for CPluginMessage<'a> { | ||
const PACKET_ID: VarInt = 0x01; | ||
} | ||
|
||
impl<'a> ClientPacket for CPluginMessage<'a> { | ||
fn write(&self, bytebuf: &mut ByteBuffer) { | ||
bytebuf.put_string(self.channel); | ||
bytebuf.put_slice(self.data); | ||
} | ||
} |
Oops, something went wrong.