Skip to content

Commit 9cec00f

Browse files
CopilotNotMyFault
andauthored
Tighten JSON-free version parsing
Co-authored-by: NotMyFault <13383509+NotMyFault@users.noreply.github.com>
1 parent af51d2a commit 9cec00f

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/main/java/com/thevoxelbox/voxelsniper/VoxelSniperPlugin.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
public class VoxelSniperPlugin extends JavaPlugin {
4343

4444
private static final long HOURS_TO_TICKS = 72000L;
45-
private static final Pattern VERSION_NAME_PATTERN = Pattern.compile("\"name\"\\s*:\\s*\"([^\"]+)\"");
45+
private static final Pattern VERSION_ENTRY_PATTERN = Pattern.compile("\\{[^{}]*\"name\"\\s*:\\s*\"([^\"]+)\"[^{}]*}");
4646

4747
private static final Logger LOGGER = LogManagerCompat.getLogger();
4848
public static VoxelSniperPlugin plugin;
@@ -285,7 +285,7 @@ private double updateCheck(double currentVersion) {
285285
}
286286
}
287287

288-
Matcher matcher = VERSION_NAME_PATTERN.matcher(response);
288+
Matcher matcher = VERSION_ENTRY_PATTERN.matcher(response);
289289
String latestVersionName = null;
290290
while (matcher.find()) {
291291
latestVersionName = matcher.group(1);

0 commit comments

Comments
 (0)