mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI
synced 2024-11-18 00:46:55 +01:00
Check and filter unverified expansions
This commit is contained in:
parent
6825c9afc1
commit
7900ee71e0
@ -22,8 +22,6 @@ package me.clip.placeholderapi.expansion.cloud;
|
||||
|
||||
import me.clip.placeholderapi.util.TimeUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -65,7 +65,6 @@ public class ExpansionCloudManager {
|
||||
public void clean() {
|
||||
remote.clear();
|
||||
downloading.clear();
|
||||
|
||||
}
|
||||
|
||||
public boolean isDownloading(String expansion) {
|
||||
@ -100,7 +99,7 @@ public class ExpansionCloudManager {
|
||||
first = false;
|
||||
byAuthor.put(0, ex);
|
||||
} else {
|
||||
byAuthor.put(byAuthor.lastKey()+1, ex);
|
||||
byAuthor.put(byAuthor.lastKey() + 1, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -123,7 +122,7 @@ public class ExpansionCloudManager {
|
||||
first = false;
|
||||
has.put(1, ex);
|
||||
} else {
|
||||
has.put(has.lastKey()+1, ex);
|
||||
has.put(has.lastKey() + 1, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -143,7 +142,7 @@ public class ExpansionCloudManager {
|
||||
return pages;
|
||||
}
|
||||
if (map.size() > amount) {
|
||||
pages = map.size()/amount;
|
||||
pages = map.size() / amount;
|
||||
if (map.size() % amount > 0) {
|
||||
pages++;
|
||||
}
|
||||
@ -155,14 +154,14 @@ public class ExpansionCloudManager {
|
||||
if (map == null || map.size() == 0 || page > getPagesAvailable(map, size)) {
|
||||
return null;
|
||||
}
|
||||
int end = size*page;
|
||||
int start = end-size;
|
||||
int end = size * page;
|
||||
int start = end - size;
|
||||
TreeMap<Integer, CloudExpansion> ex = new TreeMap<>();
|
||||
IntStream.range(start, end).forEach(n -> ex.put(n, map.get(n)));
|
||||
return ex;
|
||||
}
|
||||
|
||||
public void fetch() {
|
||||
public void fetch(boolean allowUnverified) {
|
||||
|
||||
plugin.getLogger().info("Fetching available expansion information...");
|
||||
|
||||
@ -226,6 +225,10 @@ public class ExpansionCloudManager {
|
||||
|
||||
CloudExpansion ce = gson.fromJson(sub.toJSONString(), CloudExpansion.class);
|
||||
|
||||
if (!allowUnverified && !ce.isVerified()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ce.getLatestVersion() == null || ce.getVersion(ce.getLatestVersion()) == null) {
|
||||
continue;
|
||||
}
|
||||
@ -315,7 +318,6 @@ public class ExpansionCloudManager {
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
|
||||
if (ver == null) {
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user