Skip to content

Commit

Permalink
fixed HealPoolTask concurrent modification
Browse files Browse the repository at this point in the history
  • Loading branch information
dhiepp committed Sep 11, 2023
1 parent 2f60a88 commit e1a1e23
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ public static boolean exists(IArena arena, ITeam bwt){
}
public static void removeForArena(IArena a){
if (healPoolTasks.isEmpty() || a == null) return;
for (HealPoolTask hpt: healPoolTasks) {
for (int i = 0; i < healPoolTasks.size(); i++) {
HealPoolTask hpt = healPoolTasks.get(i);
if (hpt == null) continue;
if (hpt.getArena().equals(a)){
hpt.cancel();
Expand All @@ -96,9 +97,10 @@ public static void removeForArena(IArena a){
}
}

public static void removeForArena(String a){
public static void removeForArena(String a){
if (healPoolTasks == null || healPoolTasks.isEmpty() || (a == null)) return;
for (HealPoolTask hpt: healPoolTasks) {
for (int i = 0; i < healPoolTasks.size(); i++) {
HealPoolTask hpt = healPoolTasks.get(i);
if (hpt == null) continue;
if (hpt.getArena().getWorldName().equals(a)){
hpt.cancel();
Expand All @@ -109,7 +111,8 @@ public static void removeForArena(String a){

public static void removeForTeam(ITeam team){
if (healPoolTasks == null || healPoolTasks.isEmpty() || (team == null)) return;
for (HealPoolTask hpt:healPoolTasks) {
for (int i = 0; i < healPoolTasks.size(); i++) {
HealPoolTask hpt = healPoolTasks.get(i);
if (hpt == null) continue;
if (hpt.getBwt().equals(team)){
hpt.cancel();
Expand Down

0 comments on commit e1a1e23

Please sign in to comment.