pub struct Server {
pub plugin_id: String,
pub sender: Sender<PluginToHost>,
}Fields§
§plugin_id: String§sender: Sender<PluginToHost>Implementations§
Source§impl Server
impl Server
Sourcepub async fn send_chat(
&self,
target_uuid: String,
message: String,
) -> Result<(), SendError<PluginToHost>>
pub async fn send_chat( &self, target_uuid: String, message: String, ) -> Result<(), SendError<PluginToHost>>
Sends a SendChat action to the server.
Sourcepub async fn teleport(
&self,
player_uuid: String,
position: impl Into<Option<Vec3>>,
rotation: impl Into<Option<Vec3>>,
) -> Result<(), SendError<PluginToHost>>
pub async fn teleport( &self, player_uuid: String, position: impl Into<Option<Vec3>>, rotation: impl Into<Option<Vec3>>, ) -> Result<(), SendError<PluginToHost>>
Sends a Teleport action to the server.
Sourcepub async fn kick(
&self,
player_uuid: String,
reason: String,
) -> Result<(), SendError<PluginToHost>>
pub async fn kick( &self, player_uuid: String, reason: String, ) -> Result<(), SendError<PluginToHost>>
Sends a Kick action to the server.
Sourcepub async fn set_game_mode(
&self,
player_uuid: String,
game_mode: GameMode,
) -> Result<(), SendError<PluginToHost>>
pub async fn set_game_mode( &self, player_uuid: String, game_mode: GameMode, ) -> Result<(), SendError<PluginToHost>>
Sends a SetGameMode action to the server.
Sourcepub async fn give_item(
&self,
player_uuid: String,
item: impl Into<Option<ItemStack>>,
) -> Result<(), SendError<PluginToHost>>
pub async fn give_item( &self, player_uuid: String, item: impl Into<Option<ItemStack>>, ) -> Result<(), SendError<PluginToHost>>
Sends a GiveItem action to the server.
Sourcepub async fn clear_inventory(
&self,
player_uuid: String,
) -> Result<(), SendError<PluginToHost>>
pub async fn clear_inventory( &self, player_uuid: String, ) -> Result<(), SendError<PluginToHost>>
Sends a ClearInventory action to the server.
Sourcepub async fn set_held_item(
&self,
player_uuid: String,
main: impl Into<Option<ItemStack>>,
offhand: impl Into<Option<ItemStack>>,
) -> Result<(), SendError<PluginToHost>>
pub async fn set_held_item( &self, player_uuid: String, main: impl Into<Option<ItemStack>>, offhand: impl Into<Option<ItemStack>>, ) -> Result<(), SendError<PluginToHost>>
Sends a SetHeldItem action to the server.
Sourcepub async fn set_health(
&self,
player_uuid: String,
health: f64,
max_health: impl Into<Option<f64>>,
) -> Result<(), SendError<PluginToHost>>
pub async fn set_health( &self, player_uuid: String, health: f64, max_health: impl Into<Option<f64>>, ) -> Result<(), SendError<PluginToHost>>
Sends a SetHealth action to the server.
Sourcepub async fn set_food(
&self,
player_uuid: String,
food: i32,
) -> Result<(), SendError<PluginToHost>>
pub async fn set_food( &self, player_uuid: String, food: i32, ) -> Result<(), SendError<PluginToHost>>
Sends a SetFood action to the server.
Sourcepub async fn set_experience(
&self,
player_uuid: String,
level: impl Into<Option<i32>>,
progress: impl Into<Option<f32>>,
amount: impl Into<Option<i32>>,
) -> Result<(), SendError<PluginToHost>>
pub async fn set_experience( &self, player_uuid: String, level: impl Into<Option<i32>>, progress: impl Into<Option<f32>>, amount: impl Into<Option<i32>>, ) -> Result<(), SendError<PluginToHost>>
Sends a SetExperience action to the server.
Sourcepub async fn set_velocity(
&self,
player_uuid: String,
velocity: impl Into<Option<Vec3>>,
) -> Result<(), SendError<PluginToHost>>
pub async fn set_velocity( &self, player_uuid: String, velocity: impl Into<Option<Vec3>>, ) -> Result<(), SendError<PluginToHost>>
Sends a SetVelocity action to the server.
Sourcepub async fn add_effect(
&self,
player_uuid: String,
effect_type: EffectType,
level: i32,
duration_ms: i64,
show_particles: bool,
) -> Result<(), SendError<PluginToHost>>
pub async fn add_effect( &self, player_uuid: String, effect_type: EffectType, level: i32, duration_ms: i64, show_particles: bool, ) -> Result<(), SendError<PluginToHost>>
Sends a AddEffect action to the server.
Sourcepub async fn remove_effect(
&self,
player_uuid: String,
effect_type: EffectType,
) -> Result<(), SendError<PluginToHost>>
pub async fn remove_effect( &self, player_uuid: String, effect_type: EffectType, ) -> Result<(), SendError<PluginToHost>>
Sends a RemoveEffect action to the server.
Sourcepub async fn send_title(
&self,
player_uuid: String,
title: String,
subtitle: impl Into<Option<String>>,
fade_in_ms: impl Into<Option<i64>>,
duration_ms: impl Into<Option<i64>>,
fade_out_ms: impl Into<Option<i64>>,
) -> Result<(), SendError<PluginToHost>>
pub async fn send_title( &self, player_uuid: String, title: String, subtitle: impl Into<Option<String>>, fade_in_ms: impl Into<Option<i64>>, duration_ms: impl Into<Option<i64>>, fade_out_ms: impl Into<Option<i64>>, ) -> Result<(), SendError<PluginToHost>>
Sends a SendTitle action to the server.
Sourcepub async fn send_popup(
&self,
player_uuid: String,
message: String,
) -> Result<(), SendError<PluginToHost>>
pub async fn send_popup( &self, player_uuid: String, message: String, ) -> Result<(), SendError<PluginToHost>>
Sends a SendPopup action to the server.
Sourcepub async fn send_tip(
&self,
player_uuid: String,
message: String,
) -> Result<(), SendError<PluginToHost>>
pub async fn send_tip( &self, player_uuid: String, message: String, ) -> Result<(), SendError<PluginToHost>>
Sends a SendTip action to the server.
Sourcepub async fn play_sound(
&self,
player_uuid: String,
sound: Sound,
position: impl Into<Option<Vec3>>,
volume: impl Into<Option<f32>>,
pitch: impl Into<Option<f32>>,
) -> Result<(), SendError<PluginToHost>>
pub async fn play_sound( &self, player_uuid: String, sound: Sound, position: impl Into<Option<Vec3>>, volume: impl Into<Option<f32>>, pitch: impl Into<Option<f32>>, ) -> Result<(), SendError<PluginToHost>>
Sends a PlaySound action to the server.
Sourcepub async fn execute_command(
&self,
player_uuid: String,
command: String,
) -> Result<(), SendError<PluginToHost>>
pub async fn execute_command( &self, player_uuid: String, command: String, ) -> Result<(), SendError<PluginToHost>>
Sends a ExecuteCommand action to the server.
Sourcepub async fn world_set_default_game_mode(
&self,
world: impl Into<Option<WorldRef>>,
game_mode: GameMode,
) -> Result<(), SendError<PluginToHost>>
pub async fn world_set_default_game_mode( &self, world: impl Into<Option<WorldRef>>, game_mode: GameMode, ) -> Result<(), SendError<PluginToHost>>
Sends a WorldSetDefaultGameMode action to the server.
Sourcepub async fn world_set_difficulty(
&self,
world: impl Into<Option<WorldRef>>,
difficulty: Difficulty,
) -> Result<(), SendError<PluginToHost>>
pub async fn world_set_difficulty( &self, world: impl Into<Option<WorldRef>>, difficulty: Difficulty, ) -> Result<(), SendError<PluginToHost>>
Sends a WorldSetDifficulty action to the server.
Sourcepub async fn world_set_tick_range(
&self,
world: impl Into<Option<WorldRef>>,
tick_range: i32,
) -> Result<(), SendError<PluginToHost>>
pub async fn world_set_tick_range( &self, world: impl Into<Option<WorldRef>>, tick_range: i32, ) -> Result<(), SendError<PluginToHost>>
Sends a WorldSetTickRange action to the server.
Sourcepub async fn world_set_block(
&self,
world: impl Into<Option<WorldRef>>,
position: impl Into<Option<BlockPos>>,
block: impl Into<Option<BlockState>>,
) -> Result<(), SendError<PluginToHost>>
pub async fn world_set_block( &self, world: impl Into<Option<WorldRef>>, position: impl Into<Option<BlockPos>>, block: impl Into<Option<BlockState>>, ) -> Result<(), SendError<PluginToHost>>
Sends a WorldSetBlock action to the server.
Sourcepub async fn world_play_sound(
&self,
world: impl Into<Option<WorldRef>>,
sound: Sound,
position: impl Into<Option<Vec3>>,
) -> Result<(), SendError<PluginToHost>>
pub async fn world_play_sound( &self, world: impl Into<Option<WorldRef>>, sound: Sound, position: impl Into<Option<Vec3>>, ) -> Result<(), SendError<PluginToHost>>
Sends a WorldPlaySound action to the server.
Sourcepub async fn world_add_particle(
&self,
world: impl Into<Option<WorldRef>>,
position: impl Into<Option<Vec3>>,
particle: ParticleType,
block: impl Into<Option<BlockState>>,
face: impl Into<Option<i32>>,
) -> Result<(), SendError<PluginToHost>>
pub async fn world_add_particle( &self, world: impl Into<Option<WorldRef>>, position: impl Into<Option<Vec3>>, particle: ParticleType, block: impl Into<Option<BlockState>>, face: impl Into<Option<i32>>, ) -> Result<(), SendError<PluginToHost>>
Sends a WorldAddParticle action to the server.
Sourcepub async fn world_query_entities(
&self,
world: impl Into<Option<WorldRef>>,
) -> Result<(), SendError<PluginToHost>>
pub async fn world_query_entities( &self, world: impl Into<Option<WorldRef>>, ) -> Result<(), SendError<PluginToHost>>
Sends a WorldQueryEntities action to the server.
Sourcepub async fn world_query_players(
&self,
world: impl Into<Option<WorldRef>>,
) -> Result<(), SendError<PluginToHost>>
pub async fn world_query_players( &self, world: impl Into<Option<WorldRef>>, ) -> Result<(), SendError<PluginToHost>>
Sends a WorldQueryPlayers action to the server.
Source§impl Server
impl Server
Sourcepub async fn send_action(
&self,
kind: Kind,
) -> Result<(), SendError<PluginToHost>>
pub async fn send_action( &self, kind: Kind, ) -> Result<(), SendError<PluginToHost>>
Helper to build and send a single action.
Sourcepub async fn send_actions(
&self,
actions: Vec<Action>,
) -> Result<(), SendError<PluginToHost>>
pub async fn send_actions( &self, actions: Vec<Action>, ) -> Result<(), SendError<PluginToHost>>
Helper to send a batch of actions.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Server
impl RefUnwindSafe for Server
impl Send for Server
impl Sync for Server
impl Unpin for Server
impl UnwindSafe for Server
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request