mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI.git
synced 2024-12-25 18:37:42 +01:00
feat: fetch all expansions (#952)
This commit is contained in:
parent
a497e05e55
commit
f91b4e3752
@ -72,6 +72,11 @@ public final class CommandECloudDownload extends PlaceholderCommand {
|
|||||||
return;
|
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;
|
final CloudExpansion.Version version;
|
||||||
if (params.size() < 2) {
|
if (params.size() < 2) {
|
||||||
version = expansion.getVersion(expansion.getLatestVersion());
|
version = expansion.getVersion(expansion.getLatestVersion());
|
||||||
@ -103,9 +108,7 @@ public final class CommandECloudDownload extends PlaceholderCommand {
|
|||||||
.getVersion() + "] &ato file: &f" + file.getName(),
|
.getVersion() + "] &ato file: &f" + file.getName(),
|
||||||
"&aMake sure to type &f/papi reload &ato enable your new expansion!");
|
"&aMake sure to type &f/papi reload &ato enable your new expansion!");
|
||||||
|
|
||||||
plugin.getCloudExpansionManager().clean();
|
plugin.getCloudExpansionManager().load();
|
||||||
plugin.getCloudExpansionManager()
|
|
||||||
.fetch(plugin.getPlaceholderAPIConfig().cloudAllowUnverifiedExpansions());
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,9 +38,7 @@ public final class CommandECloudRefresh extends PlaceholderCommand {
|
|||||||
public void evaluate(@NotNull final PlaceholderAPIPlugin plugin,
|
public void evaluate(@NotNull final PlaceholderAPIPlugin plugin,
|
||||||
@NotNull final CommandSender sender, @NotNull final String alias,
|
@NotNull final CommandSender sender, @NotNull final String alias,
|
||||||
@NotNull @Unmodifiable final List<String> params) {
|
@NotNull @Unmodifiable final List<String> params) {
|
||||||
plugin.getCloudExpansionManager().clean();
|
plugin.getCloudExpansionManager().load();
|
||||||
plugin.getCloudExpansionManager()
|
|
||||||
.fetch(plugin.getPlaceholderAPIConfig().cloudAllowUnverifiedExpansions());
|
|
||||||
|
|
||||||
Msg.msg(sender,
|
Msg.msg(sender,
|
||||||
"&aThe eCloud manager has been refreshed!");
|
"&aThe eCloud manager has been refreshed!");
|
||||||
|
@ -100,7 +100,7 @@ public final class CloudExpansionManager {
|
|||||||
|
|
||||||
public void load() {
|
public void load() {
|
||||||
clean();
|
clean();
|
||||||
fetch(plugin.getPlaceholderAPIConfig().cloudAllowUnverifiedExpansions());
|
fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void kill() {
|
public void kill() {
|
||||||
@ -170,7 +170,7 @@ public final class CloudExpansionManager {
|
|||||||
await.clear();
|
await.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fetch(final boolean allowUnverified) {
|
public void fetch() {
|
||||||
plugin.getLogger().info("Fetching available expansion information...");
|
plugin.getLogger().info("Fetching available expansion information...");
|
||||||
|
|
||||||
ASYNC_EXECUTOR.submit(
|
ASYNC_EXECUTOR.submit(
|
||||||
@ -190,9 +190,6 @@ public final class CloudExpansionManager {
|
|||||||
|| expansion.getVersion(expansion.getLatestVersion()) == null) {
|
|| expansion.getVersion(expansion.getLatestVersion()) == null) {
|
||||||
toRemove.add(entry.getKey());
|
toRemove.add(entry.getKey());
|
||||||
}
|
}
|
||||||
if (!allowUnverified && !expansion.isVerified()) {
|
|
||||||
toRemove.add(entry.getKey());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String name : toRemove) {
|
for (String name : toRemove) {
|
||||||
@ -203,7 +200,7 @@ public final class CloudExpansionManager {
|
|||||||
plugin.getLogger().log(Level.WARNING, "Failed to download expansion information", e);
|
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
|
plugin
|
||||||
.getServer()
|
.getServer()
|
||||||
.getScheduler()
|
.getScheduler()
|
||||||
|
Loading…
Reference in New Issue
Block a user