mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-30 09:50:51 +01:00
Fix ConcurrentModificationException in BB tile filling
This commit is contained in:
parent
64c62b92cb
commit
775d429833
@ -18,6 +18,7 @@ import com.eu.habbo.habbohotel.wired.WiredHandler;
|
||||
import com.eu.habbo.habbohotel.wired.WiredTriggerType;
|
||||
import com.eu.habbo.messages.outgoing.rooms.users.RoomUserActionComposer;
|
||||
import com.eu.habbo.threading.runnables.BattleBanzaiTilesFlicker;
|
||||
import gnu.trove.impl.hash.THash;
|
||||
import gnu.trove.map.hash.THashMap;
|
||||
import gnu.trove.set.hash.THashSet;
|
||||
|
||||
@ -295,10 +296,11 @@ public class BattleBanzaiGame extends Game
|
||||
int y = item.getY();
|
||||
|
||||
List<List<RoomTile>> filledAreas = new ArrayList<>();
|
||||
filledAreas.add(this.floodFill(x, y - 1, this.lockedTiles.get(teamColor), new ArrayList<>(), teamColor));
|
||||
filledAreas.add(this.floodFill(x, y + 1, this.lockedTiles.get(teamColor), new ArrayList<>(), teamColor));
|
||||
filledAreas.add(this.floodFill(x - 1, y, this.lockedTiles.get(teamColor), new ArrayList<>(), teamColor));
|
||||
filledAreas.add(this.floodFill(x + 1, y, this.lockedTiles.get(teamColor), new ArrayList<>(), teamColor));
|
||||
THashSet<HabboItem> lockedTiles = new THashSet<>(this.lockedTiles.get(teamColor));
|
||||
filledAreas.add(this.floodFill(x, y - 1, lockedTiles, new ArrayList<>(), teamColor));
|
||||
filledAreas.add(this.floodFill(x, y + 1, lockedTiles, new ArrayList<>(), teamColor));
|
||||
filledAreas.add(this.floodFill(x - 1, y, lockedTiles, new ArrayList<>(), teamColor));
|
||||
filledAreas.add(this.floodFill(x + 1, y, lockedTiles, new ArrayList<>(), teamColor));
|
||||
|
||||
Optional<List<RoomTile>> largestAreaOfAll = filledAreas.stream().filter(Objects::nonNull).max(Comparator.comparing(List::size));
|
||||
|
||||
@ -335,10 +337,10 @@ public class BattleBanzaiGame extends Game
|
||||
stack.add(tile);
|
||||
|
||||
List<List<RoomTile>> result = new ArrayList<>();
|
||||
result.add(this.floodFill(x, y - 1, lockedTiles, stack, color));
|
||||
result.add(this.floodFill(x, y + 1, lockedTiles, stack, color));
|
||||
result.add(this.floodFill(x - 1, y, lockedTiles, stack, color));
|
||||
result.add(this.floodFill(x + 1, y, lockedTiles, stack, color));
|
||||
result.add(this.floodFill(x, y - 1, new THashSet<>(lockedTiles), stack, color));
|
||||
result.add(this.floodFill(x, y + 1, new THashSet<>(lockedTiles), stack, color));
|
||||
result.add(this.floodFill(x - 1, y, new THashSet<>(lockedTiles), stack, color));
|
||||
result.add(this.floodFill(x + 1, y, new THashSet<>(lockedTiles), stack, color));
|
||||
|
||||
if (result.contains(null)) return null;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user