Skip to content

Commit 382f477

Browse files
committed
Make url field transient to avoid problems when copying lists in MultiMC... instances
1 parent c4482a5 commit 382f477

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/main/java/io/github/communityradargg/forgemod/radarlistmanager/RadarList.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,13 @@ public class RadarList {
4444
private final int version = 1;
4545
@SerializedName("namespace")
4646
private final String namespace;
47-
@SerializedName("url")
48-
private final String url;
4947
@SerializedName("playerMap")
5048
private final Map<UUID, RadarListEntry> playerMap;
5149
@SerializedName("visibility")
5250
private final RadarListVisibility visibility;
5351
@SerializedName("prefix")
5452
private String prefix;
53+
private transient String url;
5554

5655
/**
5756
* Constructs a {@link RadarList}.
@@ -135,6 +134,15 @@ public void setPrefix(final @NotNull String prefix) {
135134
return url;
136135
}
137136

137+
/**
138+
* Sets the url of the list.
139+
*
140+
* @param url The url to set.
141+
*/
142+
public void setUrl(final @NotNull String url) {
143+
this.url = url;
144+
}
145+
138146
/**
139147
* Gets the player map of the list.
140148
*

src/main/java/io/github/communityradargg/forgemod/radarlistmanager/RadarListManager.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ public void loadPrivateLists() {
274274
private @NotNull Optional<RadarList> loadRadarListFromFile(final @NotNull String filePath) {
275275
try (final FileReader reader = new FileReader(filePath)) {
276276
final RadarList list = gson.fromJson(reader, new TypeToken<RadarList>() {}.getType());
277+
list.setUrl(filePath);
277278
if (list.validateList()) {
278279
return Optional.of(list);
279280
}

0 commit comments

Comments
 (0)