DaPigGuy / PiggyCustomEnchants

An open source custom enchantment plugin for PocketMine-MP
https://piggydocs.aericio.net/PiggyCustomEnchants.html
Apache License 2.0
103 stars 118 forks source link

Remote Enchant Disabler Error #226

Closed vort3xzz closed 4 years ago

vort3xzz commented 4 years ago

Please make sure your issue complies with these guidelines:

General

Steps to Reproduce the Issue

1.start server

Extra Information

< Fri_Dec_20-00.38.51-UTC_2019.log ->

Aericio commented 4 years ago

Contents of log:

PocketMine-MP Crash Dump Fri Dec 20 00:38:51 UTC 2019

Error: json_decode() expects parameter 1 to be string, bool given
File: plugins/PiggyCustomEnchants.phar/src/DaPigGuy/PiggyCustomEnchants/tasks/CheckDisabledEnchantsTask
Line: 37
Type: TypeError

THIS CRASH WAS CAUSED BY A PLUGIN
BAD PLUGIN: PiggyCustomEnchants v2.0.3

Code:
[28]     /**
[29]      * @param Server $server
[30]      * @throws ReflectionException
[31]      */
[32]     public function onCompletion(Server $server): void
[33]     {
[34]         if ($this->getResult() !== null) {
[35]             $plugin = CustomEnchantManager::getPlugin();
[36]             if ($plugin->isEnabled()) {
[37]                 $disabledEnchants = json_decode($this->getResult(), true);
[38]                 foreach ($disabledEnchants as $disabledEnchantEntry) {
[39]                     if (
[40]                         count(array_intersect($disabledEnchantEntry["api"], $plugin->getDescription()->getCompatibleApis())) > 0 ||
[41]                         in_array("all", $disabledEnchantEntry["api"]) ||
[42]                         in_array($plugin->getDescription()->getVersion(), $disabledEnchantEntry["version"]) ||
[43]                         in_array("all", $disabledEnchantEntry["version"])
[44]                     ) {
[45]                         $plugin->getLogger()->info("Enchantment " . $disabledEnchantEntry["name"] . " (id " . $disabledEnchantEntry["id"] . ") has been remotely disabled for " . $disabledEnchantEntry["reason"]);
[46]                         CustomEnchantManager::unregisterEnchantment($disabledEnchantEntry["id"]);
[47]                     }

Backtrace:
#0 plugins/PiggyCustomEnchants.phar/src/DaPigGuy/PiggyCustomEnchants/tasks/CheckDisabledEnchantsTask(37): json_decode(boolean , boolean 1)
#1 src/pocketmine/scheduler/AsyncPool(321): DaPigGuy\PiggyCustomEnchants\tasks\CheckDisabledEnchantsTask->onCompletion(object pocketmine\Server)
#2 src/pocketmine/Server(2571): pocketmine\scheduler\AsyncPool->collectTasks()
#3 src/pocketmine/Server(2343): pocketmine\Server->tick()
#4 src/pocketmine/Server(2203): pocketmine\Server->tickProcessor()
#5 src/pocketmine/Server(1785): pocketmine\Server->start()
#6 src/pocketmine/PocketMine(272): pocketmine\Server->__construct(object BaseClassLoader, object pocketmine\utils\MainLogger, string[34] /storage/emulated/0/PocketMine-MP/, string[42] /storage/emulated/0/PocketMine-MP/plugins/)
#7 src/pocketmine/PocketMine(295): pocketmine\server()
#8 (1): require(string[89] phar:///storage/emulated/0/PocketMine-MP/PocketMine-MP.phar/src/pocketmine/Pocke)

PocketMine-MP version: 3.11.1 [Protocol 389]
Git commit: 40a2211a5a93af7a587debb4efed2332f564193c
uname -a: Linux localhost 4.4.111-15516145 #1 SMP PREEMPT Tue May 21 19:29:52 KST 2019 aarch64
PHP Version: 7.3.7
Zend version: 3.3.7
OS : Linux, android

Loaded plugins:
PiggyCustomEnchants 2.0.3 by DaPigGuy for API(s) 3.2.0
vort3xzz commented 4 years ago

Why are you putting the content of the log here?? I am asking for a fix not just the log that i could see myself

Aericio commented 4 years ago

It inconveniences us to have to download the file in order to view it.

vort3xzz commented 4 years ago

Aa oke i am sorry

BlobKing21 commented 4 years ago

I know this sounds dumb, but the only way I figured out this fix was to make sure you have the latest pocketmine, as of right now it's 3.11.1, and make sure you installed piggyCE from poggit instead of GitHub. Again if I'm wrong, then sorry, but this is the only thing I can think of.

You're not the only one that encountered this issue

Aericio commented 4 years ago

Duplicate of #225