mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 01:46:04 +00:00
Added handling for attack-air action (#5912)
This commit is contained in:
@ -66,6 +66,7 @@ use pocketmine\event\player\PlayerItemUseEvent;
|
||||
use pocketmine\event\player\PlayerJoinEvent;
|
||||
use pocketmine\event\player\PlayerJumpEvent;
|
||||
use pocketmine\event\player\PlayerKickEvent;
|
||||
use pocketmine\event\player\PlayerMissedSwingEvent;
|
||||
use pocketmine\event\player\PlayerMoveEvent;
|
||||
use pocketmine\event\player\PlayerPostChunkSendEvent;
|
||||
use pocketmine\event\player\PlayerQuitEvent;
|
||||
@ -1894,6 +1895,18 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs actions associated with the attack action (left-click) without a target entity.
|
||||
* Under normal circumstances, this will play the no-damage attack sound and nothing else.
|
||||
*/
|
||||
public function missSwing() : void{
|
||||
$ev = new PlayerMissedSwingEvent($this);
|
||||
$ev->call();
|
||||
if(!$ev->isCancelled()){
|
||||
$this->broadcastSound(new EntityAttackNoDamageSound());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Interacts with the given entity using the currently-held item.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user