mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI.git
synced 2024-12-26 19:08:06 +01:00
Make plugin check before register to avoid possible exceptions
This commit is contained in:
parent
0ac62d6b63
commit
651e14a797
@ -180,15 +180,15 @@ public final class LocalExpansionManager implements Listener {
|
||||
Objects.requireNonNull(expansion.getIdentifier(), "The expansion identifier is null!");
|
||||
Objects.requireNonNull(expansion.getVersion(), "The expansion version is null!");
|
||||
|
||||
if (!expansion.register()) {
|
||||
if (expansion.getRequiredPlugin() != null && !expansion.getRequiredPlugin().isEmpty()) {
|
||||
if (!Bukkit.getPluginManager().isPluginEnabled(expansion.getRequiredPlugin())) {
|
||||
Msg.warn("Cannot load expansion %s due to a missing plugin: %s",
|
||||
expansion.getIdentifier(), expansion.getRequiredPlugin());
|
||||
return Optional.empty();
|
||||
}
|
||||
if (expansion.getRequiredPlugin() != null && !expansion.getRequiredPlugin().isEmpty()) {
|
||||
if (!Bukkit.getPluginManager().isPluginEnabled(expansion.getRequiredPlugin())) {
|
||||
Msg.warn("Cannot load expansion %s due to a missing Plugin: %s", expansion.getIdentifier(),
|
||||
expansion.getRequiredPlugin());
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!expansion.register()) {
|
||||
Msg.warn("Cannot load expansion %s due to an unknown issue.", expansion.getIdentifier());
|
||||
return Optional.empty();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user