mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI.git
synced 2024-12-26 19:08:06 +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.PlaceholderAPIPlugin;
|
||||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||||
import me.clip.placeholderapi.expansion.cloud.CloudExpansion;
|
import me.clip.placeholderapi.expansion.cloud.CloudExpansion;
|
||||||
|
import me.clip.placeholderapi.util.Msg;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Unmodifiable;
|
import org.jetbrains.annotations.Unmodifiable;
|
||||||
|
|
||||||
@ -268,8 +269,7 @@ public final class CloudExpansionManager {
|
|||||||
await.remove(toIndexName(expansion));
|
await.remove(toIndexName(expansion));
|
||||||
|
|
||||||
if (exception != null) {
|
if (exception != null) {
|
||||||
plugin.getLogger().log(Level.SEVERE,
|
Msg.severe("Failed to download %s:%s", exception, expansion.getName(), expansion.getVersion());
|
||||||
"failed to download " + expansion.getName() + ":" + version.getVersion(), exception);
|
|
||||||
}
|
}
|
||||||
}, ASYNC_EXECUTOR);
|
}, ASYNC_EXECUTOR);
|
||||||
|
|
||||||
|
@ -216,6 +216,12 @@ public final class LocalExpansionManager implements Listener {
|
|||||||
if (!expansion.canRegister()) {
|
if (!expansion.canRegister()) {
|
||||||
return false;
|
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) {
|
if (expansion instanceof Configurable) {
|
||||||
Map<String, Object> defaults = ((Configurable) expansion).getDefaults();
|
Map<String, Object> defaults = ((Configurable) expansion).getDefaults();
|
||||||
@ -388,7 +394,7 @@ public final class LocalExpansionManager implements Listener {
|
|||||||
@NotNull
|
@NotNull
|
||||||
public CompletableFuture<@NotNull List<@Nullable Class<? extends PlaceholderExpansion>>> findExpansionsOnDisk() {
|
public CompletableFuture<@NotNull List<@Nullable Class<? extends PlaceholderExpansion>>> findExpansionsOnDisk() {
|
||||||
File[] files = folder.listFiles((dir, name) -> name.endsWith(".jar"));
|
File[] files = folder.listFiles((dir, name) -> name.endsWith(".jar"));
|
||||||
if(files == null){
|
if (files == null) {
|
||||||
return CompletableFuture.completedFuture(Collections.emptyList());
|
return CompletableFuture.completedFuture(Collections.emptyList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user