I created a store with EconomyShop but when I click on the item to buy the action it is executed several times, how do I get fix it ?
But you can work around it in plugins. Create an issue on GitHub for the developer to handle. You should do that for any plugin problem you have, before posting here.
It is not a plugin problem... Make an item that says "Hello" to you. Right click on the ground and count how many "Hello"s you got. I will write you a plugin.
You might be able to do it through a plugin, by ignoring playerinteractevent from the same player within a very small amount of time. Are you able to write a plugin like that? I may be able to do it otherwise.
Okay, I'll try to help. Which version of PMMP are you using, and can you link me to where you got the shop plugin?
This server is running PocketMine-MP 3.1.3 for Minecraft: PE v1.5.0 (protocol version 274) this plugin https://github.com/BoxOfDevs/CommandShop but all the plugins that use the touch to perform some action have this problem!
So I worked a bit with my friend and we still have that issue. We have a plently amount of win10 players and they crash due to addWindow() on each interaction. A solution for that would be the item held event but the bad thing is that we can't use the soul well without crashes. PHP: <?phpnamespace FreeGamingHere;use pocketmine\event\player\PlayerJoinEvent;use pocketmine\event\player\PlayerInteractEvent;use pocketmine\scheduler\Task;use pocketmine\Player;use pocketmine\item\Item;use pocketmine\event\EventPriority;use pocketmine\command\CommandSender;use pocketmine\command\Command;class Win10Fix extends \pocketmine\plugin\PluginBase implements \pocketmine\event\Listener{ public $ids = array(); public $time = array(); public $blockIds = array(); public function onEnable() : void{ $this->getLogger()->info("Enabled!"); $this->getServer()->getPluginManager()->registerEvents($this, $this); } public function onDisable() : void{ $this->getScheduler()->cancelAllTasks(); } public function doStuff(Player $player) : void{ if($this->time[$player->getName()] < 3){ $this->time[$player->getName()] = $this->time[$player->getName()] + 1; } else { $this->getScheduler()->cancelTask($this->ids[$player->getName()]); $this->ids[$player->getName()] = 0; $this->time[$player->getName()] = 0; $this->blockIds[$player->getName()] = 0; } } public function onJoin(PlayerJoinEvent $event) : void{ $name = $event->getPlayer()->getName(); if(!in_array($name, $this->ids)){ $this->ids[] = $name; } $this->ids[$name] = 0; if(!in_array($name, $this->time)){ $this->time[] = $name; } $this->time[$name] = 0; if(!in_array($name, $this->blockIds)){ $this->blockIds[] = $name; } $this->blockIds[$name] = 0; } /** * @param PlayerInteractEvent $event * * @priority MONITOR */ public function onInteract(PlayerInteractEvent $event) : void{ $player = $event->getPlayer(); if($this->ids[$player->getName()] === 0){ $this->getScheduler()->scheduleRepeatingTask(new InteractTask($this, $player, $event->getBlock()->getId()), 1); } elseif($this->ids[$player->getName()] !== 0 && $this->blockIds[$player->getName()] === $event->getBlock()->getId()){ $event->setCancelled(); } }}class InteractTask extends Task{ public function __construct(Win10Fix $plugin, Player $player, int $blockId){ $this->plugin = $plugin; $this->player = $player; $this->blockId = $blockId; } public function onRun(int $currentTick) : void{ if($this->player->isOnline()){ $player = $this->player; $this->plugin->ids[$player->getName()] = $this->getTaskId(); $this->plugin->blockIds[$player->getName()] = $this->blockId; $this->plugin->doStuff($player); } else { $this->plugin->getScheduler()->cancelTask($this->getTaskId()); } }}
Result of my code above: It cancelled the block placing in some cases and it did not fix the crashes with the win10 users.