mirror of
https://github.com/PlaceholderAPI/PlaceholderAPI
synced 2026-01-15 17:18:49 +01:00
Move verification boolean to expansion version, move to v3 api
This commit is contained in:
@@ -25,7 +25,7 @@ repositories {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("org.bstats:bstats-bukkit:3.0.1")
|
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("org.spigotmc:spigot-api:1.21-R0.1-SNAPSHOT")
|
||||||
compileOnly("dev.folia:folia-api:1.20.1-R0.1-SNAPSHOT")
|
compileOnly("dev.folia:folia-api:1.20.1-R0.1-SNAPSHOT")
|
||||||
|
|||||||
@@ -72,11 +72,6 @@ public final class CommandECloudDownload extends PlaceholderCommand {
|
|||||||
return;
|
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;
|
final CloudExpansion.Version version;
|
||||||
if (params.size() < 2) {
|
if (params.size() < 2) {
|
||||||
version = expansion.getVersion(expansion.getLatestVersion());
|
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)
|
plugin.getCloudExpansionManager().downloadExpansion(expansion, version)
|
||||||
.whenComplete((file, exception) -> {
|
.whenComplete((file, exception) -> {
|
||||||
if (exception != null) {
|
if (exception != null) {
|
||||||
|
|||||||
@@ -63,9 +63,6 @@ public final class CommandECloudExpansionInfo extends PlaceholderCommand {
|
|||||||
.append('\n')
|
.append('\n')
|
||||||
.append("&bAuthor: &f")
|
.append("&bAuthor: &f")
|
||||||
.append(expansion.getAuthor())
|
.append(expansion.getAuthor())
|
||||||
.append('\n')
|
|
||||||
.append("&bVerified: ")
|
|
||||||
.append(expansion.isVerified() ? "&a&l✔" : "&c&l❌")
|
|
||||||
.append('\n');
|
.append('\n');
|
||||||
|
|
||||||
if (params.size() < 2) {
|
if (params.size() < 2) {
|
||||||
@@ -76,6 +73,9 @@ public final class CommandECloudExpansionInfo extends PlaceholderCommand {
|
|||||||
.append(expansion.getTimeSinceLastUpdate())
|
.append(expansion.getTimeSinceLastUpdate())
|
||||||
.append(" ago")
|
.append(" ago")
|
||||||
.append('\n')
|
.append('\n')
|
||||||
|
.append("&bVerified: ")
|
||||||
|
.append(expansion.getVersion().isVerified() ? "&a&l✔" : "&c&l❌")
|
||||||
|
.append('\n')
|
||||||
.append("&bRelease Notes: &f")
|
.append("&bRelease Notes: &f")
|
||||||
.append(expansion.getVersion().getReleaseNotes())
|
.append(expansion.getVersion().getReleaseNotes())
|
||||||
.append('\n');
|
.append('\n');
|
||||||
@@ -91,6 +91,9 @@ public final class CommandECloudExpansionInfo extends PlaceholderCommand {
|
|||||||
builder.append("&bVersion: &f")
|
builder.append("&bVersion: &f")
|
||||||
.append(version.getVersion())
|
.append(version.getVersion())
|
||||||
.append('\n')
|
.append('\n')
|
||||||
|
.append("&bVerified: ")
|
||||||
|
.append(version.isVerified() ? "&a&l✔" : "&c&l❌")
|
||||||
|
.append('\n')
|
||||||
.append("&bRelease Notes: &f")
|
.append("&bRelease Notes: &f")
|
||||||
.append(version.getReleaseNotes())
|
.append(version.getReleaseNotes())
|
||||||
.append('\n')
|
.append('\n')
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ public final class CommandECloudExpansionList extends PlaceholderCommand {
|
|||||||
expansion -> "&f" + expansion.getAuthor();
|
expansion -> "&f" + expansion.getAuthor();
|
||||||
@NotNull
|
@NotNull
|
||||||
private static final Function<CloudExpansion, Object> EXPANSION_VERIFIED =
|
private static final Function<CloudExpansion, Object> EXPANSION_VERIFIED =
|
||||||
expansion -> expansion.isVerified() ? "&aY" : "&cN";
|
expansion -> expansion.getVersion().isVerified() ? "&aY" : "&cN";
|
||||||
@NotNull
|
@NotNull
|
||||||
private static final Function<CloudExpansion, Object> EXPANSION_LATEST_VERSION =
|
private static final Function<CloudExpansion, Object> EXPANSION_LATEST_VERSION =
|
||||||
expansion -> "&f" + expansion.getLatestVersion();
|
expansion -> "&f" + expansion.getLatestVersion();
|
||||||
@@ -168,7 +168,7 @@ public final class CommandECloudExpansionList extends PlaceholderCommand {
|
|||||||
.append(newline()).append(newline())
|
.append(newline()).append(newline())
|
||||||
.append(text("Author: ", AQUA)).append(text(expansion.getAuthor(), WHITE))
|
.append(text("Author: ", AQUA)).append(text(expansion.getAuthor(), WHITE))
|
||||||
.append(newline())
|
.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(newline())
|
||||||
.append(text("Released: ", AQUA)).append(text(format.format(expansion.getLastUpdate()), WHITE))
|
.append(text("Released: ", AQUA)).append(text(format.format(expansion.getLastUpdate()), WHITE))
|
||||||
.toBuilder();
|
.toBuilder();
|
||||||
|
|||||||
@@ -36,8 +36,7 @@ public class CloudExpansion {
|
|||||||
dependency_url;
|
dependency_url;
|
||||||
|
|
||||||
private boolean hasExpansion,
|
private boolean hasExpansion,
|
||||||
shouldUpdate,
|
shouldUpdate;
|
||||||
verified;
|
|
||||||
|
|
||||||
private long last_update,
|
private long last_update,
|
||||||
ratings_count;
|
ratings_count;
|
||||||
@@ -135,10 +134,6 @@ public class CloudExpansion {
|
|||||||
this.shouldUpdate = shouldUpdate;
|
this.shouldUpdate = shouldUpdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isVerified() {
|
|
||||||
return verified;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getLastUpdate() {
|
public long getLastUpdate() {
|
||||||
return last_update;
|
return last_update;
|
||||||
}
|
}
|
||||||
@@ -174,6 +169,7 @@ public class CloudExpansion {
|
|||||||
public static class Version {
|
public static class Version {
|
||||||
|
|
||||||
private String url, version, release_notes;
|
private String url, version, release_notes;
|
||||||
|
private boolean verified;
|
||||||
|
|
||||||
public String getUrl() {
|
public String getUrl() {
|
||||||
return url;
|
return url;
|
||||||
@@ -198,5 +194,13 @@ public class CloudExpansion {
|
|||||||
public void setReleaseNotes(String release_notes) {
|
public void setReleaseNotes(String release_notes) {
|
||||||
this.release_notes = release_notes;
|
this.release_notes = release_notes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isVerified() {
|
||||||
|
return verified;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVerified(boolean verified) {
|
||||||
|
this.verified = verified;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ import org.jetbrains.annotations.Unmodifiable;
|
|||||||
public final class CloudExpansionManager {
|
public final class CloudExpansionManager {
|
||||||
|
|
||||||
@NotNull
|
@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
|
@NotNull
|
||||||
private static final Gson GSON = new Gson();
|
private static final Gson GSON = new Gson();
|
||||||
|
|||||||
Reference in New Issue
Block a user