57 if($args[0] ===
"start"){
58 if(!$this->testPermission($sender, DefaultPermissionNames::COMMAND_TIME_START)){
61 foreach($sender->getServer()->getWorldManager()->getWorlds() as $world){
64 Command::broadcastCommandMessage($sender,
"Restarted the time");
66 }elseif($args[0] ===
"stop"){
67 if(!$this->testPermission($sender, DefaultPermissionNames::COMMAND_TIME_STOP)){
70 foreach($sender->getServer()->getWorldManager()->getWorlds() as $world){
73 Command::broadcastCommandMessage($sender,
"Stopped the time");
75 }elseif($args[0] ===
"query"){
76 if(!$this->testPermission($sender, DefaultPermissionNames::COMMAND_TIME_QUERY)){
79 if($sender instanceof
Player){
80 $world = $sender->getWorld();
82 $world = $sender->getServer()->getWorldManager()->getDefaultWorld();
84 $sender->sendMessage($sender->getLanguage()->translate(KnownTranslationFactory::commands_time_query((
string) $world->getTime())));
92 if($args[0] ===
"set"){
93 if(!$this->testPermission($sender, DefaultPermissionNames::COMMAND_TIME_SET)){
99 $value = World::TIME_DAY;
102 $value = World::TIME_NOON;
105 $value = World::TIME_SUNSET;
108 $value = World::TIME_NIGHT;
111 $value = World::TIME_MIDNIGHT;
114 $value = World::TIME_SUNRISE;
117 $value = $this->getInteger($sender, $args[1], 0);
121 foreach($sender->getServer()->getWorldManager()->getWorlds() as $world){
122 $world->setTime($value);
124 Command::broadcastCommandMessage($sender, KnownTranslationFactory::commands_time_set((
string) $value));
125 }elseif($args[0] ===
"add"){
126 if(!$this->testPermission($sender, DefaultPermissionNames::COMMAND_TIME_ADD)){
130 $value = $this->getInteger($sender, $args[1], 0);
131 foreach($sender->getServer()->getWorldManager()->getWorlds() as $world){
132 $world->setTime($world->getTime() + $value);
134 Command::broadcastCommandMessage($sender, KnownTranslationFactory::commands_time_added((
string) $value));