I try make a autocleaner of entities with the server time. I used the clear lag source and i make a this function. But idk. Doesn't work. Anyone can help me
PHP: public function clearEntities(){ foreach($this->getServer()->getLevels() as $level){ foreach($level->getEntities() as $entity){ if(!$entity instanceof Player) $entity->close(); // Don't use kill since we don't need drops or exp } }} This will remove slappers also, you can prevent that by doing Code: if($entity->getSaveId() !== "Slapper") //rest code