Setup Base for Velocity (Proxy)
This commit is contained in:
1 parent
333bf64235
commit
ceb718d475
14 files changed
+180
-8
No files matched your search
@@ -16,7 +16,7 @@ serde = { version = "1.0", features = ["derive"] }
|
||||
# to parse strings to json responses
|
||||
serde_json = "1.0"
|
||||
|
||||
flate2 = "1.0.30"
|
||||
flate2 = "1.0.31"
|
||||
|
||||
thiserror = "1.0.63"
|
||||
log = "0.4"
|
||||
|
||||
@@ -295,6 +295,11 @@ impl ByteBuffer {
|
||||
pub fn copy_to_bytes(&mut self, len: usize) -> bytes::Bytes {
|
||||
self.buffer.copy_to_bytes(len)
|
||||
}
|
||||
|
||||
pub fn copy_to_slice(&mut self, dst: &mut [u8]) {
|
||||
self.buffer.copy_to_slice(dst)
|
||||
}
|
||||
|
||||
pub fn put_slice(&mut self, src: &[u8]) {
|
||||
self.buffer.put_slice(src)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
use pumpkin_macros::packet;
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::VarInt;
|
||||
|
||||
#[derive(Serialize)]
|
||||
#[packet(0x04)]
|
||||
pub struct CLoginPluginRequest<'a> {
|
||||
message_id: VarInt,
|
||||
channel: &'a str,
|
||||
data: &'a [u8],
|
||||
}
|
||||
|
||||
impl<'a> CLoginPluginRequest<'a> {
|
||||
pub fn new(message_id: VarInt, channel: &'a str, data: &'a [u8]) -> Self {
|
||||
Self {
|
||||
message_id,
|
||||
channel,
|
||||
data,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
mod c_encryption_request;
|
||||
mod c_login_disconnect;
|
||||
mod c_login_success;
|
||||
mod c_plugin_request;
|
||||
mod c_set_compression;
|
||||
|
||||
pub use c_encryption_request::*;
|
||||
pub use c_login_disconnect::*;
|
||||
pub use c_login_success::*;
|
||||
pub use c_plugin_request::*;
|
||||
pub use c_set_compression::*;
|
||||
@@ -1,3 +1,4 @@
|
||||
use bytes::BytesMut;
|
||||
use pumpkin_macros::packet;
|
||||
|
||||
use crate::{
|
||||
@@ -6,18 +7,18 @@ use crate::{
|
||||
};
|
||||
|
||||
#[packet(0x02)]
|
||||
pub struct SLoginPluginResponse<'a> {
|
||||
pub struct SLoginPluginResponse {
|
||||
pub message_id: VarInt,
|
||||
pub successful: bool,
|
||||
pub data: Option<&'a [u8]>,
|
||||
pub data: Option<BytesMut>,
|
||||
}
|
||||
|
||||
impl<'a> ServerPacket for SLoginPluginResponse<'a> {
|
||||
impl ServerPacket for SLoginPluginResponse {
|
||||
fn read(bytebuf: &mut ByteBuffer) -> Result<Self, DeserializerError> {
|
||||
Ok(Self {
|
||||
message_id: bytebuf.get_var_int(),
|
||||
successful: bytebuf.get_bool(),
|
||||
data: None, // TODO
|
||||
data: bytebuf.get_option(|v| v.get_slice()),
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user