Server

Struct Server 

Source
pub struct Server {
    pub plugin_id: String,
    pub sender: Sender<PluginToHost>,
}

Fields§

§plugin_id: String§sender: Sender<PluginToHost>

Implementations§

Source§

impl Server

Source

pub async fn send_chat( &self, target_uuid: String, message: String, ) -> Result<(), SendError<PluginToHost>>

Sends a SendChat action to the server.

Source

pub async fn teleport( &self, player_uuid: String, position: Option<Vec3>, rotation: Option<Vec3>, ) -> Result<(), SendError<PluginToHost>>

Sends a Teleport action to the server.

Source

pub async fn kick( &self, player_uuid: String, reason: String, ) -> Result<(), SendError<PluginToHost>>

Sends a Kick action to the server.

Source

pub async fn set_game_mode( &self, player_uuid: String, game_mode: i32, ) -> Result<(), SendError<PluginToHost>>

Sends a SetGameMode action to the server.

Source

pub async fn give_item( &self, player_uuid: String, item: Option<ItemStack>, ) -> Result<(), SendError<PluginToHost>>

Sends a GiveItem action to the server.

Source

pub async fn clear_inventory( &self, player_uuid: String, ) -> Result<(), SendError<PluginToHost>>

Sends a ClearInventory action to the server.

Source

pub async fn set_held_item( &self, player_uuid: String, main: Option<ItemStack>, offhand: Option<ItemStack>, ) -> Result<(), SendError<PluginToHost>>

Sends a SetHeldItem action to the server.

Source

pub async fn set_health( &self, player_uuid: String, health: f64, max_health: Option<f64>, ) -> Result<(), SendError<PluginToHost>>

Sends a SetHealth action to the server.

Source

pub async fn set_food( &self, player_uuid: String, food: i32, ) -> Result<(), SendError<PluginToHost>>

Sends a SetFood action to the server.

Source

pub async fn set_experience( &self, player_uuid: String, level: Option<i32>, progress: Option<f32>, amount: Option<i32>, ) -> Result<(), SendError<PluginToHost>>

Sends a SetExperience action to the server.

Source

pub async fn set_velocity( &self, player_uuid: String, velocity: Option<Vec3>, ) -> Result<(), SendError<PluginToHost>>

Sends a SetVelocity action to the server.

Source

pub async fn add_effect( &self, player_uuid: String, effect_type: i32, level: i32, duration_ms: i64, show_particles: bool, ) -> Result<(), SendError<PluginToHost>>

Sends a AddEffect action to the server.

Source

pub async fn remove_effect( &self, player_uuid: String, effect_type: i32, ) -> Result<(), SendError<PluginToHost>>

Sends a RemoveEffect action to the server.

Source

pub async fn send_title( &self, player_uuid: String, title: String, subtitle: Option<String>, fade_in_ms: Option<i64>, duration_ms: Option<i64>, fade_out_ms: Option<i64>, ) -> Result<(), SendError<PluginToHost>>

Sends a SendTitle action to the server.

Source

pub async fn send_popup( &self, player_uuid: String, message: String, ) -> Result<(), SendError<PluginToHost>>

Sends a SendPopup action to the server.

Source

pub async fn send_tip( &self, player_uuid: String, message: String, ) -> Result<(), SendError<PluginToHost>>

Sends a SendTip action to the server.

Source

pub async fn play_sound( &self, player_uuid: String, sound: i32, position: Option<Vec3>, volume: Option<f32>, pitch: Option<f32>, ) -> Result<(), SendError<PluginToHost>>

Sends a PlaySound action to the server.

Source

pub async fn execute_command( &self, player_uuid: String, command: String, ) -> Result<(), SendError<PluginToHost>>

Sends a ExecuteCommand action to the server.

Source

pub async fn world_set_default_game_mode( &self, world: Option<WorldRef>, game_mode: i32, ) -> Result<(), SendError<PluginToHost>>

Sends a WorldSetDefaultGameMode action to the server.

Source

pub async fn world_set_difficulty( &self, world: Option<WorldRef>, difficulty: i32, ) -> Result<(), SendError<PluginToHost>>

Sends a WorldSetDifficulty action to the server.

Source

pub async fn world_set_tick_range( &self, world: Option<WorldRef>, tick_range: i32, ) -> Result<(), SendError<PluginToHost>>

Sends a WorldSetTickRange action to the server.

Source

pub async fn world_set_block( &self, world: Option<WorldRef>, position: Option<BlockPos>, block: Option<BlockState>, ) -> Result<(), SendError<PluginToHost>>

Sends a WorldSetBlock action to the server.

Source

pub async fn world_play_sound( &self, world: Option<WorldRef>, sound: i32, position: Option<Vec3>, ) -> Result<(), SendError<PluginToHost>>

Sends a WorldPlaySound action to the server.

Source

pub async fn world_add_particle( &self, world: Option<WorldRef>, position: Option<Vec3>, particle: i32, block: Option<BlockState>, face: Option<i32>, ) -> Result<(), SendError<PluginToHost>>

Sends a WorldAddParticle action to the server.

Source

pub async fn world_query_entities( &self, world: Option<WorldRef>, ) -> Result<(), SendError<PluginToHost>>

Sends a WorldQueryEntities action to the server.

Source

pub async fn world_query_players( &self, world: Option<WorldRef>, ) -> Result<(), SendError<PluginToHost>>

Sends a WorldQueryPlayers action to the server.

Source

pub async fn world_query_entities_within( &self, world: Option<WorldRef>, box: Option<BBox>, ) -> Result<(), SendError<PluginToHost>>

Sends a WorldQueryEntitiesWithin action to the server.

Source§

impl Server

Source

pub async fn send_action( &self, kind: Kind, ) -> Result<(), SendError<PluginToHost>>

Helper to build and send a single action.

Source

pub async fn send_actions( &self, actions: Vec<Action>, ) -> Result<(), SendError<PluginToHost>>

Helper to send a batch of actions.

Source

pub async fn subscribe( &self, events: Vec<EventType>, ) -> Result<(), SendError<PluginToHost>>

Subscribe to a list of game events.

Trait Implementations§

Source§

impl Clone for Server

Source§

fn clone(&self) -> Server

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more