Skip to content

Commit

Permalink
update deprecated method calls
Browse files Browse the repository at this point in the history
  • Loading branch information
rfresh2 committed Jul 13, 2023
1 parent 8cea0aa commit 884895d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ java {
tasks.withType(JavaCompile).configureEach {
sourceCompatibility = targetCompatibility = "20"
options.encoding = "UTF-8"
options.deprecation(true)
}

tasks.register('writeVersion') {
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/zenith/Proxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import java.io.InputStream;
import java.io.UncheckedIOException;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.time.*;
import java.time.temporal.ChronoUnit;
Expand Down Expand Up @@ -355,7 +356,7 @@ public URL getAvatarURL(UUID uuid) {

public URL getAvatarURL(String playerName) {
try {
return new URL(String.format("https://minotar.net/helm/%s/64", playerName));
return URI.create(String.format("https://minotar.net/helm/%s/64", playerName)).toURL();
} catch (MalformedURLException e) {
SERVER_LOG.error("Failed to get avatar");
throw new UncheckedIOException(e);
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/zenith/command/CommandManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
import lombok.Getter;

import java.lang.reflect.InvocationTargetException;
import java.util.List;
import java.util.Optional;
import java.util.function.Function;
Expand All @@ -34,9 +35,9 @@ public void init() {
if (isNull(clazz)) continue;
if (Command.class.isAssignableFrom(clazz)) {
try {
final Command command = (Command) clazz.newInstance();
final Command command = (Command) clazz.getDeclaredConstructor().newInstance();
addCommand(command);
} catch (InstantiationException | IllegalAccessException e) {
} catch (NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException e) {
MODULE_LOG.warn("Error initializing command class", e);
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/zenith/module/ModuleManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.zenith.util.Wait;
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;

import java.lang.reflect.InvocationTargetException;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.ScheduledFuture;
Expand All @@ -35,9 +36,9 @@ public void init() {
if (isNull(clazz)) continue;
if (Module.class.isAssignableFrom(clazz)) {
try {
final Module module = (Module) clazz.newInstance();
final Module module = (Module) clazz.getDeclaredConstructor().newInstance();
addModule(module);
} catch (InstantiationException | IllegalAccessException e) {
} catch (NoSuchMethodException | InstantiationException | IllegalAccessException | InvocationTargetException e) {
MODULE_LOG.warn("Error initializing command class", e);
}
}
Expand Down

0 comments on commit 884895d

Please sign in to comment.