use of com.bencodez.advancedcore.api.bookgui.BookWrapper in project VotingPlugin by Ben12345rocks.
the class AdminVotePlaceholdersPlayer method onBook.
@Override
public void onBook(Player player) {
BookWrapper book = new BookWrapper("Placeholders");
for (PlaceHolder<VotingPluginUser> placeholder : plugin.getPlaceholders().getPlaceholders()) {
String identifier = placeholder.getIdentifier();
if (identifier.endsWith("_")) {
identifier += "1";
}
String value = placeholder.placeholderRequest(user, identifier);
String msg = identifier + " = " + value;
Layout layout = new Layout(new ArrayList<String>(Arrays.asList("[Json]")));
layout.replaceTextComponent("[Json]", BookUtil.TextBuilder.of(msg).color(ChatColor.AQUA).onHover(BookUtil.HoverAction.showText(value)).build());
book.addLayout(layout);
}
for (NonPlayerPlaceHolder<VotingPluginUser> placeholder : plugin.getPlaceholders().getNonPlayerPlaceholders()) {
String identifier = placeholder.getIdentifier();
if (identifier.endsWith("_")) {
identifier += "1";
}
String value = placeholder.placeholderRequest(identifier);
String msg = identifier + " = " + value;
Layout layout = new Layout(new ArrayList<String>(Arrays.asList("[Json]")));
layout.replaceTextComponent("[Json]", BookUtil.TextBuilder.of(msg).color(ChatColor.AQUA).onHover(BookUtil.HoverAction.showText(value)).build());
book.addLayout(layout);
}
book.open(player);
}
use of com.bencodez.advancedcore.api.bookgui.BookWrapper in project VotingPlugin by Ben12345rocks.
the class AdminVotePlaceholders method onBook.
@Override
public void onBook(Player player) {
BookWrapper book = new BookWrapper("Placeholders");
for (PlaceHolder<VotingPluginUser> placeholder : plugin.getPlaceholders().getPlaceholders()) {
String msg = "";
String identifier = placeholder.getIdentifier();
if (identifier.endsWith("_")) {
identifier += "#";
}
if (placeholder.hasDescription()) {
msg = "VotingPlugin_" + identifier + " - " + placeholder.getDescription();
} else {
msg = "VotingPlugin_" + identifier + "";
}
Layout layout = new Layout(new ArrayList<String>(Arrays.asList("[Json]")));
layout.replaceTextComponent("[Json]", BookUtil.TextBuilder.of(identifier).color(ChatColor.AQUA).onHover(BookUtil.HoverAction.showText(msg)).build());
book.addLayout(layout);
}
for (NonPlayerPlaceHolder<VotingPluginUser> placeholder : plugin.getPlaceholders().getNonPlayerPlaceholders()) {
String msg = "";
String identifier = placeholder.getIdentifier();
if (identifier.endsWith("_")) {
identifier += "#";
}
if (placeholder.hasDescription()) {
msg = "VotingPlugin_" + identifier + " - " + placeholder.getDescription();
} else {
msg = "VotingPlugin_" + identifier + "";
}
Layout layout = new Layout(new ArrayList<String>(Arrays.asList("[Json]")));
layout.replaceTextComponent("[Json]", BookUtil.TextBuilder.of(identifier).color(ChatColor.AQUA).onHover(BookUtil.HoverAction.showText(msg)).build());
book.addLayout(layout);
}
book.open(player);
}
use of com.bencodez.advancedcore.api.bookgui.BookWrapper in project VotingPlugin by Ben12345rocks.
the class VoteNext method onBook.
@Override
public void onBook(Player player) {
BookWrapper book = new BookWrapper(plugin.getGui().getBookVoteURLBookGUITitle());
// add colors/config options
for (VoteSite site : plugin.getVoteSites()) {
if (!site.isHidden()) {
Layout nextLayout = new Layout(new ArrayList<String>(Arrays.asList("[Json]")));
nextLayout.replaceTextComponent("[Json]", BookUtil.TextBuilder.of(book.colorize(site.getDisplayName())).onClick(BookUtil.ClickAction.openUrl(site.getVoteURLJsonStrip())).onHover(BookUtil.HoverAction.showText(user.voteCommandNextInfo(site))).build());
book.addLayout(nextLayout);
}
}
book.addLine();
book.open(player);
}
use of com.bencodez.advancedcore.api.bookgui.BookWrapper in project VotingPlugin by Ben12345rocks.
the class VoteURL method onBook.
@Override
public void onBook(Player player) {
BookWrapper book = new BookWrapper(plugin.getGui().getBookVoteURLBookGUITitle());
for (VoteSite site : plugin.getVoteSites()) {
Layout layout = new Layout(plugin.getGui().getBookVoteURLBookGUILayout()).addPlaceholder("sitename", site.getDisplayName());
String text = plugin.getGui().getBookVoteURLBookGUIAlreadyVotedText();
ChatColor color = ChatColor.valueOf(plugin.getGui().getBookVoteURLBookGUIAlreadyVotedColor());
if (user.canVoteSite(site)) {
color = ChatColor.valueOf(plugin.getGui().getBookVoteURLBookGUICanVoteColor());
text = plugin.getGui().getBookVoteURLBookGUICanVoteText();
}
String url = StringParser.getInstance().replacePlaceHolder(site.getVoteURLJsonStrip(), "player", user.getPlayerName());
layout.replaceTextComponent("[UrlText]", BookUtil.TextBuilder.of(text).color(color).onClick(BookUtil.ClickAction.openUrl(url)).onHover(BookUtil.HoverAction.showText(url)).build());
book.addLayout(layout);
}
book.open(player);
}
Aggregations