Help plz!
<?php require_once("java/util/ArrayList.php"); require_once("java/util/logging/Logger.php"); require_once("org/bukkit/entity/Player.php"); class SimpleRestartCommandListener implements CommandExecutor { protected $plugin; // SimpleRestart private function __init() { // default class members } public static function __staticinit() { // static class members } public static function constructor__ef3247dd ($instance) // [SimpleRestart instance] { $me = new self(); $me->__init(); $me->plugin = $instance; return $me; } public function onCommand ($sender, $command, $label, $args) // [CommandSender sender, Command command, String label, String args[]] { if (($label->equalsIgnoreCase("restart") || $label->equalsIgnoreCase("reboot"))) { if (((count($args) /*from: args.length*/ == 1) && $args[0]->equalsIgnoreCase("now"))) { if ((($sender instanceof Player) && !$this->plugin->hasPermission($sender, "simplerestart.restart"))) { $this->plugin->returnMessage($sender, "&cYou don't have permission to do that!"); return TRUE ; } else { $this->plugin->returnMessage($sender, "&cOk, you asked for it!"); $this->plugin->stopServer(); return TRUE ; } } if (((count($args) /*from: args.length*/ == 1) && $args[0]->equalsIgnoreCase("time"))) { if ((($sender instanceof Player) && !$this->plugin->hasPermission($sender, "simplerestart.time"))) { $this->plugin->returnMessage($sender, "&cYou don't have permission to do that!"); return TRUE ; } if (!$this->plugin->autoRestart) { $this->plugin->returnMessage($sender, "&cThere is no auto-restart scheduled!"); return TRUE ; } else { $timeLeft = (($this->plugin->restartInterval * 3600D) - (((round(microtime(true) * 1000) - $this->plugin->startTimestamp)) / 1000D)); $hours = (($timeLeft / 3600D)); $minutes = (((($timeLeft - (($hours * 3600)))) / 60D)); $seconds = ($timeLeft % 60); $this->plugin->returnMessage($sender, (new StringBuilder("&bThe server will be restarting in &f"))::append($hours)->append("h")->append($minutes)->append("m")->append($seconds)->append("s")->toString()); return TRUE ; } } if (((count($args) /*from: args.length*/ == 1) && $args[0]->equalsIgnoreCase("help"))) { if ((($sender instanceof Player) && !$this->plugin->hasPermission($sender, "simplerestart.restart"))) { $this->plugin->returnMessage($sender, "&cYou don't have permission to do that!"); return TRUE ; } else { $this->showHelp($sender); return TRUE ; } } if (((count($args) /*from: args.length*/ == 1) && $args[0]->equalsIgnoreCase("on"))) { if ((($sender instanceof Player) && !$this->plugin->hasPermission($sender, "simplerestart.restart"))) { $this->plugin->returnMessage($sender, "&cYou don't have permission to do that!"); return TRUE ; } if ($this->plugin->autoRestart) { $this->plugin->returnMessage($sender, "&cThe server was already automatically restarting!"); return TRUE ; } else { $this->plugin->autoRestart = TRUE ; $this->plugin->log->info("[SimpleRestart] reloading configuration.."); $this->plugin->loadConfiguration(); $this->plugin->log->info("[SimpleRestart] scheduling restart tasks..."); $this->plugin->scheduleTasks(); $this->plugin->returnMessage($sender, "&bAutomatic restarts have been turned on!"); $this->plugin->log->info((new StringBuilder("[SimpleRestart] "))::append($sender->toString())->append(" turned automatic restarts on!")->toString()); $timeLeft = (($this->plugin->restartInterval * 3600D) - (((round(microtime(true) * 1000) - $this->plugin->startTimestamp)) / 1000D)); $hours = (($timeLeft / 3600D)); $minutes = (((($timeLeft - (($hours * 3600)))) / 60D)); $seconds = ($timeLeft % 60); $this->plugin->returnMessage($sender, (new StringBuilder("&bThe server will be restarting in &f"))::append($hours)->append("h")->append($minutes)->append("m")->append($seconds)->append("s")->toString()); return TRUE ; } } if (((count($args) /*from: args.length*/ == 1) && $args[0]->equalsIgnoreCase("off"))) { if ((($sender instanceof Player) && !$this->plugin->hasPermission($sender, "simplerestart.restart"))) { $this->plugin->returnMessage($sender, "&cYou don't have permission to do that!"); return TRUE ; } if (!$this->plugin->autoRestart) { $this->plugin->returnMessage($sender, "&cThe server already wasn't automatically restarting!"); return TRUE ; } else { $this->plugin->cancelTasks(); $this->plugin->returnMessage($sender, "&bAutomatic restarts have been turned off!"); $this->plugin->log->info((new StringBuilder("[SimpleRestart] "))::append($sender->toString())->append(" turned automatic restarts off!")->toString()); return TRUE ; } } if ((count($args) /*from: args.length*/ == 2)) { if ((($sender instanceof Player) && !$this->plugin->hasPermission($sender, "simplerestart.restart"))) { $this->plugin->returnMessage($sender, "&cYou don't have permission to do that!"); return TRUE ; } $timeFormat = $args[0]; $timeAmount = 0.0D; try { $timeAmount = $Double->parseDouble($args[1]); } catch (Exception $e) { $this->plugin->returnMessage($sender, "&cBad time!"); return TRUE ; } $restartTime = 0.0D; if ($timeFormat->equalsIgnoreCase("h")) { $restartTime = ($timeAmount * 3600D); } else if ($timeFormat->equalsIgnoreCase("m")) { $restartTime = ($timeAmount * 60D); } else if ($timeFormat->equalsIgnoreCase("s")) { $restartTime = $timeAmount; } else { $this->plugin->returnMessage($sender, "&cInvalid time scale!"); $this->plugin->returnMessage($sender, "&bUse 'h' for time in hours, etc"); return TRUE ; } $this->plugin->log->info((new StringBuilder("[SimpleRestart] "))::append($sender->toString())->append(" is setting a new restart time...")->toString()); if ($this->plugin->autoRestart) { $this->plugin->cancelTasks(); } $this->plugin->restartInterval = ($restartTime / 3600D); $this->plugin->log->info("[SimpleRestart] scheduling restart tasks..."); $this->plugin->scheduleTasks(); $timeLeft = (($this->plugin->restartInterval * 3600D) - (((round(microtime(true) * 1000) - $this->plugin->startTimestamp)) / 1000D)); $hours = (($timeLeft / 3600D)); $minutes = (((($timeLeft - (($hours * 3600)))) / 60D)); $seconds = ($timeLeft % 60); $this->plugin->returnMessage($sender, (new StringBuilder("&bThe server will now be restarting in &f"))::append($hours)->append("h")->append($minutes)->append("m")->append($seconds)->append("s")->toString()); return TRUE ; } } else if ($label->equalsIgnoreCase("memory")) { if ((($sender instanceof Player) && !$this->plugin->hasPermission($sender, "simplerestart.memory"))) { $this->plugin->returnMessage($sender, "&cYou don't have permission to do that!"); return TRUE ; } else { $freeMemory = ($Runtime->getRuntime()->freeMemory() / 1048576F); $totalMemory = ($Runtime->getRuntime()->totalMemory() / 1048576F); $maxMemory = ($Runtime->getRuntime()->maxMemory() / 1048576F); $this->plugin->returnMessage($sender, (new StringBuilder("&cFree memory: &f"))::append($String->format("%.1f", array( [$Float->valueOf($freeMemory)] )))->append("MB")->toString()); $this->plugin->returnMessage($sender, (new StringBuilder("&cTotal memory: &f"))::append($String->format("%.1f", array( [$Float->valueOf($totalMemory)] )))->append("MB")->toString()); $this->plugin->returnMessage($sender, (new StringBuilder("&cMax memory: &f"))::append($String->format("%.1f", array( [$Float->valueOf($maxMemory)] )))->append("MB")->toString()); return TRUE ; } } $this->plugin->returnMessage($sender, "&cInvalid command usage!"); $this->showHelp($sender); return TRUE ; } protected function showHelp ($sender) // [CommandSender sender] { $this->plugin->returnMessage($sender, "&f--- &3Restart &bHelp &f---"); $helpList = new ArrayList(); $helpList->add(HelpItem::constructor__79c13ff("&3/restart &bhelp", "&7shows this help")); $helpList->add(HelpItem::constructor__79c13ff("&3/restart &bnow", "&7restarts the server NOW")); $helpList->add(HelpItem::constructor__79c13ff("&3/restart &btime", "&7informs you how much time is left before restarting")); $helpList->add(HelpItem::constructor__79c13ff("&3/restart &7(&bh&7|&bm&7|&bs&7) &f", "&7restarts the server after a given amount of time")); $helpList->add(HelpItem::constructor__79c13ff("&3/restart &bon", "&7turns auto-restarts on")); $helpList->add(HelpItem::constructor__79c13ff("&3/restart &boff", "&7turns auto-restarts off")); for ($i = 0; ($i < $helpList->size()); ++$i) { $this->plugin->returnMessage($sender, ($helpList->get($i))::$command); $this->plugin->returnMessage($sender, (new StringBuilder(" "))::append(($helpList->get($i))::$description)->toString()); } } } SimpleRestartCommandListener::__staticinit(); // initialize static vars for this class on load ?>Yet another post of
http://www.phphelp.com/forum/general-php-help/unexpected-t_string-in-code/msg78674/#msg78674
Stop posting the same thing more than once.