mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI
synced 2025-09-05 17:07:06 +02:00
Make plugin check before register to avoid possible exceptions
This commit is contained in:
@@ -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();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user