Move verification boolean to expansion version, move to v3 api

This commit is contained in:
PiggyPiglet
2026-01-12 17:40:35 +08:00
parent 84948101f4
commit b0fb784079
6 changed files with 25 additions and 18 deletions

View File

@@ -25,7 +25,7 @@ repositories {
dependencies {
implementation("org.bstats:bstats-bukkit:3.0.1")
implementation("net.kyori:adventure-platform-bukkit:4.3.3")
implementation("net.kyori:adventure-platform-bukkit:4.4.1")
//compileOnly("org.spigotmc:spigot-api:1.21-R0.1-SNAPSHOT")
compileOnly("dev.folia:folia-api:1.20.1-R0.1-SNAPSHOT")

View File

@@ -72,11 +72,6 @@ public final class CommandECloudDownload extends PlaceholderCommand {
return;
}
if (!expansion.isVerified()) {
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());
@@ -95,6 +90,11 @@ public final class CommandECloudDownload extends PlaceholderCommand {
}
}
if (!version.isVerified()) {
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;
}
plugin.getCloudExpansionManager().downloadExpansion(expansion, version)
.whenComplete((file, exception) -> {
if (exception != null) {

View File

@@ -63,9 +63,6 @@ public final class CommandECloudExpansionInfo extends PlaceholderCommand {
.append('\n')
.append("&bAuthor: &f")
.append(expansion.getAuthor())
.append('\n')
.append("&bVerified: ")
.append(expansion.isVerified() ? "&a&l✔" : "&c&l❌")
.append('\n');
if (params.size() < 2) {
@@ -76,6 +73,9 @@ public final class CommandECloudExpansionInfo extends PlaceholderCommand {
.append(expansion.getTimeSinceLastUpdate())
.append(" ago")
.append('\n')
.append("&bVerified: ")
.append(expansion.getVersion().isVerified() ? "&a&l✔" : "&c&l❌")
.append('\n')
.append("&bRelease Notes: &f")
.append(expansion.getVersion().getReleaseNotes())
.append('\n');
@@ -91,6 +91,9 @@ public final class CommandECloudExpansionInfo extends PlaceholderCommand {
builder.append("&bVersion: &f")
.append(version.getVersion())
.append('\n')
.append("&bVerified: ")
.append(version.isVerified() ? "&a&l✔" : "&c&l❌")
.append('\n')
.append("&bRelease Notes: &f")
.append(version.getReleaseNotes())
.append('\n')

View File

@@ -65,7 +65,7 @@ public final class CommandECloudExpansionList extends PlaceholderCommand {
expansion -> "&f" + expansion.getAuthor();
@NotNull
private static final Function<CloudExpansion, Object> EXPANSION_VERIFIED =
expansion -> expansion.isVerified() ? "&aY" : "&cN";
expansion -> expansion.getVersion().isVerified() ? "&aY" : "&cN";
@NotNull
private static final Function<CloudExpansion, Object> EXPANSION_LATEST_VERSION =
expansion -> "&f" + expansion.getLatestVersion();
@@ -168,7 +168,7 @@ public final class CommandECloudExpansionList extends PlaceholderCommand {
.append(newline()).append(newline())
.append(text("Author: ", AQUA)).append(text(expansion.getAuthor(), WHITE))
.append(newline())
.append(text("Verified: ", AQUA)).append(text(expansion.isVerified() ? "" : "", expansion.isVerified() ? GREEN : RED, TextDecoration.BOLD))
.append(text("Verified: ", AQUA)).append(text(expansion.getVersion().isVerified() ? "" : "", expansion.getVersion().isVerified() ? GREEN : RED, TextDecoration.BOLD))
.append(newline())
.append(text("Released: ", AQUA)).append(text(format.format(expansion.getLastUpdate()), WHITE))
.toBuilder();

View File

@@ -36,8 +36,7 @@ public class CloudExpansion {
dependency_url;
private boolean hasExpansion,
shouldUpdate,
verified;
shouldUpdate;
private long last_update,
ratings_count;
@@ -135,10 +134,6 @@ public class CloudExpansion {
this.shouldUpdate = shouldUpdate;
}
public boolean isVerified() {
return verified;
}
public long getLastUpdate() {
return last_update;
}
@@ -174,6 +169,7 @@ public class CloudExpansion {
public static class Version {
private String url, version, release_notes;
private boolean verified;
public String getUrl() {
return url;
@@ -198,5 +194,13 @@ public class CloudExpansion {
public void setReleaseNotes(String release_notes) {
this.release_notes = release_notes;
}
public boolean isVerified() {
return verified;
}
public void setVerified(boolean verified) {
this.verified = verified;
}
}
}

View File

@@ -60,7 +60,7 @@ import org.jetbrains.annotations.Unmodifiable;
public final class CloudExpansionManager {
@NotNull
private static final String API_URL = "https://ecloud.placeholderapi.com/v2/";
private static final String API_URL = "https://ecloud.placeholderapi.com/api/v3/";
@NotNull
private static final Gson GSON = new Gson();