mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 23:10:16 +01:00
Use parametrized reflection to remove warnings
By: durron597 <martin.jared@gmail.com>
This commit is contained in:
parent
7e52bfafa3
commit
af1435dfe3
2 changed files with 4 additions and 4 deletions
|
@ -18,7 +18,7 @@ public interface PluginManager {
|
|||
* @param loader Class name of the PluginLoader to register
|
||||
* @throws IllegalArgumentException Thrown when the given Class is not a valid PluginLoader
|
||||
*/
|
||||
public void RegisterInterface(Class loader) throws IllegalArgumentException;
|
||||
public void RegisterInterface(Class<? extends PluginLoader> loader) throws IllegalArgumentException;
|
||||
|
||||
/**
|
||||
* Checks if the given plugin is loaded and returns it when applicable
|
||||
|
|
|
@ -39,14 +39,14 @@ public final class SimplePluginManager implements PluginManager {
|
|||
* @param loader Class name of the PluginLoader to register
|
||||
* @throws IllegalArgumentException Thrown when the given Class is not a valid PluginLoader
|
||||
*/
|
||||
public void RegisterInterface(Class loader) throws IllegalArgumentException {
|
||||
public void RegisterInterface(Class<? extends PluginLoader> loader) throws IllegalArgumentException {
|
||||
PluginLoader instance;
|
||||
|
||||
if (PluginLoader.class.isAssignableFrom(loader)) {
|
||||
Constructor constructor;
|
||||
Constructor<? extends PluginLoader> constructor;
|
||||
try {
|
||||
constructor = loader.getConstructor(Server.class);
|
||||
instance = (PluginLoader) constructor.newInstance(server);
|
||||
instance = constructor.newInstance(server);
|
||||
} catch (NoSuchMethodException ex) {
|
||||
throw new IllegalArgumentException(String.format("Class %s does not have a public %s(Server) constructor", loader.getName()), ex);
|
||||
} catch (Exception ex) {
|
||||
|
|
Loading…
Reference in a new issue