Fixed some issues that lead to indefinite shutdown times

This commit is contained in:
ceikry 2023-01-29 19:47:56 -06:00 committed by Ryan
parent 1a1da2b71b
commit 4008f78433
3 changed files with 3 additions and 2 deletions

View file

@ -43,7 +43,7 @@ class AIRepository {
} }
@JvmStatic fun clearAllBots() { @JvmStatic fun clearAllBots() {
PulseRepository.forEach { (_, it) -> PulseRepository.toList().forEach { (_, it) ->
it.stop(); it.stop();
it.botScript.bot.clear(); it.botScript.bot.clear();
AIPlayer.deregister((it.botScript.bot as AIPlayer).uid) AIPlayer.deregister((it.botScript.bot as AIPlayer).uid)

View file

@ -351,6 +351,8 @@ public class Player extends Entity {
* @param force If we should force removal, a player engaged in combat will otherwise remain active until out of combat. * @param force If we should force removal, a player engaged in combat will otherwise remain active until out of combat.
*/ */
public void clear(boolean force) { public void clear(boolean force) {
if (!isActive())
return;
if (force) { if (force) {
Repository.getDisconnectionQueue().remove(getName()); Repository.getDisconnectionQueue().remove(getName());
} }

View file

@ -160,7 +160,6 @@ object Repository {
playerNames.remove(player.name) playerNames.remove(player.name)
UpdateSequence.renderablePlayers.remove(player) UpdateSequence.renderablePlayers.remove(player)
player.session.disconnect() player.session.disconnect()
player.clear(true)
} }
/** /**