private function cmdList(CommandSender $c, array $args) { $pageNumber = $this->getPageNumber($args); $signs = $this->owner->getSignCfg(); if (count($args) == 0) { $txt = [mc::n(mc::_("One LiveSign configured"), mc::_("%1% LiveSigns configured", count($signs)), count($signs))]; $cols = 8; $i = 0; foreach (array_keys($signs) as $n) { if ($i++ % $cols == 0) { $txt[] = $n; } else { $txt[count($txt) - 1] .= ", " . $n; } } return $this->paginateText($c, $pageNumber, $txt); } $txt = []; $count = 0; foreach ($args as $id) { if (!isset($signs[$id])) { $c->sendMessage(TextFormat::RED . mc::_("%1% not found", $id)); continue; } ++$count; $txt[] = TextFormat::AQUA . mc::_("LiveSign: ") . TextFormat::WHITE . $id; foreach (["type", "content"] as $tag) { if (isset($signs[$id][$tag])) { continue; } $txt[] = TextFormat::AQUA . mc::_("-Type: ") . TextFormat::RED . mc::_("*MISSING*"); } foreach ($signs[$id] as $tag => $val) { if (is_array($val)) { $txt[] = TextFormat::AQUA . "-{$tag}: "; if (self::isAssoc($val)) { foreach ($val as $j => $k) { $txt[] = TextFormat::AQUA . "- {$j}:" . TextFormat::WHITE . $k; } } else { foreach ($val as $k) { $txt[] = TextFormat::AQUA . "- -" . TextFormat::WHITE . $k; } } } else { $txt[] = TextFormat::AQUA . "-{$tag}: " . TextFormat::WHITE . $val; } } } if (count($txt) == 0) { $c->sendMessage(TextFormat::RED . mc::_("No matches")); return true; } if ($count > 1) { array_unshift($txt, mc::_("LiveSigns %1%", $count)); } return $this->paginateText($c, $pageNumber, $txt); }
public function getStats() { $txt = []; if ($this->fetcher === null) { $txt[] = mc::_("Fetcher not running"); } else { $txt[] = mc::_("Fetcher available: %1%", $this->fetcher->getTaskId()); if ($this->fetcher->isFinished()) { $txt[] = mc::_("- Fetcher Finished"); } } return $txt; }
private function idRm($c, $world, $id) { $ids = []; $cfg = $this->owner->getFloats()->getCfg(); if (!isset($cfg[$world])) { $c->sendMessage(mc::_("%1% not found", $world)); return true; } foreach ($cfg[$world] as $fid => $dat) { if ($dat["text"] == $id) { $ids[] = $fid; } } foreach ($ids as $j) { $c->sendMessage(mc::_("Deleting %1% from %2%", $j, $world)); $this->owner->getFloats()->rmFloat($world, $j); } return true; }