I tried my best to look for any possible solutions to detecting long right clicks, but so far I haven't found any viable solution for PMMP. I remember seeing a similar discussion somewhere, but cannot locate it. Any ideas? I saw bukkit people spawning fake shields but they aren't implemented in MCPE (I'm out of the loop, what is it called now?) yet.
on mcpc (hypixel) a shield appears if i hold right click so i suppose in MC there's a way probably packets...
Also something I wanted to do while I was working on guns' fire rate (that was before mcpe1.2) Try this: PHP: /** @var Player */ServerScheduler::scheduleRepeatingTask(new class($plugin, $player) extends PluginTask{ /** @var Player */ private $player; public function onRun(int $tick) : void{ if($this->player->isUsingItem()){ $this->player->sendPopup("You are currently holding ".$this->player->getInventory()->getItemInHand()); }else{ $this->getPlugin()->getServer()->getScheduler()->cancelTask($this->getTaskId()); } }}, 1);
I actually didn't know there was an isUsingItem function. Thanks! However, it doesn't seem to detect when I let go of the hold?
This only works if using an item such as a bow (needs the release action to know when they stopped right-clicking).