minecraft_command_types/command/
schedule.rs1use crate::command::enums::schedule_mode::ScheduleMode;
2use crate::resource_location::ResourceLocation;
3use crate::time::Time;
4use minecraft_command_types_derive::HasMacro;
5use std::fmt::{Display, Formatter};
6
7#[derive(Debug, Clone, Eq, PartialEq, Hash, HasMacro)]
8pub enum ScheduleCommand {
9 Function(ResourceLocation, Time, Option<ScheduleMode>),
10 Clear(ResourceLocation),
11}
12
13impl Display for ScheduleCommand {
14 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
15 match self {
16 ScheduleCommand::Function(location, time, mode) => {
17 write!(f, "function {} {}", location, time)?;
18
19 if let Some(mode) = mode {
20 write!(f, " {}", mode)?;
21 }
22
23 Ok(())
24 }
25 ScheduleCommand::Clear(location) => write!(f, "clear {}", location),
26 }
27 }
28}