Add invalid description error message
This commit is contained in:
parent
cc6b7e4b2c
commit
b2af579896
3 changed files with 6 additions and 3 deletions
|
|
@ -18,6 +18,7 @@ public class Messenger {
|
|||
"not_enabled", "&cAn error occurred while %action%ing &4%what%&c, plugin is not enabled!",
|
||||
"already_enabled", "&cAn error occurred while %action%ing &4%what%&c, plugin is already enabled!",
|
||||
"file_changed", "&cAccessing the jar file while %action%ing &4%what%&c went wrong, please load the plugin manually!",
|
||||
"invalid_description", "&cAn error occurred while %action%ing &4%what%&c, plugin doesn't have a valid description!",
|
||||
"update", Defaults.of(
|
||||
"available", "&8&m------------=&r&8[ &b&lServerUtils Update&r &8]&m=--------------\n"
|
||||
+ " &3Current version: &b%old%\n"
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@ import net.frankheijden.serverutils.ServerUtils;
|
|||
import net.frankheijden.serverutils.reflection.*;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.*;
|
||||
import org.bukkit.plugin.InvalidPluginException;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.*;
|
||||
import org.bukkit.plugin.java.PluginClassLoader;
|
||||
|
||||
import java.io.File;
|
||||
|
|
@ -24,6 +23,8 @@ public class PluginManager {
|
|||
if (!file.exists()) return new LoadResult(Result.NOT_EXISTS);
|
||||
try {
|
||||
return new LoadResult(Bukkit.getPluginManager().loadPlugin(file), Result.SUCCESS);
|
||||
} catch (InvalidDescriptionException ex) {
|
||||
return new LoadResult(Result.INVALID_DESCRIPTION);
|
||||
} catch (InvalidPluginException ex) {
|
||||
if (ex.getCause() instanceof IllegalArgumentException) {
|
||||
IllegalArgumentException e = (IllegalArgumentException) ex.getCause();
|
||||
|
|
@ -31,9 +32,9 @@ public class PluginManager {
|
|||
return new LoadResult(Result.ALREADY_ENABLED);
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
|
||||
return new LoadResult(Result.ERROR);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ public enum Result {
|
|||
NOT_ENABLED,
|
||||
ALREADY_ENABLED,
|
||||
FILE_CHANGED,
|
||||
INVALID_DESCRIPTION,
|
||||
ERROR,
|
||||
SUCCESS;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue