mirror of
https://github.com/Matthww/PlayerInfo.git
synced 2025-04-19 05:15:25 +00:00
Quick fix
Version 1.2.1: Quick fix and updated SpoonDetector
This commit is contained in:
parent
e1e66797f9
commit
6260ae842a
@ -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
|
||||
|
@ -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!
|
||||
|
@ -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;
|
||||
|
@ -1,9 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) Falkirks - All Rights Reserved
|
||||
* All credits go to: Falkirks
|
||||
* For making this awesome SpoonDetector :)
|
||||
*/
|
||||
namespace Matthww\PlayerInfo\utils;
|
||||
namespace spoondetector;
|
||||
|
||||
use pocketmine\plugin\PluginBase;
|
||||
use pocketmine\Server;
|
||||
@ -13,7 +9,8 @@ use pocketmine\Server;
|
||||
* Class SpoonDetector
|
||||
* @package Matthww\PlayerInfo\utils
|
||||
*/
|
||||
class SpoonDetector{
|
||||
class SpoonDetector {
|
||||
|
||||
private static $subtleAsciiSpoon = "
|
||||
___ _ __ ___ ___ _ __
|
||||
/ __| '_ \\ / _ \\ / _ \\| '_ \\
|
||||
@ -22,6 +19,7 @@ class SpoonDetector{
|
||||
| |
|
||||
|_|
|
||||
";
|
||||
|
||||
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
|
||||
@ -32,21 +30,25 @@ class SpoonDetector{
|
||||
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)?";
|
||||
|
||||
private static $thingsThatAreNotSpoons = [
|
||||
'PocketMine-MP'
|
||||
];
|
||||
public static function isThisSpoon() : bool {
|
||||
|
||||
public static function isThisSpoon(): bool {
|
||||
return !in_array(Server::getInstance()->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{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user