Skip to content

Commit

Permalink
Added enable and disable message in console.
Browse files Browse the repository at this point in the history
  • Loading branch information
AshiePleb committed Sep 17, 2020
1 parent 2b5f657 commit 89f45a6
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .vs/ProjectSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"CurrentProjectSetting": null
}
Binary file added .vs/slnx.sqlite
Binary file not shown.
6 changes: 3 additions & 3 deletions plugin.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Coords4PMMP
main: Coords4PMMP\Coords4PMMP
author: AshleyH
main: AshleyH\Coords4PMMP\Coords4PMMP
author: Ashley H.
description: Show player coordinates
version: 1.0.0
version: 1.0.1
api: 3.0.0
commands:
coords:
Expand Down
2 changes: 2 additions & 0 deletions resources/config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#DO NOT EDIT ANY OF THESE OPTIONS THEY ARE FOR SHOW ONLY!

---

## Number of ticks to wait before refreshing the display
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Coords4PMMP;
namespace AshleyH\Coords4PMMP;

use pocketmine\command\Command;
use pocketmine\command\CommandSender;
Expand All @@ -21,6 +21,8 @@ class Coords4PMMP extends PluginBase implements Listener{
private $precision = 1;

public function onEnable() : void{
$this->getLogger()->info("Coords4PMMP Has Been Enabled");
$this->getLogger()->info("Coords4PMMP was created and maintained by Ashley H, please report any bugs/issues to https://github.com/AshleyHunter01/Coords4PMMP/issues");
$this->refreshRate = (int) $this->getConfig()->get("refreshRate");
if($this->refreshRate < 1){
$this->getLogger()->warning("Refresh rate property in config.yml is less than 1. Resetting to 1");
Expand Down Expand Up @@ -48,6 +50,8 @@ public function onEnable() : void{
}

public function onDisable() : void{
$this->getLogger()->info("Coords4PMMP Has Been disabled");
$this->getLogger()->info("Coords4PMMP was created and maintained by Ashley H, please report any bugs to https://github.com/AshleyHunter01/Coords4PMMP/issues");
$this->tasks = [];
}

Expand All @@ -61,14 +65,15 @@ public function onCommand(CommandSender $sender, Command $command, string $alias

if(!isset($this->tasks[$sender->getName()])){
$this->tasks[$sender->getName()] = $this->getScheduler()->scheduleRepeatingTask(new ShowDisplayTask($sender, $this->mode, $this->precision), $this->refreshRate);
$sender->sendMessage(TextFormat::GREEN . "Coords4PMMP Enabled.");
$sender->sendMessage(TextFormat::GREEN . "Coords4PMMP Enabled");
$sender->sendMessage(TextFormat::GREEN . "Coords4PMMP was created and maintained by Ashley H, please report any bugs to https://github.com/AshleyHunter01/Coords4PMMP/issues");
}else{
$this->stopDisplay($sender->getName());
$sender->sendMessage(TextFormat::RED . "Coords4PMMP Disabled.");
$sender->sendMessage(TextFormat::RED . "Coords4PMMP Disabled");
$sender->sendMessage(TextFormat::RED . "Coords4PMMP was created and maintained by Ashley H, please report any bugs to https://github.com/AshleyHunter01/Coords4PMMP/issues");
}

return true;
return true;
}

return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Coords4PMMP;
namespace AshleyH\Coords4PMMP;

use pocketmine\Player;
use pocketmine\scheduler\Task;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Coords4PMMP;
namespace AshleyH\Coords4PMMP;

class Utils{

Expand Down

0 comments on commit 89f45a6

Please sign in to comment.