Skip to content

Commit

Permalink
Multiple signs!
Browse files Browse the repository at this point in the history
  • Loading branch information
xpyctum committed Aug 22, 2015
1 parent 6d89962 commit 4c9574f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/SignStatus/SignStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
─███──█──────█───█──█──█──█─█─█───█
██─██─█──────█───████──█──███─█───█
*/
//TODO: Make multisigns and configurable format of sign
//TODO: Make configurable format of sign
class SignStatus extends PluginBase implements Listener{

/** @var Config sign */
Expand Down
23 changes: 10 additions & 13 deletions src/SignStatus/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,16 @@ public function __construct(SignStatus $plugin){
public function onRun($currentTick){
$val = $this->plugin->sign->get("sign")["enabled"];
if($val == "true" || $val == true){
$x = $this->plugin->sign->get("sign")["x"];
$y = $this->plugin->sign->get("sign")["y"];
$z = $this->plugin->sign->get("sign")["z"];
$lvz = $this->plugin->sign->get("sign")["level"];
$tps = Server::getInstance()->getTicksPerSecond();
$p = count(Server::getInstance()->getOnlinePlayers());
$full = Server::getInstance()->getMaxPlayers();
$level = Server::getInstance()->getLevelByName($lvz);
if($level instanceof Level) {
$sign = $level->getTile(new Vector3($x, $y, $z));
$count = $this->countable++; //For debug
if ($sign instanceof Sign) {
$sign->setText(F::GREEN."[STATUS]", F::YELLOW."TPS: [".$tps."]", F::AQUA."ONLINE: ".F::GREEN.$p.F::WHITE."/".F::RED.$full."", F::GOLD.$count);
foreach($this->plugin->getServer()->getDefaultLevel()->getTiles() as $tile){
if($tile instanceof Sign){
if($tile->getText()[0] == F::GREEN."[STATUS]"){
$tps = Server::getInstance()->getTicksPerSecond();
$p = count(Server::getInstance()->getOnlinePlayers());
$full = Server::getInstance()->getMaxPlayers();
$count = $this->countable++; //For debug
$load = $this->plugin->getServer()->getTickUsage();
$tile->setText(F::GREEN."[STATUS]", F::YELLOW."TPS: [".$tps."]", F::AQUA."ONLINE: ".F::GREEN.$p.F::WHITE."/".F::RED.$full."", F::GOLD."LOAD: ".F::DARK_BLUE.$load. " %");
}
}
}
}
Expand Down

0 comments on commit 4c9574f

Please sign in to comment.