clippy and format
This commit is contained in:
parent
bb6677dd19
commit
4551d0bd0d
@ -4,9 +4,7 @@ use itertools::Itertools;
|
||||
use num_traits::Euclid;
|
||||
use pumpkin_world::item::ItemStack;
|
||||
use std::collections::HashMap;
|
||||
use std::iter::{Enumerate, Filter, TakeWhile};
|
||||
use std::sync::{Arc, Mutex, RwLock};
|
||||
use std::vec::IntoIter;
|
||||
#[derive(Debug, Default)]
|
||||
pub struct DragHandler(RwLock<HashMap<u64, Arc<Mutex<Drag>>>>);
|
||||
|
||||
@ -76,7 +74,7 @@ impl DragHandler {
|
||||
let Some((_, drag)) = drags.remove_entry(container_id) else {
|
||||
Err(InventoryError::OutOfOrderDragging)?
|
||||
};
|
||||
let mut drag = drag.lock().unwrap();
|
||||
let drag = drag.lock().unwrap();
|
||||
|
||||
if player != drag.player {
|
||||
Err(InventoryError::MultiplePlayersDragging)?
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
use crate::container_click::{MouseClick, MouseDragState, MouseDragType};
|
||||
use crate::container_click::MouseClick;
|
||||
use crate::player::PlayerInventory;
|
||||
use num_derive::{FromPrimitive, ToPrimitive};
|
||||
use pumpkin_world::item::ItemStack;
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
use crate::drag_handler::DragHandler;
|
||||
use crate::{Container, WindowType};
|
||||
use pumpkin_world::item::ItemStack;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::sync::Mutex;
|
||||
|
||||
pub struct OpenContainer {
|
||||
players: Vec<i32>,
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
use crate::container_click::MouseClick;
|
||||
use crate::drag_handler::DragHandler;
|
||||
use crate::{handle_item_change, Container, InventoryError, WindowType};
|
||||
use pumpkin_world::item::ItemStack;
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@ use crate::server::Server;
|
||||
use itertools::Itertools;
|
||||
use pumpkin_core::text::TextComponent;
|
||||
use pumpkin_core::GameMode;
|
||||
use pumpkin_inventory::container_click::{KeyClick, MouseClick, MouseDragState, MouseDragType};
|
||||
use pumpkin_inventory::container_click::{KeyClick, MouseClick, MouseDragState};
|
||||
use pumpkin_inventory::drag_handler::DragHandler;
|
||||
use pumpkin_inventory::window_property::{WindowProperty, WindowPropertyTrait};
|
||||
use pumpkin_inventory::{container_click, InventoryError, OptionallyCombinedContainer};
|
||||
@ -14,7 +14,7 @@ use pumpkin_protocol::client::play::{
|
||||
use pumpkin_protocol::server::play::SClickContainer;
|
||||
use pumpkin_protocol::slot::Slot;
|
||||
use pumpkin_world::item::ItemStack;
|
||||
use std::sync::{Arc, Mutex, MutexGuard};
|
||||
use std::sync::Mutex;
|
||||
|
||||
impl Player {
|
||||
pub fn open_container(
|
||||
|
||||
@ -452,7 +452,8 @@ impl Player {
|
||||
Ok(())
|
||||
}
|
||||
SClickContainer::PACKET_ID => {
|
||||
self.handle_click_container(server, SClickContainer::read(bytebuf)?);
|
||||
self.handle_click_container(server, SClickContainer::read(bytebuf)?)
|
||||
.unwrap();
|
||||
Ok(())
|
||||
}
|
||||
SCloseContainer::PACKET_ID => {
|
||||
|
||||
@ -16,7 +16,7 @@ use std::{
|
||||
path::Path,
|
||||
sync::{
|
||||
atomic::{AtomicI32, Ordering},
|
||||
Arc, Mutex, MutexGuard,
|
||||
Arc, Mutex,
|
||||
},
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user