mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI.git
synced 2024-12-27 03:17:45 +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);
|
||||||
|
|
||||||
|
@ -217,6 +217,12 @@ public final class LocalExpansionManager implements Listener {
|
|||||||
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();
|
||||||
String pre = "expansions." + identifier + ".";
|
String pre = "expansions." + identifier + ".";
|
||||||
@ -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