Ok.Or you are trying to anti-hack? Can you do some further detail?I don't understand it Normal eating speed is about 1.9 - 2 second(s)
still dosent explain how to check eat speed, afaik you may use interact event OR eat event and block if it's firing too fast
What you can do is measure the time difference between the last consumption and the final consumption. PHP: /*** This is the time interval in seconds.* If the player consumes food in less* than this time, they will be kicked.*/const EAT_TIME_DIFFERENCE = 2;private $eatings = [];public function onSaturate(PlayerItemConsumeEvent $event){ $player = $event->getPlayer(); if(!isset($this->eatings[$id = $player->getId()])){ $this->eatings[$id] = time(); }else{ if((time() - $this->eatings[$id]) <= self::EAT_TIME_DIFFERENCE){ $eatspeed = time() - $this->eatings[$id];//in seconds //Player is eating too quickly. $player->kick("ur gaining weight too quickly"); } $this->eatings[$id] = time(); }} This might probably be a bad way, I advice you to use microtime instead.
lol "gaining weight" I wonder how thats hackable since its by the server? or maybe im confused with MCPC stuff...
as of how it should work; The client sends eating, and the server makes the "timer" for eating and succeed it.