Stuck during battle

Got stuck during a battle and couldn’t use /stuck or anything. "Cannot do X during battle. Happened in Ymirs at about x237 , y321. Had to wait for mobs to kill me which took a while because I was a bit over the level