aboutsummaryrefslogtreecommitdiff
path: root/azalea-core/src/objectives.rs
diff options
context:
space:
mode:
Diffstat (limited to 'azalea-core/src/objectives.rs')
-rw-r--r--azalea-core/src/objectives.rs33
1 files changed, 33 insertions, 0 deletions
diff --git a/azalea-core/src/objectives.rs b/azalea-core/src/objectives.rs
new file mode 100644
index 00000000..dd1534f2
--- /dev/null
+++ b/azalea-core/src/objectives.rs
@@ -0,0 +1,33 @@
+use std::{
+ fmt::{self, Display, Formatter},
+ str::FromStr,
+};
+
+use azalea_buf::McBuf;
+
+#[derive(Clone, Copy, Debug, McBuf)]
+pub enum ObjectiveCriteria {
+ Integer,
+ Hearts,
+}
+
+impl Display for ObjectiveCriteria {
+ fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
+ match self {
+ ObjectiveCriteria::Integer => write!(f, "integer"),
+ ObjectiveCriteria::Hearts => write!(f, "hearts"),
+ }
+ }
+}
+
+impl FromStr for ObjectiveCriteria {
+ type Err = ();
+
+ fn from_str(s: &str) -> Result<Self, Self::Err> {
+ match s {
+ "integer" => Ok(ObjectiveCriteria::Integer),
+ "hearts" => Ok(ObjectiveCriteria::Hearts),
+ _ => Err(()),
+ }
+ }
+}