diff --git a/RealTime/README.md b/RealTime/README.md deleted file mode 100644 index 6aff247..0000000 --- a/RealTime/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# RealTime - -Extracted plugin from old PocketMine and minor update to work on PMMP - -### CREDIT! ### -Extracted plugin from old PocketMine and minor update to work on PMMP. ***Credits - this belongs to Guillaume351 but I couldn't find a git repo to fork from. - -### USAGE ### -/hour - get the hour -/rt - enable - enable sync with server time - sunrise - set to sunrise - sunset - set to sunset - day - set to midday - night - set to midnight - disable - go back to normal pmmp time - lock - freeze the time diff --git a/RealTime/config.yml b/RealTime/config.yml deleted file mode 100644 index c62bdda..0000000 --- a/RealTime/config.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -Time changes: 0 -Tell time: true -Tell time interval in minuts: 5 -... diff --git a/RealTime/plugin.yml b/RealTime/plugin.yml deleted file mode 100644 index 8b69678..0000000 --- a/RealTime/plugin.yml +++ /dev/null @@ -1,29 +0,0 @@ -#name, main, version and api are required -name: RealTime -main: RealTime\MainClass -version: 2.1.3 -api: [3.0.0, 4.0.0] -load: POSTWORLD -author: Guillaume351 -description: Take control of the time - - -commands: - rt: - description: Lock the time - usage: "Usage: /rt enable/sunrise/sunset/day/night/disable/lock" - permission: realtime.command.rt - hour: - description: Get tell the hour - usage: "Usage : /hour" - permission: realtime.command.hour - - - -permissions: - realtime.command.rt: - description: "Allows the user to run the rt command to control the time" - default: op - realtime.command.hour : - description : "Allows the users to run the hour command to get tell the hour" - default: true diff --git a/RealTime/src/RealTime/MainClass.php b/RealTime/src/RealTime/MainClass.php deleted file mode 100644 index 6929909..0000000 --- a/RealTime/src/RealTime/MainClass.php +++ /dev/null @@ -1,426 +0,0 @@ -getDataFolder()); // Creation dossier contenant config - - - $this->getLogger()->info(TextFormat::DARK_GREEN . "RealTime enabled."); - - - $this->config = new Config($this->getDataFolder() . "config.yml", Config::YAML, array() ); - - - if ($this->config->__isset('Time changes')== false){ - - $this->config->set('Time changes', +0); - } - - - if ($this->config->__isset('Tell time')==false){ - $this->config->set('Tell time', true); - } - - - if ($this->config->__isset('Tell time interval in minuts')==false){ - $this->config->set('Tell time interval in minuts', 5); - } - - $this->config->save(); - - - - - $tTimeInterval = $this->config->get('Tell time interval in minuts')*20*60; - $tTime = $this->config->get('Tell time'); - - - -$modify = $this->config->get('Time changes'); - - -$test = date('H') + ($modify); - - if ($test > 23){ - $test = $test - 24; - } - - $this->getLogger()->info(TextFormat::DARK_GREEN ."[RealTime] It is " . $test. " (20h is same as 8pm)"); - $this->getScheduler()->scheduleRepeatingTask(new changeTimeTask($this), 120); - $this->changeTime(); - - if ($tTime == true) { - $this->getLogger()->info($tTimeInterval); - $this->getScheduler()->scheduleRepeatingTask(new tellTimeTask($this), $tTimeInterval); - $this->tellTime(); - } - - - - } - - - public function onDisable(){ - $this->config->save(); - - $this->getLogger()->info(TextFormat::DARK_RED . "RealTime disabled."); - } - - - - - public function onCommand(CommandSender $sender, Command $command, string $label, array $args): bool{ - - if(!($sender instanceof Player)){ - $this->getLogger()->info(TextFormat::DARK_RED. "[RealTime] Please run this command in-game.\n"); - }else{ - - $w =$sender->getLevel(); - $world = $w->getName(); - - if ($command->getName() == "hour"){ - $modify = ($this->config->get("Time changes")); - $times = date('H'); - $minutes = date('i'); - $time = $times + ($modify); - - if ($time > 23){ - $time = $time - 24; - } - - $reponse = ("[RealTime] It is ". $time .":". $minutes .""); - $sender->sendMessage($reponse); - $this->changeTime(); - return true; - } - - - - - - - if ($command->getName() == "rt") { - switch ($args[0]){ - - - case "enable" : - - $this->config->set( $world, 0); - $reponse = ("[RealTime] RealTime enabled for the world '".$world."'"); - $sender->sendMessage($reponse); - $this->config->save(); - $this->changeTime(); - return true; - - break; - - - - - - - - case "disable" : - - $this->config->set( $world, 3); - - - $reponse = ("[RealTime] Time unlock (RealTime disabled) for the world '".$world."'"); - $sender->sendMessage($reponse); - $this->config->save(); - $this->changeTime(); - return true; - - break; - - - case "day" : - $this->config->set( $world, 1); - //Il faut adapter le file put content a la nouvelle API - $reponse = ("[RealTime] Time lock to day for the world '".$world."'"); - - - $sender->sendMessage($reponse); - $this->config->save(); - $this->changeTime(); - return true; - break; - - - case "night" : - - $this->config->set( $world, 2); - - $reponse = ("[RealTime] Time lock to night for the world '".$world."'"); - $sender->sendMessage($reponse); - $this->config->save(); - $this->changeTime(); - return true; - - break; - - case "sunrise": - - $this->config->set( $world, 5); - - $reponse = ("[RealTime] Time lock to sunrise for the world '". $world."'"); - $sender->sendMessage($reponse); - $this->config->save(); - $this->changeTime(); - - return true; - - break; - case "sunset": - - $this->config->set( $world, 4); - - $reponse = ("[RealTime] Time lock to sunset for the world '" . $world."'"); - $sender->sendMessage($reponse); - $this->config->save(); - $this->changeTime(); - return true; - - break; - - case "lock": - $currentTick = $w->getTime(); - - - $this->config->set( $world, 6); - $this->config->set($world."-tick",$currentTick); - $this->config->save(); - - $reponse = ("[RealTime] Time lock to the tick ".$currentTick." on world '" . $world."'"); - $sender->sendMessage($reponse); - $this->changeTime(); - return true; - break; - - } - - - - }else{ - $this->changeTime(); - return false; - - - -} - - - - -} - -} - - - - - - - public function changeTime(){ - - $modify = $this->config->get('Time changes'); - $times = date('H'); - $time = $times + $modify; - - $monde = $this->getServer()->getLevels(); - - - foreach($monde as $w){ - - if ($this->config->__isset($w->getName())!== true){ - - - - - $this->config->set($w->getName(),3); - - } - - $mode = $this->config->get($w->getName()); - - - - if ($mode == 6){ - $ticks = $this->config->get($w->getName()."-tick"); - - } - - if ($mode == 1){ - $ticks = 6001; - } - if ($mode == 4){ - $ticks = 12000; - } - if ($mode == 5){ - $ticks = 5; - } - - if ($mode == 2){ - $ticks = 13751; - } - - - - - if ($mode == 0){ - if ($time > 23){ - $time = $time - 24; - } - - if ($time == 0) { - $ticks = 18000; - } - if ($time == 24) { - $ticks = 18000; - } - if ($time == 1) { - $ticks = 19000; - } - if ($time == 2) { - $ticks = 19500; - } - if ($time == 3) { - $ticks = 20000; - } - if ($time == 4) { - $ticks = 20500; - } - if ($time == 5) { - $ticks = 21000; - } - if ($time == 6) { - $ticks = 21500; - } - if ($time == 7) { - $ticks = 22500; - } - if ($time == 8) { - $ticks = 0; - } - if ($time == 9) { - $ticks = 2000; - } - if ($time == 10) { - $ticks = 4000; - } - if ($time == 11) { - $ticks = 5000; - } - if ($time == 12) { - $ticks = 6000; - } - if ($time == 13) { - $ticks = 7000; - } - if ($time == 14) { - $ticks = 8001; - } - if ($time == 15) { - $ticks = 9001; - } - if ($time == 16) { - $ticks = 10251; - } - if ($time == 17) { - $ticks = 11251; - } - if ($time == 18) { - $ticks = 12751; - } - if ($time == 19) { - $ticks = 13001; - } - if ($time == 20) { - $ticks = 13500; - } - if ($time == 21) { - $ticks = 15001; - } - if ($time == 22) { - $ticks = 16751; - } - if ($time == 23) { - $ticks = 17501; - } -} - - - -if ($mode !== 3){ - - - $w->checkTime(); - $w->setTime($ticks); - - $w->startTime(); - - $w->stopTime(); - $w->checkTime(); - - } - -elseif ($mode === 3){ - $w->checkTime(); - $w->startTime(); - $w->checkTime(); -} - - - - -} - -} - - - -public function tellTime(){ - - - - //$modify = $this->config->get("Time changes"); - $times = date('H'); - $minutes = date('i'); - $time = $times;// + $modify; - - if ($time > 23){ - $time = $time - 24; - } - -Server::getInstance()->broadcastMessage("[RealTime] It is ". $time .":". $minutes ); - - } - - - - - -} \ No newline at end of file diff --git a/RealTime/src/RealTime/changeTimeTask.php b/RealTime/src/RealTime/changeTimeTask.php deleted file mode 100644 index 7386c79..0000000 --- a/RealTime/src/RealTime/changeTimeTask.php +++ /dev/null @@ -1,16 +0,0 @@ -plugin = $plugin; - } - - public function onRun(int $currentTick) { - $this->plugin->changeTime(); - - } -} \ No newline at end of file diff --git a/RealTime/src/RealTime/tellTimeTask.php b/RealTime/src/RealTime/tellTimeTask.php deleted file mode 100644 index 1b27a62..0000000 --- a/RealTime/src/RealTime/tellTimeTask.php +++ /dev/null @@ -1,33 +0,0 @@ -plugin = $plugin; - } - - - public function onRun(int $currentTick) - { - // TODO: Implement onRun() method. - } -} \ No newline at end of file