Skip to content

Commit

Permalink
- Replace a couple of deprecations required when we supported MC
Browse files Browse the repository at this point in the history
1.16.*.
  • Loading branch information
LlmDl committed Jan 11, 2025
1 parent ca361e4 commit 8aafcb9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Towny/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<artifactId>towny</artifactId>
<packaging>jar</packaging>
<version>0.101.1.0</version>
<version>0.101.1.1</version>

<licenses>
<license>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ public static Collection<CustomDataField<?>> deserializeMeta(String metadata) th

private static JsonArray convertToArray(String metadata) throws IOException {
try {
// TODO: Replace this when support for MC 1.16.* is dropped.
@SuppressWarnings("deprecation")
JsonElement element = new JsonParser().parse(metadata);
JsonElement element = JsonParser.parseString(metadata);

if (!element.isJsonArray())
throw new IOException("Metadata cannot be read as a JSON Array!");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ public void run() {
towny.getLogger().info(Translation.of("msg_checking_for_updates"));

try {
// TODO: Replace deprecation when we are running on Java 20.
@SuppressWarnings("deprecation")
URL url = new URL("https://api.github.com/repos/TownyAdvanced/Towny/releases");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();

try (BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), StandardCharsets.UTF_8))) {
try {
// TODO: Replace this when support for MC 1.16.* is dropped.
@SuppressWarnings("deprecation")
Version latestVersion = Version.fromString(new JsonParser().parse(reader).getAsJsonArray().get(0).getAsJsonObject().get("tag_name").getAsString());
Version latestVersion = Version.fromString(JsonParser.parseReader(reader).getAsJsonArray().get(0).getAsJsonObject().get("tag_name").getAsString());
boolean upToDate = Version.fromString(towny.getVersion()).isNewerThanOrEquals(latestVersion);

if (!upToDate) {
Expand Down
4 changes: 3 additions & 1 deletion Towny/src/main/resources/ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10201,4 +10201,6 @@ v0.92.0.11:
- Bump net.kyori:adventure-text-serializer-plain from 4.17.0 to 4.18.0.
- Bump net.kyori:adventure-text-minimessage from 4.17.0 to 4.18.0.
0.101.1.0:
- Bump version for release.
- Bump version for release.
0.101.1.1:
- Replace a couple of deprecations required when we supported MC 1.16.*.

0 comments on commit 8aafcb9

Please sign in to comment.