I have a problem in my shift sales plugin could someone help me with this error Notice: Object of class pocketmine\Player could not be converted to int in /storage/emulated/0/PocketMine/plugins/Economy_v1.0/src/Core/Economy/EconomyUtils.php on line 52
[QUOTE = "EndermannbugZJFC, post: 72851, membro: 9219"] envia um relatório de problemas para o dev do plugin de vendas de turnos [/ QUOTE]I made the plugin more is giving this error and I can't solve it, can you help me?
<?php namespace sell; use pocketmine\command\Command; use pocketmine\command\CommandSender; use pocketmine\event\player\PlayerToggleSneakEvent; use pocketmine\event\Listener; use pocketmine\plugin\PluginBase; use pocketmine\Player; use pocketmine\utils\Config; class Main extends PluginBase implements Listener { public $config; public $functionSell = []; public $economy; public function onEnable(){ $this->economy = $this->getServer()->getPluginManager()->getPlugin("Economy"); // Creation Config @mkdir($this->getDataFolder()); $this->saveResource("Items.yml"); $this->config = new Config($this->getDataFolder()."Items.yml", Config::YAML); // Register Listener $this->getServer()->getPluginManager()->registerEvents($this, $this); // Register Command } public function onCommand(CommandSender $sender, Command $command, $label, array $args){ if($sender instanceof Player){ $player = $sender->getName(); switch ($command->getName()) { case 'sell': if(!isset($this->functionSell[$player])){ $this->functionSell[$player] = true; $sender->sendMessage("§aVendas por shift ativada com sucesso!"); return true; } else { unset($this->functionSell[$player]); $sender->sendMessage("§cVendas por shift desativada com sucesso!"); return true; } break; case 'items': $config = $this->config; print_r($config->getAll()); break; } return false; } } public function onToggleSneaking(PlayerToggleSneakEvent $event){ $name = $event->getPlayer(); $config = $this->config; if($event->isSneaking() !== false){ if(isset($this->functionSell[$name->getName()])){ $contents = $name->getInventory()->getContents(); $search = false; foreach ($contents as $slot => $i){ if(!$search) { if ($config->exists($i->getId())) { $item = $config->get($i->getId()); if($i->getDamage() == $item['meta']){ if($i->getCount() >= $item['count']){ $search = true; } } } } } if(!$search){ $name->sendMessage("§cVocê não tem nenhum item para vender!"); return true; } for($i = 0; $i < $name->getInventory()->getSize(); $i++){ $it = $name->getInventory()->getItem($i); $clone = clone $it; if($config->exists($it->getId())) { $item = $config->get($it->getId()); if($it->getDamage() == $item['meta']){ if ($it->getCount() >= $item['count']) { $count = floor($it->getCount() / $item['count']); $price = $count * $item['price']; $clone->setCount($it->getCount() - ($item['count'] * $count)); $name->getInventory()->removeItem($it); $name->getInventory()->addItem($clone); $this->economy->economyUtils->addMoney($price, $name); $name->sendMessage("§7[§e!§7]§f Você vendeu este item por $" . $price); } } } } } } return false; } }
that's not the code that's a example man, change all your value only array index with the array_search() thingy plsssss understand