Skip to content

Commit

Permalink
Update to 24w14a and Java 21
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander01998 committed Apr 3, 2024
1 parent 2b87ad5 commit 3520461
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ jobs:
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v2

- name: Set up Java 17
- name: Set up Java 21
uses: actions/setup-java@v4
with:
java-version: '17'
java-version: '21'
distribution: 'microsoft'

- name: Grant execute permission for gradlew
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

## Setup (for developers)

(This assumes that you are using Windows with [Eclipse](https://www.eclipse.org/downloads/) and [Java Development Kit 17](https://adoptium.net/?variant=openjdk17&jvmVariant=hotspot) already installed.)
(This assumes that you are using Windows with [Eclipse](https://www.eclipse.org/downloads/) and [Java Development Kit 21](https://adoptium.net/?variant=openjdk21&jvmVariant=hotspot) already installed.)

1. Run this command in PowerShell:

Expand Down
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ plugins {

def ENV = System.getenv()

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21

archivesBaseName = project.archives_base_name
version = project.mod_version
Expand Down Expand Up @@ -58,8 +58,8 @@ processResources {
}

tasks.withType(JavaCompile).configureEach {
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
it.options.release = 17
// Minecraft 1.20.5 (24w14a) upwards uses Java 21.
it.options.release = 21
}

java {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLDecoder;
Expand Down Expand Up @@ -197,7 +198,7 @@ private static String microsoftLogin(String email, String password,

try
{
URL url = new URL(urlPost);
URL url = URI.create(urlPost).toURL();
HttpURLConnection connection =
(HttpURLConnection)url.openConnection();

Expand Down Expand Up @@ -504,7 +505,7 @@ private static URL createURL(String url)
{
try
{
return new URL(url);
return URI.create(url).toURL();

}catch(MalformedURLException e)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.net.Proxy;
import java.net.Proxy.Type;
import java.net.SocketAddress;
import java.net.URI;
import java.net.URL;
import java.util.LinkedList;
import java.util.Scanner;
Expand Down Expand Up @@ -532,7 +533,7 @@ private static void dispatchRequest(String argURL, String userAgent)
{
try
{
URL url = new URL(argURL);
URL url = URI.create(argURL).toURL();
HttpURLConnection connection =
(HttpURLConnection)url.openConnection(proxy);
connection.setRequestMethod("GET");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.io.IOException;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URI;
import java.net.URL;

import com.google.gson.JsonArray;
Expand Down Expand Up @@ -50,7 +51,8 @@ protected WsonObject requestCompletion(JsonObject parameters)
throws IOException, JsonException
{
// set up the API request
URL url = new URL(modelSettings.oobaboogaEndpoint.getValue());
URL url =
URI.create(modelSettings.oobaboogaEndpoint.getValue()).toURL();
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
conn.setRequestMethod("POST");
conn.setRequestProperty("Content-Type", "application/json");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import java.io.IOException;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URI;
import java.net.URL;

import com.google.gson.JsonArray;
Expand Down Expand Up @@ -64,9 +65,10 @@ protected WsonObject requestCompletion(JsonObject parameters)
throws IOException, JsonException
{
// get the API URL
URL url = modelSettings.openAiModel.getSelected().isChatModel()
? new URL(modelSettings.openaiChatEndpoint.getValue())
: new URL(modelSettings.openaiLegacyEndpoint.getValue());
URL url =
URI.create(modelSettings.openAiModel.getSelected().isChatModel()
? modelSettings.openaiChatEndpoint.getValue()
: modelSettings.openaiLegacyEndpoint.getValue()).toURL();

// set up the API request
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/net/wurstclient/util/GoogleTranslate.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
Expand Down Expand Up @@ -69,7 +70,7 @@ private static URL createURL(String text, String langFrom, String langTo)
"https://translate.google.com/m?hl=en&sl=%s&tl=%s&ie=UTF-8&prev=_m&q=%s",
langFrom, langTo, encodedText);

return new URL(urlString);
return URI.create(urlString).toURL();

}catch(MalformedURLException | UnsupportedEncodingException e)
{
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@

"depends": {
"fabricloader": ">=0.15.9",
"fabric-api": ">=0.96.13",
"fabric-api": ">=0.96.14",
"minecraft": "~1.20.5-alpha.24.13.a",
"java": ">=17"
"java": ">=21"
},
"suggests": {
"mo_glass": "*"
Expand Down

0 comments on commit 3520461

Please sign in to comment.