Missing annotations in Bukkit & Bungee loaders

This commit is contained in:
Vankka 2022-03-04 12:51:11 +02:00
parent f3021d1472
commit bbfa71a4b2
No known key found for this signature in database
GPG Key ID: 6E50CB7A29B96AD0
2 changed files with 16 additions and 7 deletions

View File

@ -20,22 +20,26 @@ package com.discordsrv.bukkit.loader;
import dev.vankka.mcdependencydownload.bukkit.loader.BukkitLoader;
import dev.vankka.mcdependencydownload.loader.exception.LoadingException;
import org.jetbrains.annotations.NotNull;
import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;
@SuppressWarnings("unused") // Used by Bukkit
public class DiscordSRVBukkitLoader extends BukkitLoader {
@Override
public String getBootstrapClassName() {
public @NotNull String getBootstrapClassName() {
return "com.discordsrv.bukkit.DiscordSRVBukkitBootstrap";
}
@Override
public URL getJarInJarResource() {
return getClassLoader().getResource("bukkit.jarinjar");
public @NotNull URL getJarInJarResource() {
URL resource = getClassLoader().getResource("bukkit.jarinjar");
if (resource == null) {
throw new IllegalStateException("Jar does not contain jarinjar");
}
return resource;
}
@Override

View File

@ -20,6 +20,7 @@ package com.discordsrv.bungee.loader;
import dev.vankka.mcdependencydownload.bungee.loader.BungeeLoader;
import dev.vankka.mcdependencydownload.loader.exception.LoadingException;
import org.jetbrains.annotations.NotNull;
import java.net.URL;
import java.util.logging.Level;
@ -28,13 +29,17 @@ import java.util.logging.Level;
public class DiscordSRVBungeeLoader extends BungeeLoader {
@Override
public String getBootstrapClassName() {
public @NotNull String getBootstrapClassName() {
return "com.discordsrv.bungee.DiscordSRVBungeeBootstrap";
}
@Override
public URL getJarInJarResource() {
return getClass().getClassLoader().getResource("bungee.jarinjar");
public @NotNull URL getJarInJarResource() {
URL resource = getClass().getClassLoader().getResource("bungee.jarinjar");
if (resource == null) {
throw new IllegalStateException("Jar does not contain jarinjar");
}
return resource;
}
@Override