mirror of
https://github.com/italicsjenga/valence.git
synced 2025-01-09 22:31:30 +11:00
Explain event validation
This commit is contained in:
parent
51cb3bd277
commit
7878793629
|
@ -750,9 +750,6 @@ impl<C: Config> Client<C> {
|
|||
C2sPlayPacket::QueryEntityNbt(_) => {}
|
||||
C2sPlayPacket::PlayerInteractEntity(p) => {
|
||||
if let Some(id) = entities.get_with_network_id(p.entity_id.0) {
|
||||
// TODO: verify that the client has line of sight to the targeted entity and
|
||||
// that the distance is <=4 blocks.
|
||||
|
||||
self.events.push_back(ClientEvent::InteractWithEntity {
|
||||
id,
|
||||
sneaking: p.sneaking,
|
||||
|
@ -851,9 +848,6 @@ impl<C: Config> Client<C> {
|
|||
C2sPlayPacket::CraftRequest(_) => {}
|
||||
C2sPlayPacket::UpdatePlayerAbilities(_) => {}
|
||||
C2sPlayPacket::PlayerAction(p) => {
|
||||
// TODO: verify dug block is within the correct distance from the client.
|
||||
// TODO: verify that the broken block is allowed to be broken?
|
||||
|
||||
if p.sequence.0 != 0 {
|
||||
self.dug_blocks.push(p.sequence.0);
|
||||
}
|
||||
|
|
|
@ -16,7 +16,18 @@ use crate::protocol::VarInt;
|
|||
/// Represents an action performed by a client.
|
||||
///
|
||||
/// Client events can be obtained from
|
||||
/// [`pop_event`](crate::client::Client::pop_event).
|
||||
/// [`pop_event`](super::Client::pop_event).
|
||||
///
|
||||
/// # Event Validation
|
||||
///
|
||||
/// [`Client`](super::Client) makes no attempt to validate events against the
|
||||
/// expected rules for players. Malicious clients can teleport through walls,
|
||||
/// interact with distant entities, sneak and sprint backwards, break
|
||||
/// bedrock in survival mode, etc.
|
||||
///
|
||||
/// It is best to think of events from clients as _requests_ to interact with
|
||||
/// the server. It is then your responsibility to decide if the request should
|
||||
/// be honored.
|
||||
#[derive(Debug)]
|
||||
pub enum ClientEvent {
|
||||
/// A regular message was sent to the chat.
|
||||
|
|
Loading…
Reference in a new issue