Here are the examples of the java api me.clip.placeholderapi.libs.JSONMessage.then() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
4
Source : CommandECloudExpansionList.java
with GNU General Public License v3.0
from PlaceholderAPI
with GNU General Public License v3.0
from PlaceholderAPI
@NotNull
private static JSONMessage getMessage(@NotNull final List<CloudExpansion> expansions, final int page, final int limit, @NotNull final String target) {
final SimpleDateFormat format = PlaceholderAPIPlugin.getDateFormat();
final StringBuilder tooltip = new StringBuilder();
final JSONMessage message = JSONMessage.create();
for (int index = 0; index < expansions.size(); index++) {
final CloudExpansion expansion = expansions.get(index);
tooltip.append("&bClick to download this expansion!").append('\n').append('\n').append("&bAuthor: &f").append(expansion.getAuthor()).append('\n').append("&bVerified: ").append(expansion.isVerified() ? "&a&l✔&r" : "&c&l❌&r").append('\n').append("&bLatest Version: &f").append(expansion.getLatestVersion()).append('\n').append("&bReleased: &f").append(format.format(expansion.getLastUpdate()));
final String description = expansion.getDescription();
if (description != null && !description.isEmpty()) {
tooltip.append('\n').append('\n').append("&f").append(description.replace("\r", "").trim());
}
message.then(Msg.color("&8" + (index + ((page - 1) * PAGE_SIZE) + 1) + ".&r " + (expansion.shouldUpdate() ? "&6" : expansion.hasExpansion() ? "&a" : "&7") + expansion.getName()));
message.tooltip(Msg.color(tooltip.toString()));
message.suggestCommand("/papi ecloud download " + expansion.getName());
if (index < expansions.size() - 1) {
message.newline();
}
tooltip.setLength(0);
}
if (limit > 1) {
message.newline();
message.then("◀").color(page > 1 ? ChatColor.GRAY : ChatColor.DARK_GRAY);
if (page > 1) {
message.runCommand("/papi ecloud list " + target + " " + (page - 1));
}
message.then(" " + page + " ").color(ChatColor.GREEN);
message.then("▶").color(page < limit ? ChatColor.GRAY : ChatColor.DARK_GRAY);
if (page < limit) {
message.runCommand("/papi ecloud list " + target + " " + (page + 1));
}
}
return message;
}