mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-16 00:15:35 +00:00
Do not call PlayerEmoteEvent if rate limit was reached
This commit is contained in:
parent
f066199971
commit
87031627bf
@ -1731,12 +1731,15 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
||||
}
|
||||
|
||||
public function emote(string $emoteId) : void{
|
||||
$event = new PlayerEmoteEvent($this, $emoteId);
|
||||
$event->call();
|
||||
if(!$event->isCancelled() && $this->getServer()->getTick() - $this->lastEmoteTick > 5){
|
||||
$this->lastEmoteTick = $this->getServer()->getTick();
|
||||
foreach($this->getViewers() as $player){
|
||||
$player->getNetworkSession()->onEmote($this, $emoteId);
|
||||
$currentTick = $this->server->getTick();
|
||||
if($currentTick - $this->lastEmoteTick > 5){
|
||||
$this->lastEmoteTick = $currentTick;
|
||||
$event = new PlayerEmoteEvent($this, $emoteId);
|
||||
$event->call();
|
||||
if(!$event->isCancelled()){
|
||||
foreach($this->getViewers() as $player){
|
||||
$player->getNetworkSession()->onEmote($this, $emoteId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user