From 6260ae842a424af5bc8b345c5a91dce459a9f557 Mon Sep 17 00:00:00 2001 From: Matthew Date: Wed, 31 May 2017 11:55:17 +0200 Subject: [PATCH] Quick fix Version 1.2.1: Quick fix and updated SpoonDetector --- README.md | 4 ++- plugin.yml | 2 +- src/Matthww/PlayerInfo/PlayerInfo.php | 2 +- .../PlayerInfo/utils/SpoonDetector.php | 28 ++++++++++--------- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 9fc28f6..37cad10 100644 --- a/README.md +++ b/README.md @@ -16,4 +16,6 @@ Name: Steve\ IP: 127.0.0.1\ OS: iOS\ Model: iPhone\ -UI: Classic UI +UI: Classic UI\ +GUI Scale: Maximum\ +Controls: Touch diff --git a/plugin.yml b/plugin.yml index cb5796c..01b2992 100644 --- a/plugin.yml +++ b/plugin.yml @@ -1,5 +1,5 @@ name: PlayerInfo -version: 1.2.0 +version: 1.2.1 author: Matthww api: [3.0.0-ALPHA1, 3.0.0-ALPHA2, 3.0.0-ALPHA3, 3.0.0-ALPHA4, 3.0.0-ALPHA5] description: Shows info about a certain player! diff --git a/src/Matthww/PlayerInfo/PlayerInfo.php b/src/Matthww/PlayerInfo/PlayerInfo.php index 91cd402..cff9dc6 100644 --- a/src/Matthww/PlayerInfo/PlayerInfo.php +++ b/src/Matthww/PlayerInfo/PlayerInfo.php @@ -2,7 +2,7 @@ namespace Matthww\PlayerInfo; -use Matthww\PlayerInfo\Utils\SpoonDetector; +use Matthww\PlayerInfo\utils\SpoonDetector; use pocketmine\command\Command; use pocketmine\command\CommandSender; use pocketmine\event\Listener; diff --git a/src/Matthww/PlayerInfo/utils/SpoonDetector.php b/src/Matthww/PlayerInfo/utils/SpoonDetector.php index a2c7774..7a49e59 100644 --- a/src/Matthww/PlayerInfo/utils/SpoonDetector.php +++ b/src/Matthww/PlayerInfo/utils/SpoonDetector.php @@ -1,9 +1,5 @@ getName(), self::$thingsThatAreNotSpoons); } + private static function contentValid(string $content): bool { - return (strpos($content, self::$spoonTxtContent) > -1) && (strrpos($content, "yes") > strrpos($content, "?")); + return (strpos($content, self::$spoonTxtContent) !== false) && (strrpos($content, "yes") > strrpos($content, "?")); } - public static function printSpoon(PluginBase $pluginBase, $fileToCheck){ - if(self::isThisSpoon()){ - if(!file_exists($pluginBase->getDataFolder() . $fileToCheck)){ + + public 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))) { + 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."); @@ -54,4 +56,4 @@ class SpoonDetector{ } } } -} \ No newline at end of file +}