Skip to content

Commit

Permalink
Very small cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
Urpagin committed Dec 11, 2024
1 parent 159ce6b commit 4755ae9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 69 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ session.lock
version.json
eula.txt

src/server.properties

# macOS files
.DS_Store

Expand Down
2 changes: 1 addition & 1 deletion src/fs_manager/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ pub fn write_ops_json(
.read(true)
.write(true)
.truncate(true)
.open(consts::file_paths::OPERATORS)?;
.open(filename)?;

let mut content = String::new();
file.read_to_string(&mut content)?;
Expand Down
9 changes: 4 additions & 5 deletions src/net/packet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ pub mod data_types;
pub mod utils;

use core::fmt;
use std::{collections::VecDeque, fmt::Debug, io::Read, vec};
use std::{collections::VecDeque, fmt::Debug};

use bytes::BytesMut;
use data_types::varint;
use image::error;
use log::warn;
use thiserror::Error;

Expand Down Expand Up @@ -48,12 +47,12 @@ pub struct Packet {

impl Packet {
/// Initalizes a new `Packet` by parsing the `data` buffer.
pub fn new(data: &[u8]) -> Result<Self, PacketError> {
let parsed = Self::parse_packet(&data)?;
pub fn new<T: AsRef<[u8]>>(data: T) -> Result<Self, PacketError> {
let parsed = Self::parse_packet(data.as_ref())?;
Ok(Self {
length: parsed.0,
id: parsed.1,
data: data.into(),
data: data.as_ref().into(),
payload: parsed.2.into(),
})
}
Expand Down
63 changes: 0 additions & 63 deletions src/server.properties

This file was deleted.

0 comments on commit 4755ae9

Please sign in to comment.