From cef87f99dee660f1d0cccd5334e5884b3324fc41 Mon Sep 17 00:00:00 2001 From: Matthww Date: Sat, 30 Jun 2018 13:30:41 +0200 Subject: [PATCH] Update for PMMP 3.0.0 Drop support for 3.0.0-ALPHA versions --- plugin.yml | 4 +- resources/models.yml | 27 +++++- src/Matthww/PlayerInfo/PlayerInfo.php | 9 +- src/Matthww/PlayerInfo/Tasks/LoadTask.php | 5 +- src/Matthww/PlayerInfo/Tasks/SaveTask.php | 5 +- .../PlayerInfo/utils/SpoonDetector.php | 94 ------------------- 6 files changed, 35 insertions(+), 109 deletions(-) delete mode 100644 src/Matthww/PlayerInfo/utils/SpoonDetector.php diff --git a/plugin.yml b/plugin.yml index 62f3478..15f0ea6 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,7 +1,7 @@ name: PlayerInfo -version: 2.0.2 +version: 2.0.3 author: Matthww -api: [3.0.0-ALPHA10, 3.0.0-ALPHA11, 3.0.0-ALPHA12] +api: [3.0.0] description: Shows info about a certain player! main: Matthww\PlayerInfo\PlayerInfo diff --git a/resources/models.yml b/resources/models.yml index d058e10..4dd3aa5 100644 --- a/resources/models.yml +++ b/resources/models.yml @@ -65,6 +65,8 @@ iPad7,2: iPad Pro 2 (12.9-inch) iPad7,3: iPad Pro (10.5-inch) iPad7,4: iPad Pro (10.5-inch) +SAMSUNG SM-J327T1: Samsung Galaxy J3 Prime Black + SAMSUNG SM-A530x: Samsung Galaxy A8 (2018) SAMSUNG SM-A730x: Samsung Galaxy A8+ (2018) SAMSUNG SM-A810x: Samsung Galaxy A8 (2016) @@ -84,6 +86,12 @@ SAMSUNG SM-A510Y: Samsung Galaxy A5 (2016) SAMSUNG SM-A310F: Samsung Galaxy A3 (2016) SAMSUNG SM-A310M: Samsung Galaxy A3 (2016) +SAMSUNG-SM-G900A: Samsung Galaxy S5 +SAMSUNG SAMSUNG-SM-G900A: Samsung Galaxy S5 + +SAMSUNG SM-G920F: Samsung Galaxy S6 + +SAMSUNG SM-G930T: Samsung Galaxy S7 SAMSUNG SM-G930F: Samsung Galaxy S7 SAMSUNG SM-G930FD: Samsung Galaxy S7 SAMSUNG SM-G9300: Samsung Galaxy S7 @@ -107,10 +115,27 @@ SAMSUNG SC-02H: Samsung Galaxy S7 Edge SAMSUNG SM-N950x: Samsung Galaxy Note 8 SAMSUNG SM-G950x: Samsung Galaxy S8 +SAMSUNG SM-G950U: Samsung Galaxy S8 SAMSUNG SM-G955x: Samsung Galaxy S8+ +SAMSUNG SM-G960U: Samsung Galaxy S9 +SAMSUNG SM-T280: Samsung Galaxy Tab A 7.0 (2016) +SAMSUNG SM-T350: Samsung Galaxy Tab A 8.0 +SAMSUNG SM-T580: Samsung Galaxy Tab A 10.1 (2016) +SAMSUNG SM-T820: Samsung Galaxy Tab S3 +TCL 5065D: Alcatel One Touch Pop 3 + +LGE LG-K373: LG Escape 3 LGE LG-V495: LG V495 +LGE LGMP450: LG Stylo 3 Plus -AMAZON KFDOWI: Amazon Fire HD 8 Tablet +SONY E2303: Sony Xperia M4 Aqua + +MOTOROLA MotoE2(4G-LTE): Motorola Moto E + +AMAZON KFARWI: Amazon Kindle Fire HD 6 +AMAZON KFAUWI: Amazon Kindle Fire HD 7 +AMAZON KFFOWI: Amazon Kindle Fire HD 7 +AMAZON KFDOWI: Amazon Kindle Fire HD 8 diff --git a/src/Matthww/PlayerInfo/PlayerInfo.php b/src/Matthww/PlayerInfo/PlayerInfo.php index d4f3332..1f70650 100644 --- a/src/Matthww/PlayerInfo/PlayerInfo.php +++ b/src/Matthww/PlayerInfo/PlayerInfo.php @@ -2,7 +2,6 @@ namespace Matthww\PlayerInfo; -use Matthww\PlayerInfo\utils\SpoonDetector; use pocketmine\command\Command; use pocketmine\command\CommandSender; use pocketmine\command\ConsoleCommandSender; @@ -36,9 +35,7 @@ class PlayerInfo extends PluginBase implements Listener { } if(!file_exists($this->getDataFolder() . "models.yml")) { $this->saveResource("models.yml", false); - } - - SpoonDetector::printSpoon($this, 'spoon.txt'); + } } public function onPacketReceived(DataPacketReceiveEvent $receiveEvent) { @@ -58,7 +55,7 @@ class PlayerInfo extends PluginBase implements Listener { $Controls = ["Unknown", "Mouse", "Touch", "Controller"]; $GUI = [-2 => "Minimum", -1 => "Medium", 0 => "Maximum"]; - $this->getServer()->getScheduler()->scheduleTask(new Tasks\SaveTask( + $this->getScheduler()->scheduleTask(new Tasks\SaveTask( $this, $player->getName(), $this->DeviceModel($cdata["DeviceModel"]), @@ -105,7 +102,7 @@ class PlayerInfo extends PluginBase implements Listener { //Nothing } else { if($this->getConfig()->get("Save") == true) { - $this->getServer()->getScheduler()->scheduleTask(new Tasks\LoadTask($this, $sender, $args[0])); + $this->getScheduler()->scheduleTask(new Tasks\LoadTask($this, $sender, $args[0])); return true; } else { $sender->sendMessage(TF::RED . "[PlayerInfo] Player is not online"); diff --git a/src/Matthww/PlayerInfo/Tasks/LoadTask.php b/src/Matthww/PlayerInfo/Tasks/LoadTask.php index 9b5818c..9c75c49 100644 --- a/src/Matthww/PlayerInfo/Tasks/LoadTask.php +++ b/src/Matthww/PlayerInfo/Tasks/LoadTask.php @@ -2,11 +2,11 @@ namespace Matthww\PlayerInfo\Tasks; use pocketmine\command\CommandSender; -use pocketmine\scheduler\PluginTask; +use pocketmine\scheduler\Task; use pocketmine\utils\Config; use pocketmine\utils\TextFormat as TF; -class LoadTask extends PluginTask { +class LoadTask extends Task { public $plugin; @@ -17,7 +17,6 @@ class LoadTask extends PluginTask { $this->plugin = $plugin; $this->sender = $sender; $this->target = $target; - parent::__construct($plugin); } public function getPlugin() { diff --git a/src/Matthww/PlayerInfo/Tasks/SaveTask.php b/src/Matthww/PlayerInfo/Tasks/SaveTask.php index 5622d4c..88fd1e3 100644 --- a/src/Matthww/PlayerInfo/Tasks/SaveTask.php +++ b/src/Matthww/PlayerInfo/Tasks/SaveTask.php @@ -1,10 +1,10 @@ UI = $UI; $this->GUI = $GUI; $this->controls = $controls; - parent::__construct($plugin); } public function getPlugin() { diff --git a/src/Matthww/PlayerInfo/utils/SpoonDetector.php b/src/Matthww/PlayerInfo/utils/SpoonDetector.php deleted file mode 100644 index 684aefa..0000000 --- a/src/Matthww/PlayerInfo/utils/SpoonDetector.php +++ /dev/null @@ -1,94 +0,0 @@ -getName(), SpoonDetector::THINGS_THAT_ARE_NOT_SPOONS); - } - - public static final function contentCheck(Server $server): bool{ - $reflectionClass = new \ReflectionClass($server); - $method = $reflectionClass->getMethod("getName"); - $start = $method->getStartLine(); - $end = $method->getEndLine(); - - $filename = $method->getFileName(); - $length = $end - $start; - - $source = file($filename); - $body = implode("", array_slice($source, $start, $length)); - - if(strpos($body, "(") !== false || strpos($body, ")") !== false){ - $server->getLogger()->info("Your server may be attempting to block SpoonDetector from running. SpoonDetector will continue to run regardless. If you are the developer of this spoon would like to be exempted from spoon detection, create a new API versioning system so existing PM plugins don't run, and then create an issue at Falkirks/spoondetector."); - return true; - } - foreach ($source as $line){ - if(strpos($line, "SpoonDetector") !== false){ - $server->getLogger()->info("Your server may be attempting to block SpoonDetector from running. SpoonDetector will continue to run regardless. If you are the developer of this spoon would like to be exempted from spoon detection, create a new API versioning system so existing PM plugins don't run, and then create an issue at Falkirks/spoondetector."); - return true; - } - } - return false; - } - - public final static function isThisSpoon() : bool { - $server = Server::getInstance(); - return self::simpleCheck($server) || self::contentCheck($server); - - } - - private final static function contentValid(string $content): bool { - return (strpos($content, self::$spoonTxtContent) !== false) && (strrpos($content, "yes") > strrpos($content, "?")); - } - - public final static function printSpoon(PluginBase $pluginBase, $fileToCheck = "spoon.txt"){ - if(self::isThisSpoon()){ - if(!file_exists($pluginBase->getDataFolder() . $fileToCheck)){ - file_put_contents($pluginBase->getDataFolder() . $fileToCheck, self::$spoonTxtContent); - } - if(!self::contentValid(file_get_contents($pluginBase->getDataFolder() . $fileToCheck))) { - $pluginBase->getLogger()->info(self::$subtleAsciiSpoon); - $pluginBase->getLogger()->warning("You are attempting to run " . $pluginBase->getDescription()->getName() . " on a SPOON!"); - $pluginBase->getLogger()->warning("Before using the plugin you will need to open /plugins/" . $pluginBase->getDescription()->getName() . "/" . $fileToCheck . " in a text editor and agree to the terms."); - $pluginBase->getServer()->getPluginManager()->disablePlugin($pluginBase); - return false; - } - } - return true; - } - -} \ No newline at end of file