-
-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into block_actions
- Loading branch information
Showing
49 changed files
with
882 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
use pumpkin_core::permission::PermissionLvl; | ||
use serde::{Deserialize, Serialize}; | ||
use uuid::Uuid; | ||
|
||
#[derive(Serialize, Deserialize, Clone, Default)] | ||
pub struct Op { | ||
pub uuid: Uuid, | ||
pub name: String, | ||
pub level: PermissionLvl, | ||
pub bypasses_player_limit: bool, | ||
} | ||
|
||
impl Op { | ||
pub fn new( | ||
uuid: Uuid, | ||
name: String, | ||
level: PermissionLvl, | ||
bypasses_player_limit: bool, | ||
) -> Self { | ||
Self { | ||
uuid, | ||
name, | ||
level, | ||
bypasses_player_limit, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
use num_derive::{FromPrimitive, ToPrimitive}; | ||
use serde::{Deserialize, Deserializer, Serialize, Serializer}; | ||
|
||
/// Represents the player's permission level | ||
/// | ||
/// Permission levels determine the player's access to commands and server operations. | ||
/// Each numeric level corresponds to a specific role: | ||
/// - `Zero`: `normal`: Player can use basic commands. | ||
/// - `One`: `moderator`: Player can bypass spawn protection. | ||
/// - `Two`: `gamemaster`: Player or executor can use more commands and player can use command blocks. | ||
/// - `Three`: `admin`: Player or executor can use commands related to multiplayer management. | ||
/// - `Four`: `owner`: Player or executor can use all of the commands, including commands related to server management. | ||
#[derive(FromPrimitive, ToPrimitive, Clone, Copy, Default, PartialEq, Eq)] | ||
#[repr(i8)] | ||
pub enum PermissionLvl { | ||
#[default] | ||
Zero = 0, | ||
One = 1, | ||
Two = 2, | ||
Three = 3, | ||
Four = 4, | ||
} | ||
|
||
impl PartialOrd for PermissionLvl { | ||
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> { | ||
(*self as u8).partial_cmp(&(*other as u8)) | ||
} | ||
} | ||
|
||
impl Serialize for PermissionLvl { | ||
fn serialize<S>(&self, serializer: S) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> | ||
where | ||
S: Serializer, | ||
{ | ||
serializer.serialize_u8(*self as u8) | ||
} | ||
} | ||
|
||
impl<'de> Deserialize<'de> for PermissionLvl { | ||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> | ||
where | ||
D: Deserializer<'de>, | ||
{ | ||
let value = u8::deserialize(deserializer)?; | ||
match value { | ||
0 => Ok(PermissionLvl::Zero), | ||
2 => Ok(PermissionLvl::Two), | ||
3 => Ok(PermissionLvl::Three), | ||
4 => Ok(PermissionLvl::Four), | ||
_ => Err(serde::de::Error::custom(format!( | ||
"Invalid value for OpLevel: {}", | ||
value | ||
))), | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// TODO | ||
// TODO make this dynamic | ||
#[derive(Clone)] | ||
#[repr(i32)] | ||
pub enum EntityType { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,4 +30,4 @@ aes = "0.8.4" | |
cfb8 = "0.8.1" | ||
|
||
# decryption | ||
libdeflater = "1.22.0" | ||
libdeflater = "1.23.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.