Fix clippy and fmt issues
- Use Option::map instead of manual if-let-some in config callback - Remove unused itemstack re-export - Apply cargo fmt
This commit is contained in:
parent
640d6268ab
commit
fff0592875
@ -6,8 +6,9 @@ use crate::{
|
|||||||
pub fn ffi_native_bridge_get_patch_bukkit_config_impl(
|
pub fn ffi_native_bridge_get_patch_bukkit_config_impl(
|
||||||
_request: EmptyRequest,
|
_request: EmptyRequest,
|
||||||
) -> Option<GetPatchBukkitConfigResponse> {
|
) -> Option<GetPatchBukkitConfigResponse> {
|
||||||
if let Some(context) = CALLBACK_CONTEXT.get() {
|
CALLBACK_CONTEXT
|
||||||
Some(GetPatchBukkitConfigResponse {
|
.get()
|
||||||
|
.map(|context| GetPatchBukkitConfigResponse {
|
||||||
minimum_supported_plugin_api: context
|
minimum_supported_plugin_api: context
|
||||||
.config
|
.config
|
||||||
.settings
|
.settings
|
||||||
@ -15,7 +16,4 @@ pub fn ffi_native_bridge_get_patch_bukkit_config_impl(
|
|||||||
.clone()
|
.clone()
|
||||||
.unwrap_or("0.0.0".to_string()),
|
.unwrap_or("0.0.0".to_string()),
|
||||||
})
|
})
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,7 +37,6 @@ pub mod config;
|
|||||||
pub use config::*;
|
pub use config::*;
|
||||||
|
|
||||||
pub mod itemstack;
|
pub mod itemstack;
|
||||||
pub use itemstack::*;
|
|
||||||
|
|
||||||
static CALLBACK_CONTEXT: OnceLock<CallbackContext> = OnceLock::new();
|
static CALLBACK_CONTEXT: OnceLock<CallbackContext> = OnceLock::new();
|
||||||
|
|
||||||
|
|||||||
@ -279,17 +279,13 @@ impl CommandManager {
|
|||||||
);
|
);
|
||||||
let j_player = jvm.create_instance(
|
let j_player = jvm.create_instance(
|
||||||
"org.patchbukkit.entity.PatchBukkitPlayer",
|
"org.patchbukkit.entity.PatchBukkitPlayer",
|
||||||
&[
|
&[InvocationArg::from(j_uuid), InvocationArg::try_from(name)?],
|
||||||
InvocationArg::from(j_uuid),
|
|
||||||
InvocationArg::try_from(name)?,
|
|
||||||
],
|
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
jvm.invoke(
|
jvm.invoke(
|
||||||
&j_player,
|
&j_player,
|
||||||
"setOp",
|
"setOp",
|
||||||
&[InvocationArg::try_from(true)?
|
&[InvocationArg::try_from(true)?.into_primitive()?],
|
||||||
.into_primitive()?],
|
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
jvm.invoke(
|
jvm.invoke(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user