mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI.git
synced 2024-12-28 03:48:10 +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.getIdentifier(), "The expansion identifier is null!");
|
||||||
Objects.requireNonNull(expansion.getVersion(), "The expansion version is null!");
|
Objects.requireNonNull(expansion.getVersion(), "The expansion version is null!");
|
||||||
|
|
||||||
if (!expansion.register()) {
|
if (expansion.getRequiredPlugin() != null && !expansion.getRequiredPlugin().isEmpty()) {
|
||||||
if (expansion.getRequiredPlugin() != null && !expansion.getRequiredPlugin().isEmpty()) {
|
if (!Bukkit.getPluginManager().isPluginEnabled(expansion.getRequiredPlugin())) {
|
||||||
if (!Bukkit.getPluginManager().isPluginEnabled(expansion.getRequiredPlugin())) {
|
Msg.warn("Cannot load expansion %s due to a missing Plugin: %s", expansion.getIdentifier(),
|
||||||
Msg.warn("Cannot load expansion %s due to a missing plugin: %s",
|
expansion.getRequiredPlugin());
|
||||||
expansion.getIdentifier(), expansion.getRequiredPlugin());
|
return Optional.empty();
|
||||||
return Optional.empty();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!expansion.register()) {
|
||||||
Msg.warn("Cannot load expansion %s due to an unknown issue.", expansion.getIdentifier());
|
Msg.warn("Cannot load expansion %s due to an unknown issue.", expansion.getIdentifier());
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user