Hey! If you install the plugin skript you can go into files>plugins>skript>scripts make a new file named cl.sk and paste this in... then do /sk reload cl
every 1 second:
loop all entities where [entity is villager or slime]:
clear event-entity
If this doesn't work just reply to this topic and I will change up the code.