pub struct Omegga {
pub awaiter_txs: Arc<DashMap<RequestId, Sender<Response>>>,
/* private fields */
}
Fields
awaiter_txs: Arc<DashMap<RequestId, Sender<Response>>>
Implementations
sourceimpl Omegga
impl Omegga
sourcepub fn spawn(&self) -> EventReceiver
pub fn spawn(&self) -> EventReceiver
Spawn the listener.
sourcepub fn write_notification(
&self,
method: impl Into<String>,
params: Option<Value>
)
pub fn write_notification(
&self,
method: impl Into<String>,
params: Option<Value>
)
Write out an RPC notification.
sourcepub fn write_response(
&self,
id: RequestId,
params: Option<Value>,
error: Option<Error>
)
pub fn write_response(
&self,
id: RequestId,
params: Option<Value>,
error: Option<Error>
)
Write out an RPC response.
sourcepub fn write_request(
&self,
id: RequestId,
method: impl Into<String>,
params: Option<Value>
)
pub fn write_request(
&self,
id: RequestId,
method: impl Into<String>,
params: Option<Value>
)
Write out an RPC request.
Note: This does not internally expect a response from the server.
Prefer using request
over this for the ability to
await a response from the RPC server.
sourcepub fn request(
&self,
method: impl Into<String>,
params: Option<Value>
) -> ResponseAwaiterⓘNotable traits for ResponseAwaiterimpl Future for ResponseAwaiter type Output = Result<Option<Value>, ResponseError>;
pub fn request(
&self,
method: impl Into<String>,
params: Option<Value>
) -> ResponseAwaiterⓘNotable traits for ResponseAwaiterimpl Future for ResponseAwaiter type Output = Result<Option<Value>, ResponseError>;
Request a response from the RPC server.
This returns a ResponseAwaiter
, a Future
that awaits a response.
sourcepub fn register_commands(&self, id: RequestId, commands: &[&str])
pub fn register_commands(&self, id: RequestId, commands: &[&str])
Register commands with Omegga. Call when the plugin is initialized.
sourcepub fn error(&self, line: impl Into<String>)
pub fn error(&self, line: impl Into<String>)
Prints a message to the Omegga console in error color.
sourcepub fn info(&self, line: impl Into<String>)
pub fn info(&self, line: impl Into<String>)
Prints a message to the Omegga console in info color.
sourcepub fn warn(&self, line: impl Into<String>)
pub fn warn(&self, line: impl Into<String>)
Prints a message to the Omegga console in warn color.
sourcepub fn trace(&self, line: impl Into<String>)
pub fn trace(&self, line: impl Into<String>)
Prints a message to the Omegga console in trace color.
sourcepub async fn store_get(
&self,
key: impl Into<String>
) -> Result<Option<Value>, ResponseError>
pub async fn store_get(
&self,
key: impl Into<String>
) -> Result<Option<Value>, ResponseError>
Gets an object from the store.
sourcepub async fn store_delete(&self, key: impl Into<String>)
pub async fn store_delete(&self, key: impl Into<String>)
Deletes an object from the store.
sourcepub fn store_wipe(&self)
pub fn store_wipe(&self)
Wipes the store.
sourcepub async fn store_keys(&self) -> Result<Vec<String>, ResponseError>
pub async fn store_keys(&self) -> Result<Vec<String>, ResponseError>
Gets a list of keys in the store.
sourcepub fn whisper(&self, username: impl Into<String>, line: impl Into<String>)
pub fn whisper(&self, username: impl Into<String>, line: impl Into<String>)
Whispers a line to a user by their name.
pub fn middle_print(&self, username: impl Into<String>, line: impl Into<String>)
sourcepub async fn get_players(&self) -> Result<Vec<Player>, ResponseError>
pub async fn get_players(&self) -> Result<Vec<Player>, ResponseError>
Gets a list of all players.
sourcepub async fn get_all_player_positions(
&self
) -> Result<Vec<PlayerPosition>, ResponseError>
pub async fn get_all_player_positions(
&self
) -> Result<Vec<PlayerPosition>, ResponseError>
Get all player positions.
sourcepub async fn get_role_setup(&self) -> Result<Value, ResponseError>
pub async fn get_role_setup(&self) -> Result<Value, ResponseError>
Get the role setup.
sourcepub async fn get_ban_list(&self) -> Result<Value, ResponseError>
pub async fn get_ban_list(&self) -> Result<Value, ResponseError>
Get the ban list.
sourcepub async fn get_saves(&self) -> Result<Vec<String>, ResponseError>
pub async fn get_saves(&self) -> Result<Vec<String>, ResponseError>
Get a list of the server’s saves.
sourcepub async fn get_save_path(
&self,
save: impl Into<String>
) -> Result<Option<String>, ResponseError>
pub async fn get_save_path(
&self,
save: impl Into<String>
) -> Result<Option<String>, ResponseError>
Get the path to a specific save.
sourcepub async fn get_save_data(&self) -> Result<SaveData, ResponseError>
pub async fn get_save_data(&self) -> Result<SaveData, ResponseError>
Gets the server’s current save data as a brickadia-rs save object.
sourcepub fn clear_bricks(&self, target: impl Into<String>, quiet: bool)
pub fn clear_bricks(&self, target: impl Into<String>, quiet: bool)
Clears a player’s bricks by their name.
sourcepub fn clear_all_bricks(&self, quiet: bool)
pub fn clear_all_bricks(&self, quiet: bool)
Clear all bricks.
sourcepub async fn save_bricks(
&self,
name: impl Into<String>
) -> Result<(), ResponseError>
pub async fn save_bricks(
&self,
name: impl Into<String>
) -> Result<(), ResponseError>
Save bricks to a named save.
sourcepub async fn load_bricks(
&self,
name: impl Into<String>,
quiet: bool,
offset: (i32, i32, i32)
) -> Result<(), ResponseError>
pub async fn load_bricks(
&self,
name: impl Into<String>,
quiet: bool,
offset: (i32, i32, i32)
) -> Result<(), ResponseError>
Load a save, provided an offset in the world.
sourcepub async fn load_bricks_on_player(
&self,
name: impl Into<String>,
player: impl Into<String>,
offset: (i32, i32, i32)
) -> Result<(), ResponseError>
pub async fn load_bricks_on_player(
&self,
name: impl Into<String>,
player: impl Into<String>,
offset: (i32, i32, i32)
) -> Result<(), ResponseError>
Load a save onto a player’s clipboard.
sourcepub async fn read_save_data(
&self,
name: impl Into<String>
) -> Result<Option<SaveData>, ResponseError>
pub async fn read_save_data(
&self,
name: impl Into<String>
) -> Result<Option<SaveData>, ResponseError>
Reads a save (from a save file), and returns its data as a brickadia-rs save object.
sourcepub async fn load_save_data(
&self,
data: SaveData,
quiet: bool,
offset: (i32, i32, i32)
) -> Result<(), ResponseError>
pub async fn load_save_data(
&self,
data: SaveData,
quiet: bool,
offset: (i32, i32, i32)
) -> Result<(), ResponseError>
Loads a save (from brickadia-rs save data) into the world, provided an offset.
sourcepub async fn load_save_data_on_player(
&self,
data: SaveData,
player: impl Into<String>,
offset: (i32, i32, i32)
) -> Result<(), ResponseError>
pub async fn load_save_data_on_player(
&self,
data: SaveData,
player: impl Into<String>,
offset: (i32, i32, i32)
) -> Result<(), ResponseError>
Loads a save (from brickadia-rs save data) onto a player’s clipboard.
sourcepub async fn change_map(
&self,
map: impl Into<String>
) -> Result<(), ResponseError>
pub async fn change_map(
&self,
map: impl Into<String>
) -> Result<(), ResponseError>
Changes the map.
sourcepub async fn get_player(
&self,
target: impl Into<String>
) -> Result<Option<Player>, ResponseError>
pub async fn get_player(
&self,
target: impl Into<String>
) -> Result<Option<Player>, ResponseError>
Get a player.
sourcepub async fn get_player_roles(
&self,
target: impl Into<String>
) -> Result<Option<Vec<String>>, ResponseError>
pub async fn get_player_roles(
&self,
target: impl Into<String>
) -> Result<Option<Vec<String>>, ResponseError>
Get a player’s roles.
sourcepub async fn get_player_permissions(
&self,
target: impl Into<String>
) -> Result<Value, ResponseError>
pub async fn get_player_permissions(
&self,
target: impl Into<String>
) -> Result<Value, ResponseError>
Get a player’s permissions.
sourcepub async fn get_player_name_color(
&self,
target: impl Into<String>
) -> Result<Option<String>, ResponseError>
pub async fn get_player_name_color(
&self,
target: impl Into<String>
) -> Result<Option<String>, ResponseError>
Get a player’s name color (6-digit hexadecimal).
sourcepub async fn get_player_position(
&self,
target: impl Into<String>
) -> Result<Option<(f64, f64, f64)>, ResponseError>
pub async fn get_player_position(
&self,
target: impl Into<String>
) -> Result<Option<(f64, f64, f64)>, ResponseError>
Get a player’s position.
sourcepub async fn get_player_ghost_brick(
&self,
target: impl Into<String>
) -> Result<Option<GhostBrick>, ResponseError>
pub async fn get_player_ghost_brick(
&self,
target: impl Into<String>
) -> Result<Option<GhostBrick>, ResponseError>
Get a player’s ghost brick data.
sourcepub async fn get_player_paint(
&self,
target: impl Into<String>
) -> Result<Option<PlayerPaint>, ResponseError>
pub async fn get_player_paint(
&self,
target: impl Into<String>
) -> Result<Option<PlayerPaint>, ResponseError>
Get a player’s paint data.
sourcepub async fn get_player_template_bounds(
&self,
target: impl Into<String>
) -> Result<Option<TemplateBounds>, ResponseError>
pub async fn get_player_template_bounds(
&self,
target: impl Into<String>
) -> Result<Option<TemplateBounds>, ResponseError>
Get a player’s template bounds.
sourcepub async fn get_player_template_bounds_data(
&self,
target: impl Into<String>
) -> Result<Option<SaveData>, ResponseError>
pub async fn get_player_template_bounds_data(
&self,
target: impl Into<String>
) -> Result<Option<SaveData>, ResponseError>
Get a player’s template data as a brickadia-rs save object.
sourcepub async fn load_data_at_ghost_brick(
&self,
target: impl Into<String>,
data: SaveData,
offset: (i32, i32, i32),
rotate: bool,
quiet: bool
) -> Result<(), ResponseError>
pub async fn load_data_at_ghost_brick(
&self,
target: impl Into<String>,
data: SaveData,
offset: (i32, i32, i32),
rotate: bool,
quiet: bool
) -> Result<(), ResponseError>
Load brickadia-rs save data at a player’s template.
sourcepub async fn get_plugin(
&self,
target: impl Into<String>
) -> Result<Option<Plugin>, ResponseError>
pub async fn get_plugin(
&self,
target: impl Into<String>
) -> Result<Option<Plugin>, ResponseError>
Get a plugin.
sourcepub async fn emit_plugin<T>(
&self,
target: String,
event: String,
args: Vec<Value>
) -> Result<Option<T>, ResponseError> where
T: DeserializeOwned,
pub async fn emit_plugin<T>(
&self,
target: String,
event: String,
args: Vec<Value>
) -> Result<Option<T>, ResponseError> where
T: DeserializeOwned,
Emit a custom event to a plugin.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Omegga
impl Send for Omegga
impl Sync for Omegga
impl Unpin for Omegga
impl !UnwindSafe for Omegga
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more