2020-12-12 13:01:54 +00:00
|
|
|
pub extern crate plugin_rt;
|
|
|
|
|
|
|
|
use plugin_rt::*;
|
|
|
|
use plugin_api::{Action, events::*};
|
2020-12-09 20:47:42 +00:00
|
|
|
|
2020-12-11 23:37:22 +00:00
|
|
|
#[export_function]
|
|
|
|
pub fn on_load(load: PluginLoadEvent) -> () {
|
|
|
|
send_actions(vec![Action::Print("This is a test".to_owned())]);
|
|
|
|
println!("Hello world");
|
|
|
|
}
|
|
|
|
|
|
|
|
#[export_function]
|
|
|
|
pub fn on_player_join(input: PlayerJoinEvent) -> PlayerJoinResult {
|
|
|
|
send_actions(vec![Action::PlayerSendMessage(input.player_id,format!("Welcome {} on our server",input.player_name))]);
|
|
|
|
if input.player_name == "Cheater123" {
|
|
|
|
PlayerJoinResult::CloseConnection
|
|
|
|
} else {
|
|
|
|
PlayerJoinResult::None
|
|
|
|
}
|
2020-12-09 20:47:42 +00:00
|
|
|
}
|