mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI.git
synced 2024-12-26 02:48:14 +01:00
Fix duplicate expansion loading (#866)
This commit is contained in:
parent
e246473782
commit
d5c371004c
@ -53,6 +53,7 @@ import java.util.stream.Collectors;
|
||||
import me.clip.placeholderapi.PlaceholderAPIPlugin;
|
||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||
import me.clip.placeholderapi.expansion.cloud.CloudExpansion;
|
||||
import me.clip.placeholderapi.util.Msg;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Unmodifiable;
|
||||
|
||||
@ -268,8 +269,7 @@ public final class CloudExpansionManager {
|
||||
await.remove(toIndexName(expansion));
|
||||
|
||||
if (exception != null) {
|
||||
plugin.getLogger().log(Level.SEVERE,
|
||||
"failed to download " + expansion.getName() + ":" + version.getVersion(), exception);
|
||||
Msg.severe("Failed to download %s:%s", exception, expansion.getName(), expansion.getVersion());
|
||||
}
|
||||
}, ASYNC_EXECUTOR);
|
||||
|
||||
|
@ -216,6 +216,12 @@ public final class LocalExpansionManager implements Listener {
|
||||
if (!expansion.canRegister()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (expansions.containsKey(identifier)) {
|
||||
Msg.warn("Failed to load expansion %s. Identifier is already in use.",
|
||||
expansion.getIdentifier());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (expansion instanceof Configurable) {
|
||||
Map<String, Object> defaults = ((Configurable) expansion).getDefaults();
|
||||
@ -388,7 +394,7 @@ public final class LocalExpansionManager implements Listener {
|
||||
@NotNull
|
||||
public CompletableFuture<@NotNull List<@Nullable Class<? extends PlaceholderExpansion>>> findExpansionsOnDisk() {
|
||||
File[] files = folder.listFiles((dir, name) -> name.endsWith(".jar"));
|
||||
if(files == null){
|
||||
if (files == null) {
|
||||
return CompletableFuture.completedFuture(Collections.emptyList());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user