Add "dependency not loaded" message
This commit is contained in:
parent
166df139d7
commit
ac6de28b68
3 changed files with 17 additions and 1 deletions
|
|
@ -22,6 +22,7 @@ public class Messenger {
|
|||
"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!",
|
||||
"invalid_plugin", "&cAn error occurred while %action%ing &4%what%&c, plugin is invalid!",
|
||||
"unknown_dependency", "&cAn error occurred while %action%ing &4%what%&c, plugin has a dependeny which is not loaded: &4%arg%",
|
||||
"update", Defaults.of(
|
||||
"available", "&8&m------------=&r&8[ &b&lServerUtils Update&r &8]&m=--------------\n"
|
||||
+ " &3Current version: &b%old%\n"
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ public class PluginManager {
|
|||
plugin = Bukkit.getPluginManager().loadPlugin(file);
|
||||
} catch (InvalidDescriptionException ex) {
|
||||
return new LoadResult(Result.INVALID_DESCRIPTION);
|
||||
} catch (UnknownDependencyException ex) {
|
||||
return new LoadResult(Result.UNKNOWN_DEPENDENCY.arg(ex.getMessage()));
|
||||
} catch (InvalidPluginException ex) {
|
||||
if (ex.getCause() instanceof IllegalArgumentException) {
|
||||
IllegalArgumentException e = (IllegalArgumentException) ex.getCause();
|
||||
|
|
|
|||
|
|
@ -12,12 +12,25 @@ public enum Result {
|
|||
FILE_CHANGED,
|
||||
INVALID_DESCRIPTION,
|
||||
INVALID_PLUGIN,
|
||||
UNKNOWN_DEPENDENCY,
|
||||
ERROR,
|
||||
SUCCESS;
|
||||
|
||||
private String arg;
|
||||
|
||||
Result() {
|
||||
this.arg = "";
|
||||
}
|
||||
|
||||
public Result arg(String arg) {
|
||||
this.arg = arg;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void sendTo(CommandSender sender, String action, String what) {
|
||||
Messenger.sendMessage(sender, "serverutils." + this.name().toLowerCase(),
|
||||
"%action%", action,
|
||||
"%what%", what);
|
||||
"%what%", what,
|
||||
"%arg%", arg);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue