8000 feat: fetch all expansions by iGabyTM · Pull Request #952 · PlaceholderAPI/PlaceholderAPI · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ public void evaluate(@NotNull final PlaceholderAPIPlugin plugin,
return;
}

if (!expansion.isVerified() && !plugin.getPlaceholderAPIConfig().cloudAllowUnverifiedExpansions()) {
Msg.msg(sender, "&cThe expansion '&f" + params.get(0) + "&c' is not verified and can only be downloaded manually from &fhttps://placeholderapi.com/ecloud");
return;
}

final CloudExpansion.Version version;
if (params.size() < 2) {
version = expansion.getVersion(expansion.getLatestVersion());
Expand Down Expand Up @@ -86,9 +91,7 @@ public void evaluate(@NotNull final PlaceholderAPIPlugin plugin,
.getVersion() + "] &ato file: &f" + file.getName(),
"&aMake sure to type &f/papi reload &ato enable your new expansion!");

plugin.getCloudExpansionManager().clean();
plugin.getCloudExpansionManager()
.fetch(plugin.getPlaceholderAPIConfig().cloudAllowUnverifiedExpansions());
plugin.getCloudExpansionManager().load();
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ public CommandECloudRefresh() {
public void evaluate(@NotNull final PlaceholderAPIPlugin plugin,
@NotNull final CommandSender sender, @NotNull final String alias,
@NotNull @Unmodifiable final List<String> params) {
plugin.getCloudExpansionManager().clean();
plugin.getCloudExpansionManager()
.fetch(plugin.getPlaceholderAPIConfig().cloudAllowUnverifiedExpansions());
plugin.getCloudExpansionManager().load();

Msg.msg(sender,
"&aThe eCloud manager has been refreshed!");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private static String toIndexName(@NotNull final CloudExpansion expansion) {

public void load() {
clean();
fetch(plugin.getPlaceholderAPIConfig().cloudAllowUnverifiedExpansions());
fetch();
}

public void kill() {
Expand Down Expand Up @@ -170,7 +170,7 @@ public void clean() {
await.clear();
}

public void fetch(final boolean allowUnverified) {
public void fetch() {
plugin.getLogger().info("Fetching available expansion information...");

ASYNC_EXECUTOR.submit(
Expand All @@ -190,9 +190,6 @@ public void fetch(final boolean allowUnverified) {
|| expansion.getVersion(expansion.getLatestVersion()) == null) {
toRemove.add(entry.getKey());
}
if (!allowUnverified && !expansion.isVerified()) {
toRemove.add(entry.getKey());
}
}

for (String name : toRemove) {
Expand All @@ -203,7 +200,7 @@ public void fetch(final boolean allowUnverified) {
plugin.getLogger().log(Level.WARNING, "Failed to download expansion information", e);
}

// loop thru what's left on the main thread
// loop through what's left on the main thread
plugin
.getServer()
.getScheduler()
Expand Down
0