Fix bots not being removed properly
This commit is contained in:
@@ -609,7 +609,7 @@ public class Bot extends ServerPlayer implements Terminator {
|
|||||||
// this should fix the concurrentmodificationexception mentioned above, I used the ConcurrentHashMap.newKeySet to make a "ConcurrentHashSet"
|
// this should fix the concurrentmodificationexception mentioned above, I used the ConcurrentHashMap.newKeySet to make a "ConcurrentHashSet"
|
||||||
plugin.getManager().remove(this);
|
plugin.getManager().remove(this);
|
||||||
|
|
||||||
scheduler.runTaskLater(plugin, this::setDead, 30);
|
scheduler.runTaskLater(plugin, this::removeBot, 30);
|
||||||
|
|
||||||
this.removeTab();
|
this.removeTab();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ public class BotManagerImpl implements BotManager, Listener {
|
|||||||
@Override
|
@Override
|
||||||
public void reset() {
|
public void reset() {
|
||||||
if (!bots.isEmpty()) {
|
if (!bots.isEmpty()) {
|
||||||
bots.forEach(Terminator::removeVisually);
|
bots.forEach(Terminator::removeBot);
|
||||||
bots.clear(); // Not always necessary, but a good security measure
|
bots.clear(); // Not always necessary, but a good security measure
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user