Compare commits

..

6 Commits

Author SHA1 Message Date
Keenan Yafiq
cc7e6c74af Merge branch 'master' of https://github.com/mukeenanyafiq/PlayerInfo 2023-08-14 19:50:45 +07:00
Keenan Yafiq
39bf52ed79 modified: src/Matthww/PlayerInfo/PlayerInfo.php 2023-08-14 19:50:01 +07:00
Keenan Yafiq
af1162e256 Update README.md 2023-08-14 19:34:16 +07:00
Keenan Yafiq
4c1e026fc9 Update plugin.yml 2023-08-14 19:03:04 +07:00
Keenan Yafiq
0c7827e18c modified: src/Matthww/PlayerInfo/Tasks/FetchModelsTask.php 2023-08-14 18:45:06 +07:00
Keenan Yafiq
2743b944a6 modified: plugin.yml
modified:   resources/config.yml
	modified:   resources/models.yml
	modified:   src/Matthww/PlayerInfo/PlayerInfo.php
	modified:   src/Matthww/PlayerInfo/Tasks/FetchModelsTask.php
	modified:   src/Matthww/PlayerInfo/Tasks/LoadTask.php
	modified:   src/Matthww/PlayerInfo/Tasks/SaveTask.php
	modified:   src/Matthww/PlayerInfo/Tasks/FetchModelsTask.php
2023-08-14 18:43:14 +07:00
4 changed files with 11 additions and 9 deletions

View File

@@ -8,7 +8,7 @@ We also have a shorter command:\
`/pinfo <player>`
#### Permission:
`playerinfo.use` - Allows the user/player to use the command `/playerinfo`
`playerinfo.use` - Allows operator to use the command `/playerinfo`
#### Example:

View File

@@ -15,4 +15,4 @@ commands:
permissions:
playerinfo.use:
default: op
description: "Allows the user/player to execute the playerinfo command"
description: "Allows operator to execute the playerinfo command"

View File

@@ -1,6 +1,6 @@
<?php
namespace Matthww\PlayerInfo;
namespace Matthww\PlayerInfo;
use Matthww\PlayerInfo\Tasks\FetchModelsTask;
use Matthww\PlayerInfo\Tasks\LoadTask;
@@ -9,6 +9,8 @@ use pocketmine\command\Command;
use pocketmine\command\CommandSender;
use pocketmine\event\Listener;
use pocketmine\event\player\PlayerJoinEvent;
use pocketmine\event\server\DataPacketReceiveEvent;
use pocketmine\network\mcpe\protocol\LoginPacket;
use pocketmine\player\Player;
use pocketmine\plugin\PluginBase;
use pocketmine\utils\TextFormat as TF;
@@ -17,6 +19,7 @@ class PlayerInfo extends PluginBase implements Listener {
protected $DeviceOS;
protected $DeviceModel;
protected $UIProfile;
protected $PlayerData;
protected $config;
public function onEnable(): void {
@@ -103,7 +106,7 @@ class PlayerInfo extends PluginBase implements Listener {
$this->getScheduler()->scheduleTask(new LoadTask($this, $sender, $args[0]));
return true;
} else {
$sender->sendMessage(TF::RED . "[PlayerInfo] Player " .TF::WHITE. $args[0]. TF::RED. " is not online or does not exist!");
$sender->sendMessage(TF::RED . "[PlayerInfo] Player " .$args[0]. " is not online or does not exist!");
return false;
}
}

View File

@@ -6,8 +6,8 @@ use pocketmine\utils\Internet;
class FetchModelsTask extends AsyncTask {
protected $path;
protected $version;
private $path;
private $version;
public function __construct(string $path, string $version) {
$this->path = $path;
@@ -16,12 +16,11 @@ class FetchModelsTask extends AsyncTask {
public function onRun(): void {
$result = Internet::getURL("https://raw.githubusercontent.com/Matthww/PlayerInfo/master/resources/models.yml");
if(is_null($result)) {
if(!is_string($result)) {
$this->setResult(false);
return;
}
file_put_contents($this->path. "models.yml", $result->getBody());
file_put_contents($this->path. "models.yml", $result);
$this->setResult(true);
}
}