Moved plugin API to Uid instead of usize for entity IDs, hello plugin to an example

This commit is contained in:
Joshua Barretto
2020-12-13 23:08:15 +00:00
parent 023888f560
commit fc96fd780b
13 changed files with 18 additions and 1621 deletions

View File

@ -5,8 +5,8 @@ use serde::{de::DeserializeOwned, Deserialize, Serialize};
pub enum Action {
ServerClose,
Print(String),
PlayerSendMessage(usize, String),
KillEntity(usize),
PlayerSendMessage(Uid, String),
KillEntity(Uid),
}
pub trait Event: Serialize + DeserializeOwned + Send + Sync {
@ -38,7 +38,7 @@ pub mod event {
#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)]
pub struct PlayerJoinEvent {
pub player_name: String,
pub player_id: usize,
pub player_id: Uid,
}
impl Event for PlayerJoinEvent {