/**
  * @param int $currentTick
  */
 public function onRun($currentTick)
 {
     if (!$this->plugin->isTimerPaused()) {
         if (Utils::isOverloaded($this->plugin->getMemoryLimit())) {
             $this->plugin->initiateRestart(RestartMe::OVERLOADED);
         }
     }
 }
 /**
  * @param CommandSender $sender
  * @param string $label
  * @param string[] $args
  * @return bool
  */
 public function execute(CommandSender $sender, $label, array $args)
 {
     if (!$this->testPermission($sender)) {
         return false;
     }
     if (isset($args[0])) {
         switch (strtolower($args[0])) {
             case "a":
             case "add":
                 if (isset($args[1])) {
                     if (is_numeric($args[1])) {
                         $time = (int) $args[1];
                         $this->plugin->addTime($time);
                         $sender->sendMessage(TextFormat::GREEN . "Added " . $time . " to restart timer.");
                     } else {
                         $sender->sendMessage(TextFormat::RED . "Time value must be numeric.");
                     }
                 } else {
                     $sender->sendMessage(TextFormat::RED . "Please specify a time value.");
                 }
                 return true;
             case "help":
                 $this->sendCommandHelp($sender);
                 return true;
             case "m":
             case "memory":
                 $memLimit = $this->plugin->getMemoryLimit();
                 $sender->sendMessage("Bytes: " . memory_get_usage(true) . "/" . Utils::calculateBytes($memLimit));
                 $sender->sendMessage("Memory-limit: " . $memLimit);
                 $sender->sendMessage("Overloaded: " . (Utils::isOverloaded($memLimit) ? TextFormat::GREEN . "yes" : TextFormat::RED . "no"));
                 return true;
             case "set":
                 if (isset($args[1])) {
                     if (is_numeric($args[1])) {
                         $time = (int) $args[1];
                         $this->plugin->setTime($time);
                         $sender->sendMessage(TextFormat::GREEN . "Set restart timer to " . $time . ".");
                     } else {
                         $sender->sendMessage(TextFormat::RED . "Time value must be numeric.");
                     }
                 } else {
                     $sender->sendMessage(TextFormat::RED . "Please specify a time value.");
                 }
                 return true;
             case "start":
                 if ($this->plugin->isTimerPaused()) {
                     $this->plugin->setPaused(false);
                     $sender->sendMessage(TextFormat::YELLOW . "Timer is no longer paused.");
                 } else {
                     $sender->sendMessage(TextFormat::RED . "Timer is not paused.");
                 }
                 return true;
             case "stop":
                 if ($this->plugin->isTimerPaused()) {
                     $sender->sendMessage(TextFormat::RED . "Timer is already paused.");
                 } else {
                     $this->plugin->setPaused(true);
                     $sender->sendMessage(TextFormat::YELLOW . "Timer has been paused.");
                 }
                 return true;
             case "s":
             case "subtract":
                 if (isset($args[1])) {
                     if (is_numeric($args[1])) {
                         $time = (int) $args[1];
                         $this->plugin->subtractTime($time);
                         $sender->sendMessage(TextFormat::GREEN . "Subtracted " . $time . " from restart timer.");
                     } else {
                         $sender->sendMessage(TextFormat::RED . "Time value must be numeric.");
                     }
                 } else {
                     $sender->sendMessage(TextFormat::RED . "Please specify a time value.");
                 }
                 return true;
             case "t":
             case "time":
                 $sender->sendMessage(TextFormat::YELLOW . "Time remaining: " . $this->plugin->getFormattedTime());
                 return true;
             default:
                 $sender->sendMessage("Usage: /restartme <sub-command> [parameters]");
                 return false;
         }
     } else {
         $this->sendCommandHelp($sender);
         return false;
     }
 }