Address deprecated URL instantiation (#4178)

Fixes https://github.com/IntellectualSites/PlotSquared/issues/4166
This commit is contained in:
BlockyTheDev
2023-10-01 11:50:12 +02:00
committed by GitHub
parent aae6ea4fee
commit 4fe0c586d9
5 changed files with 19 additions and 14 deletions

View File

@ -35,7 +35,7 @@ import org.bukkit.scheduler.BukkitTask;
import javax.net.ssl.HttpsURLConnection;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URI;
public class UpdateUtility implements Listener {
@ -59,8 +59,9 @@ public class UpdateUtility implements Listener {
public void updateChecker() {
task = Bukkit.getScheduler().runTaskTimerAsynchronously(this.javaPlugin, () -> {
try {
HttpsURLConnection connection = (HttpsURLConnection) new URL(
HttpsURLConnection connection = (HttpsURLConnection) URI.create(
"https://api.spigotmc.org/simple/0.2/index.php?action=getResource&id=77506")
.toURL()
.openConnection();
connection.setRequestMethod("GET");
JsonObject result = new JsonParser()