mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 23:44:38 +00:00
ChatPacket::is_whisper
This commit is contained in:
parent
ca39b8b6af
commit
0cc76dfb67
3 changed files with 12 additions and 2 deletions
|
@ -108,6 +108,16 @@ impl ChatPacket {
|
||||||
overlay: false,
|
overlay: false,
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Whether this message was sent with /msg (or aliases). It works by
|
||||||
|
/// checking the translation key, so it won't work on servers that use their
|
||||||
|
/// own whisper system.
|
||||||
|
pub fn is_whisper(&self) -> bool {
|
||||||
|
match self.message() {
|
||||||
|
FormattedText::Text(_) => false,
|
||||||
|
FormattedText::Translatable(t) => t.key == "commands.message.display.incoming",
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Client {
|
impl Client {
|
||||||
|
|
|
@ -14,7 +14,7 @@ use app::{App, Plugin, PluginGroup};
|
||||||
pub use azalea_auth as auth;
|
pub use azalea_auth as auth;
|
||||||
pub use azalea_block as blocks;
|
pub use azalea_block as blocks;
|
||||||
pub use azalea_brigadier as brigadier;
|
pub use azalea_brigadier as brigadier;
|
||||||
pub use azalea_chat as chat;
|
pub use azalea_chat::FormattedText;
|
||||||
pub use azalea_client::*;
|
pub use azalea_client::*;
|
||||||
pub use azalea_core::{BlockPos, Vec3};
|
pub use azalea_core::{BlockPos, Vec3};
|
||||||
pub use azalea_protocol as protocol;
|
pub use azalea_protocol as protocol;
|
||||||
|
|
|
@ -70,7 +70,7 @@ pub trait PathfinderClientExt {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PathfinderClientExt for azalea_client::Client {
|
impl PathfinderClientExt for azalea_client::Client {
|
||||||
/// ```no_run
|
/// ```
|
||||||
/// # use azalea::prelude::*;
|
/// # use azalea::prelude::*;
|
||||||
/// # use azalea::{BlockPos, pathfinder::BlockPosGoal};
|
/// # use azalea::{BlockPos, pathfinder::BlockPosGoal};
|
||||||
/// # fn example(bot: &Client) {
|
/// # fn example(bot: &Client) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue