Skip to content

Commit c82fd97

Browse files
committed
don't send scouts or location checks of not-missing locations. prevents disconnects due to sending invalid location ids.
1 parent e785f27 commit c82fd97

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ plugins {
77

88
archivesBaseName = "Archipelago.MultiClient.Java"
99
group = 'gg.archipelago.APClient'
10-
version = '1.9'
10+
version = '1.10'
1111

1212
java.toolchain.languageVersion = JavaLanguageVersion.of(8)
1313

src/main/java/gg/archipelago/client/ArchipelagoClient.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ public abstract class ArchipelagoClient {
4343
private final LocationManager locationManager;
4444
private final ItemManager itemManager;
4545
private final EventManager eventManager;
46-
private final DeathLink deathLink;
4746

4847
public static final Version protocolVersion = new Version(0, 3, 7);
4948

@@ -64,7 +63,6 @@ public ArchipelagoClient() {
6463
locationManager = new LocationManager(this);
6564
itemManager = new ItemManager(this);
6665
archipelagoClient = this;
67-
deathLink = new DeathLink(this);
6866
}
6967

7068
public void setGame(String game) {
@@ -245,6 +243,7 @@ public boolean checkLocations(Collection<Long> locationIDs) {
245243
}
246244

247245
public void scoutLocations(ArrayList<Long> locationIDs) {
246+
locationIDs.removeIf( location -> !locationManager.getMissingLocations().contains(location));
248247
archipelagoWebSocket.scoutLocation(locationIDs);
249248
}
250249

src/main/java/gg/archipelago/client/ItemManager.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public void receiveItems(ArrayList<NetworkItem> ids, int index) {
4242
else {
4343
if(webSocket != null) {
4444
webSocket.sendPacket(new SyncPacket());
45-
archipelagoClient.getLocationManager().sendAllLocations();
45+
archipelagoClient.getLocationManager().resendAllCheckedLocations();
4646
}
4747
}
4848
}

src/main/java/gg/archipelago/client/LocationManager.java

+6-5
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ public boolean checkLocation(long id) {
2121
return checkLocations(Collections.singletonList(id));
2222
}
2323

24-
public boolean checkLocations(Collection<Long> id) {
25-
checkedLocations.addAll(id);
24+
public boolean checkLocations(Collection<Long> ids) {
25+
ids.removeIf( location -> !missingLocations.contains(location));
26+
checkedLocations.addAll(ids);
2627
LocationChecks packet = new LocationChecks();
27-
packet.locations.addAll(id);
28+
packet.locations.addAll(ids);
2829
if(webSocket == null)
2930
return false;
3031

@@ -47,7 +48,7 @@ public void sendIfChecked(Set<Long> missingChecks) {
4748
webSocket.sendPacket(packet);
4849
}
4950

50-
public void sendAllLocations() {
51+
public void resendAllCheckedLocations() {
5152
if (webSocket == null)
5253
return;
5354
LocationChecks packet = new LocationChecks();
@@ -64,7 +65,7 @@ public Set<Long> getCheckedLocations() {
6465
}
6566

6667
public Set<Long> getMissingLocations() {
67-
return checkedLocations;
68+
return missingLocations;
6869
}
6970

7071
public void addCheckedLocations(Set<Long> newLocations) {

0 commit comments

Comments
 (0)