Update for PMMP 3.0.0

Drop support for 3.0.0-ALPHA versions
This commit is contained in:
Matthew 2018-06-30 13:30:41 +02:00
parent 010ee392d4
commit cef87f99de
6 changed files with 35 additions and 109 deletions

View File

@ -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

View File

@ -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

View File

@ -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");

View File

@ -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() {

View File

@ -1,10 +1,10 @@
<?php
namespace Matthww\PlayerInfo\Tasks;
use pocketmine\scheduler\PluginTask;
use pocketmine\scheduler\Task;
use pocketmine\utils\Config;
class SaveTask extends PluginTask {
class SaveTask extends Task {
public $plugin;
@ -25,7 +25,6 @@ class SaveTask extends PluginTask {
$this->UI = $UI;
$this->GUI = $GUI;
$this->controls = $controls;
parent::__construct($plugin);
}
public function getPlugin() {

View File

@ -1,94 +0,0 @@
<?php
namespace Matthww\PlayerInfo\utils;
use pocketmine\plugin\PluginBase;
use pocketmine\Server;
/**
* This class is deliberately meant to be silly
* Class SpoonDetector
* @package Matthww\PlayerInfo\utils\SpoonDetector
*/
final class SpoonDetector{
private static $subtleAsciiSpoon = "
___ _ __ ___ ___ _ __
/ __| '_ \\ / _ \\ / _ \\| '_ \\
\\__ \\ |_) | (_) | (_) | | | |
|___/ .__/ \\___/ \\___/|_| |_|
| |
|_|
";
private static $spoonTxtContent = "
The author of this plugin does not provide support for third-party builds of
PocketMine-MP (spoons). Spoons detract from the overall quality of the MCPE plugin environment, which is already
lacking in quality. They force plugin developers to waste time trying to support conflicting APIs.
In order to begin using this plugin you must understand that you will be offered no support.
Furthermore, the GitHub issue tracker for this project is targeted at vanilla PocketMine only. Any bugs you create which don't affect vanilla PocketMine will be deleted.
Have you read and understood the above (type 'yes' after the question mark)?";
const THINGS_THAT_ARE_NOT_SPOONS = [
'PocketMine-MP'
];
public final static function simpleCheck(Server $server) : bool {
return !in_array(Server::getInstance()->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;
}
}