mirror of
https://github.com/Pumpkin-MC/Pumpkin.git
synced 2026-08-30 20:14:23 +00:00
Merge pull request #72 from neeleshpoli/event-api
Created Identifier to help keep track of plugin resources.
This commit is contained in:
9
Cargo.lock
generated
9
Cargo.lock
generated
@@ -1986,6 +1986,7 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"extism",
|
||||
"log",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2418,9 +2419,9 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.205"
|
||||
version = "1.0.209"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e33aedb1a7135da52b7c21791455563facbbcc43d0f0f66165b42c21b3dfb150"
|
||||
checksum = "99fce0ffe7310761ca6bf9faf5115afbc19688edd00171d81b1bb1b116c63e09"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
@@ -2436,9 +2437,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.205"
|
||||
version = "1.0.209"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "692d6f5ac90220161d6774db30c662202721e64aed9058d2c394f451261420c1"
|
||||
checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
||||
@@ -17,3 +17,4 @@ tokio = { version = "1.39.2", features = ["net", "macros", "rt-multi-thread", "f
|
||||
rayon = "1.10.0"
|
||||
uuid = { version = "1.10.0", features = ["serde", "v3"] }
|
||||
derive_more = { version = "1.0.0", features = ["full"] }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
|
||||
@@ -4,7 +4,7 @@ version.workspace = true
|
||||
edition.workspace = true
|
||||
|
||||
[dependencies]
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde.workspace = true
|
||||
fastnbt = { git = "https://github.com/owengage/fastnbt.git" }
|
||||
uuid.workspace = true
|
||||
colored = "2"
|
||||
|
||||
@@ -5,4 +5,5 @@ edition.workspace = true
|
||||
|
||||
[dependencies]
|
||||
extism = "1.5.0"
|
||||
log.workspace = true
|
||||
log.workspace = true
|
||||
serde.workspace = true
|
||||
|
||||
15
pumpkin-plugin/src/api/identifer.rs
Normal file
15
pumpkin-plugin/src/api/identifer.rs
Normal file
@@ -0,0 +1,15 @@
|
||||
use extism::{convert::Msgpack, host_fn, FromBytes, ToBytes};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Used to keep track of things created by plugins.
|
||||
/// This can include things like events, commands, etc.
|
||||
#[derive(Hash, PartialEq, Eq, ToBytes, FromBytes, Serialize, Deserialize)]
|
||||
#[encoding(Msgpack)] // TODO: Switch to protocal buffers for smaller size
|
||||
struct Identifier {
|
||||
namespace: String,
|
||||
path: String,
|
||||
}
|
||||
|
||||
host_fn!(new(namespace: String, path: String) -> Result<Identifier, _> {
|
||||
Ok(Identifier { namespace, path })
|
||||
});
|
||||
1
pumpkin-plugin/src/api/mod.rs
Normal file
1
pumpkin-plugin/src/api/mod.rs
Normal file
@@ -0,0 +1 @@
|
||||
mod identifer;
|
||||
@@ -1,3 +1,5 @@
|
||||
mod api;
|
||||
|
||||
use std::path::Path;
|
||||
|
||||
use extism::{Manifest, Plugin, Wasm};
|
||||
|
||||
@@ -12,7 +12,7 @@ bytes = "1.7"
|
||||
|
||||
uuid.workspace = true
|
||||
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde.workspace = true
|
||||
# to parse strings to json responses
|
||||
serde_json = "1.0"
|
||||
|
||||
|
||||
@@ -11,4 +11,4 @@ pumpkin-core = { path = "../pumpkin-core"}
|
||||
fastnbt = { git = "https://github.com/owengage/fastnbt.git" }
|
||||
fastsnbt = "0.2"
|
||||
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde.workspace = true
|
||||
|
||||
@@ -16,7 +16,7 @@ itertools = "0.13.0"
|
||||
thiserror = "1.0.63"
|
||||
futures = "0.3.30"
|
||||
flate2 = "1.0.33"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde.workspace = true
|
||||
serde_json = "1.0"
|
||||
static_assertions = "1.1.0"
|
||||
log.workspace = true
|
||||
|
||||
@@ -19,7 +19,7 @@ pumpkin-protocol = { path = "../pumpkin-protocol"}
|
||||
pumpkin-registry = { path = "../pumpkin-registry"}
|
||||
|
||||
# config
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde.workspace = true
|
||||
serde_json = "1.0"
|
||||
toml = "0.8.19"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user