pub trait Plugin: Default + 'static {
Show 21 methods
// Provided methods
fn init(&mut self, config: &str) -> Result<Registration, String> { ... }
fn reload(&mut self, config: &str) -> Result<(), String> { ... }
fn shutdown(&mut self, reason: &str) { ... }
fn route(&mut self, connection: Connection) -> RouteDecision { ... }
fn login(&mut self, ctx: Context) -> Action { ... }
fn initial_server(&mut self, ctx: Context) -> Action { ... }
fn before_transfer(&mut self, ctx: Context) -> Action { ... }
fn command(&mut self, ctx: Context) -> Action { ... }
fn suggest(&mut self, ctx: Context) -> Vec<Suggestion> { ... }
fn status(&mut self, ping: Ping) -> Option<StatusOverride> { ... }
fn suggest_rich(&mut self, ctx: Context) -> Vec<RichSuggestion> { ... }
fn status_rich(&mut self, ping: Ping) -> Option<RichStatusOverride> { ... }
fn http(&mut self, request: HttpRequest) -> Option<HttpResponse> { ... }
fn join(&mut self, ctx: Context) { ... }
fn after_transfer(&mut self, ctx: Context) { ... }
fn disconnect(&mut self, ctx: Context) { ... }
fn message(&mut self, message: BusMessage) { ... }
fn timer(&mut self, handle: u64) { ... }
fn event(&mut self, event: RiftEvent) { ... }
fn dialog(&mut self, response: DialogResponse) { ... }
fn chat(&mut self, attempt: ChatAttempt) -> Action { ... }
}Expand description
A Rift plugin. Implement the hooks you need and pass the type to
export!.
The instance is created with Default before Plugin::init; see the
crate documentation for how state is kept.
Provided Methods§
Sourcefn init(&mut self, config: &str) -> Result<Registration, String>
fn init(&mut self, config: &str) -> Result<Registration, String>
Called once per instance with the plugin’s configuration as JSON
({} without one). Create timers and bus subscriptions here.
Sourcefn reload(&mut self, config: &str) -> Result<(), String>
fn reload(&mut self, config: &str) -> Result<(), String>
The configuration changed and the manifest sets hot_reload = true.
Sourcefn route(&mut self, connection: Connection) -> RouteDecision
fn route(&mut self, connection: Connection) -> RouteDecision
A TCP connection was accepted, before any bytes are read.
Sourcefn initial_server(&mut self, ctx: Context) -> Action
fn initial_server(&mut self, ctx: Context) -> Action
Choose the first backend. Accepts continue, deny and server.
Sourcefn before_transfer(&mut self, ctx: Context) -> Action
fn before_transfer(&mut self, ctx: Context) -> Action
A transfer is about to happen. Accepts continue and deny.
Sourcefn command(&mut self, ctx: Context) -> Action
fn command(&mut self, ctx: Context) -> Action
A registered command ran. Accepts continue, message, server,
queue and leave-queue.
Sourcefn suggest(&mut self, ctx: Context) -> Vec<Suggestion>
fn suggest(&mut self, ctx: Context) -> Vec<Suggestion>
Complete an argument of a command registered with
SuggestKind::Dynamic.
Sourcefn status(&mut self, ping: Ping) -> Option<StatusOverride>
fn status(&mut self, ping: Ping) -> Option<StatusOverride>
A server-list ping; return the fields to replace.
Sourcefn suggest_rich(&mut self, ctx: Context) -> Vec<RichSuggestion>
fn suggest_rich(&mut self, ctx: Context) -> Vec<RichSuggestion>
Plugin::suggest with JSON text tooltips (since 0.1.4). The default
answers with Plugin::suggest.
Sourcefn status_rich(&mut self, ping: Ping) -> Option<RichStatusOverride>
fn status_rich(&mut self, ping: Ping) -> Option<RichStatusOverride>
Plugin::status with JSON text for the version and the player
sample (since 0.1.4). The default answers with Plugin::status.
Sourcefn http(&mut self, request: HttpRequest) -> Option<HttpResponse>
fn http(&mut self, request: HttpRequest) -> Option<HttpResponse>
An authenticated request to /api/script/*.
Sourcefn after_transfer(&mut self, ctx: Context)
fn after_transfer(&mut self, ctx: Context)
A transfer finished (see ctx.success).
Sourcefn disconnect(&mut self, ctx: Context)
fn disconnect(&mut self, ctx: Context)
A session closed (see ctx.reason).
Sourcefn message(&mut self, message: BusMessage)
fn message(&mut self, message: BusMessage)
A message arrived on a subscription made with bus::subscribe.
Sourcefn timer(&mut self, handle: u64)
fn timer(&mut self, handle: u64)
A timer made with timers::every or timers::after fired.
Sourcefn dialog(&mut self, response: DialogResponse)
fn dialog(&mut self, response: DialogResponse)
A player clicked a plugin action of a dialog this plugin showed with
players::show_dialog. Delivered without being listed in
Registration::hooks.
Sourcefn chat(&mut self, attempt: ChatAttempt) -> Action
fn chat(&mut self, attempt: ChatAttempt) -> Action
A player sent a chat message, or a command that neither Rift nor a
plugin owns, and the backend has not seen it yet (since 0.1.5).
Accepts continue, which lets it through unchanged, and deny
(Action::Deny, Action::deny_json), which drops it and shows
the player the text.
Called only for a plugin exported with export!(Type, chat); see the
crate documentation for what that requires of the
proxy. For a command, attempt.ctx.command is the root name and
attempt.ctx.args the rest.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".