You've already forked Arcturus-Morningstar-Extended
mirror of
https://github.com/duckietm/Arcturus-Morningstar-Extended.git
synced 2026-06-20 07:26:18 +00:00
🆙 Upgrade project dependencies and Java version; refactor code for improved compatibility and performance
This commit is contained in:
@@ -97,7 +97,7 @@ public final class Emulator {
|
||||
appender.start();
|
||||
}
|
||||
|
||||
Locale.setDefault(new Locale("en"));
|
||||
Locale.setDefault(Locale.of("en"));
|
||||
setBuild();
|
||||
Emulator.stopped = false;
|
||||
ConsoleCommand.load();
|
||||
|
||||
@@ -53,7 +53,7 @@ public class CommandHandler {
|
||||
public static void addCommand(Class<? extends Command> command) {
|
||||
try {
|
||||
//command.getConstructor().setAccessible(true);
|
||||
addCommand(command.newInstance());
|
||||
addCommand(command.getDeclaredConstructor().newInstance());
|
||||
LOGGER.debug("Added command: {}", command.getName());
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Caught exception", e);
|
||||
|
||||
@@ -14,6 +14,7 @@ import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
@@ -130,7 +131,7 @@ public class YoutubeManager {
|
||||
if(apiKey.isEmpty()) return null;
|
||||
|
||||
YoutubePlaylist playlist;
|
||||
URL playlistInfo = new URL("https://youtube.googleapis.com/youtube/v3/playlists?part=snippet&id=" + playlistId + "&maxResults=1&key=" + apiKey);
|
||||
URL playlistInfo = URI.create("https://youtube.googleapis.com/youtube/v3/playlists?part=snippet&id=" + playlistId + "&maxResults=1&key=" + apiKey).toURL();
|
||||
HttpsURLConnection playlistCon = (HttpsURLConnection) playlistInfo.openConnection();
|
||||
if (playlistCon.getResponseCode() != 200) {
|
||||
InputStream errorInputStream = playlistCon.getErrorStream();
|
||||
@@ -164,9 +165,9 @@ public class YoutubeManager {
|
||||
URL playlistItems;
|
||||
|
||||
if (nextPageToken.isEmpty()) {
|
||||
playlistItems = new URL("https://youtube.googleapis.com/youtube/v3/playlistItems?part=snippet%2Cstatus&playlistId=" + playlistId + "&maxResults=50&key=" + apiKey);
|
||||
playlistItems = URI.create("https://youtube.googleapis.com/youtube/v3/playlistItems?part=snippet%2Cstatus&playlistId=" + playlistId + "&maxResults=50&key=" + apiKey).toURL();
|
||||
} else {
|
||||
playlistItems = new URL("https://youtube.googleapis.com/youtube/v3/playlistItems?part=snippet%2Cstatus&playlistId=" + playlistId + "&pageToken=" + nextPageToken + "&maxResults=50&key=" + apiKey);
|
||||
playlistItems = URI.create("https://youtube.googleapis.com/youtube/v3/playlistItems?part=snippet%2Cstatus&playlistId=" + playlistId + "&pageToken=" + nextPageToken + "&maxResults=50&key=" + apiKey).toURL();
|
||||
}
|
||||
|
||||
HttpsURLConnection con = (HttpsURLConnection) playlistItems.openConnection();
|
||||
@@ -190,7 +191,7 @@ public class YoutubeManager {
|
||||
|
||||
String commaSeparatedVideos = String.join(",", videoIds);
|
||||
|
||||
VideoItems = new URL("https://youtube.googleapis.com/youtube/v3/videos?part=contentDetails&id=" + commaSeparatedVideos + "&maxResults=50&key=" + apiKey);
|
||||
VideoItems = URI.create("https://youtube.googleapis.com/youtube/v3/videos?part=contentDetails&id=" + commaSeparatedVideos + "&maxResults=50&key=" + apiKey).toURL();
|
||||
HttpsURLConnection con1 = (HttpsURLConnection) VideoItems.openConnection();
|
||||
InputStream is1 = con1.getInputStream();
|
||||
InputStreamReader isr1 = new InputStreamReader(is1);
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ public class WiredHighscoreManager {
|
||||
private final static String locale = (System.getProperty("user.language") != null ? System.getProperty("user.language") : "en");
|
||||
private final static String country = (System.getProperty("user.country") != null ? System.getProperty("user.country") : "US");
|
||||
|
||||
private final static DayOfWeek firstDayOfWeek = WeekFields.of(new Locale(locale, country)).getFirstDayOfWeek();
|
||||
private final static DayOfWeek firstDayOfWeek = WeekFields.of(Locale.of(locale, country)).getFirstDayOfWeek();
|
||||
private final static DayOfWeek lastDayOfWeek = DayOfWeek.of(((firstDayOfWeek.getValue() + 5) % DayOfWeek.values().length) + 1);
|
||||
private final static ZoneId zoneId = ZoneId.systemDefault();
|
||||
|
||||
|
||||
@@ -179,7 +179,7 @@ public class PacketManager {
|
||||
return;
|
||||
}
|
||||
|
||||
final MessageHandler handler = handlerClass.newInstance();
|
||||
final MessageHandler handler = handlerClass.getDeclaredConstructor().newInstance();
|
||||
|
||||
if (handler.getRatelimit() > 0) {
|
||||
if (client.messageTimestamps.containsKey(handlerClass) && System.currentTimeMillis() - client.messageTimestamps.get(handlerClass) < handler.getRatelimit()) {
|
||||
|
||||
Reference in New Issue
Block a user