Sorry for my bad english, i will try to explain you this bug.
When you make a win command on a trainer, for example a teleportation. (/tedit add win tppos @pl x y z)
It can provoc a freeze during the fight because the command is launched before the fight is finished.
To test that i have made a broadcast on a trainer (/tedit add win broadcast test) and the broadcast was launched before the end of the fight.
I think it's because when a trainer win, a log message is send to the server to say it.
However the player is again in the fight because he need to skip message like sturdy abilities, sandstorm etc..
In fact, this bug is most common when the trainer's pokemon who kills the player's pokemon has an ability like Sandstorm or sturdy because we have more message to skip before the end of the fight
A screenshot of what happens when the fight bug:
https://ibb.co/j1HiWKThis bug can actually be fixed if you change the default value ( for example i set 2000) but i think it needs a fix.
Thank you to read this!