use of com.alpsbte.plotsystem.utils.items.builder.ItemBuilder in project Plot-System by AlpsBTE.
the class BuilderUtilitiesMenu method setMenuItemsAsync.
@Override
protected void setMenuItemsAsync() {
// Set custom-heads menu item
getMenu().getSlot(10).setItem(new ItemBuilder(Material.SKULL_ITEM, 1, (byte) 3).setName("§b§l" + LangUtil.get(getMenuPlayer(), LangPaths.MenuTitle.CUSTOM_HEADS).toUpperCase()).setLore(new LoreBuilder().addLine(LangUtil.get(getMenuPlayer(), LangPaths.MenuDescription.CUSTOM_HEADS)).build()).build());
// Set banner-maker menu item
getMenu().getSlot(13).setItem(new ItemBuilder(Material.BANNER, 1, (byte) 14).setName("§b§l" + LangUtil.get(getMenuPlayer(), LangPaths.MenuTitle.BANNER_MAKER).toUpperCase()).setLore(new LoreBuilder().addLine(LangUtil.get(getMenuPlayer(), LangPaths.MenuDescription.BANNER_MAKER)).build()).build());
// Set special-blocks menu item
getMenu().getSlot(16).setItem(SpecialBlocksMenu.getMenuItem(getMenuPlayer()));
}
use of com.alpsbte.plotsystem.utils.items.builder.ItemBuilder in project Plot-System by AlpsBTE.
the class CompanionMenu method setCityProjectItems.
/**
* Sets city project items asynchronously in the menu
* @throws SQLException When querying database
*/
private void setCityProjectItems() throws SQLException {
for (int i = 0; i < cityProjects.size(); i++) {
if (i <= 28) {
CityProject cp = cityProjects.get(i);
ItemStack cpItem = cp.getCountry().getHead();
try {
PlotDifficulty cpPlotDifficulty = selectedPlotDifficulty != null ? selectedPlotDifficulty : PlotManager.getPlotDifficultyForBuilder(cp.getID(), new Builder(getMenuPlayer().getUniqueId())).get();
int plotsOpen = PlotManager.getPlots(cp.getID(), Status.unclaimed).size();
int plotsInProgress = PlotManager.getPlots(cp.getID(), Status.unfinished, Status.unreviewed).size();
int plotsCompleted = PlotManager.getPlots(cp.getID(), Status.completed).size();
int plotsUnclaimed = PlotManager.getPlots(cp.getID(), cpPlotDifficulty, Status.unclaimed).size();
getMenu().getSlot(9 + cityProjects.indexOf(cp)).setItem(new ItemBuilder(cpItem).setName("§b§l" + cp.getName()).setLore(new LoreBuilder().addLines(cp.getDescription(), "", "§6" + plotsOpen + " §7" + LangUtil.get(getMenuPlayer(), LangPaths.CityProject.PROJECT_OPEN), "§8---------------------", "§6" + plotsInProgress + " §7" + LangUtil.get(getMenuPlayer(), LangPaths.CityProject.PROJECT_IN_PROGRESS), "§6" + plotsCompleted + " §7" + LangUtil.get(getMenuPlayer(), LangPaths.CityProject.PROJECT_COMPLETED), "", plotsUnclaimed != 0 ? Utils.getFormattedDifficulty(cpPlotDifficulty) : "§f§l" + LangUtil.get(getMenuPlayer(), LangPaths.CityProject.PROJECT_NO_PLOTS)).build()).build());
} catch (SQLException | ExecutionException | InterruptedException ex) {
Bukkit.getLogger().log(Level.SEVERE, "A SQL error occurred!", ex);
getMenu().getSlot(9 + cityProjects.indexOf(cp)).setItem(MenuItems.errorItem(getMenuPlayer()));
}
}
}
}
use of com.alpsbte.plotsystem.utils.items.builder.ItemBuilder in project Plot-System by AlpsBTE.
the class PlayerPlotsMenu method setMenuItemsAsync.
@Override
protected void setMenuItemsAsync() {
// Load player head
ItemStack playerHead = Utils.getPlayerHead(builder.getUUID());
// Set player stats item
try {
getMenu().getSlot(4).setItem(new ItemBuilder(playerHead).setName("§6§l" + builder.getName()).setLore(new LoreBuilder().addLines(LangUtil.get(getMenuPlayer(), LangPaths.Plot.SCORE) + ": §f" + builder.getScore(), "§7" + LangUtil.get(getMenuPlayer(), LangPaths.Plot.COMPLETED_PLOTS) + ": §f" + builder.getCompletedBuilds()).build()).build());
} catch (SQLException ex) {
Bukkit.getLogger().log(Level.SEVERE, "A SQL error occurred!", ex);
getMenu().getSlot(4).setItem(MenuItems.errorItem(getMenuPlayer()));
}
// Set player plot items
try {
plots = PlotManager.getPlots(builder);
plotDisplayCount = Math.min(plots.size(), 36);
for (int i = 0; i < plotDisplayCount; i++) {
Plot plot = plots.get(i);
try {
ItemStack item = plot.getStatus() == Status.unfinished ? new ItemStack(Material.WOOL, 1, (byte) 1) : plot.getStatus() == Status.unreviewed ? new ItemStack(Material.MAP) : new ItemStack(Material.WOOL, 1, (byte) 13);
getMenu().getSlot(9 + i).setItem(new ItemBuilder(item).setName("§b§l" + plot.getCity().getName() + " | " + LangUtil.get(getMenuPlayer(), LangPaths.Plot.PLOT_NAME) + " #" + plot.getID()).setLore(getDescription(plot, getMenuPlayer())).build());
} catch (SQLException ex) {
Bukkit.getLogger().log(Level.SEVERE, "A SQL error occurred!", ex);
getMenu().getSlot(9 + i).setItem(MenuItems.errorItem(getMenuPlayer()));
}
}
} catch (SQLException ex) {
Bukkit.getLogger().log(Level.SEVERE, "A SQL error occurred!", ex);
}
}
use of com.alpsbte.plotsystem.utils.items.builder.ItemBuilder in project Plot-System by AlpsBTE.
the class PlotActionsMenu method setMenuItemsAsync.
@Override
protected void setMenuItemsAsync() {
// Set plot submit or undo submit item
try {
if (plot.getStatus().equals(Status.unreviewed)) {
getMenu().getSlot(10).setItem(new ItemBuilder(Material.FIREBALL, 1).setName("§c§l" + LangUtil.get(getMenuPlayer(), LangPaths.MenuTitle.UNDO_SUBMIT)).setLore(new LoreBuilder().addLine(LangUtil.get(getMenuPlayer(), LangPaths.MenuDescription.UNDO_SUBMIT)).build()).build());
} else {
getMenu().getSlot(10).setItem(new ItemBuilder(Material.NAME_TAG, 1).setName("§a§l" + LangUtil.get(getMenuPlayer(), LangPaths.MenuTitle.SUBMIT)).setLore(new LoreBuilder().addLines(LangUtil.get(getMenuPlayer(), LangPaths.MenuDescription.SUBMIT_PLOT), "", Utils.getNoteFormat(LangUtil.get(getMenuPlayer(), LangPaths.Note.WONT_BE_ABLE_CONTINUE_BUILDING))).build()).build());
}
} catch (SQLException ex) {
Bukkit.getLogger().log(Level.SEVERE, "A SQL error occurred!", ex);
getMenu().getSlot(10).setItem(MenuItems.errorItem(getMenuPlayer()));
}
// Set teleport to plot item
getMenu().getSlot(hasFeedback ? 12 : 13).setItem(new ItemBuilder(Material.COMPASS, 1).setName("§6§l" + LangUtil.get(getMenuPlayer(), LangPaths.MenuTitle.TELEPORT)).setLore(new LoreBuilder().addLine(LangUtil.get(getMenuPlayer(), LangPaths.MenuDescription.TELEPORT)).build()).build());
// Set plot abandon item
getMenu().getSlot(hasFeedback ? 14 : 16).setItem(new ItemBuilder(Material.BARRIER, 1).setName("§c§l" + LangUtil.get(getMenuPlayer(), LangPaths.MenuTitle.ABANDON)).setLore(new LoreBuilder().addLines(LangUtil.get(getMenuPlayer(), LangPaths.MenuDescription.ABANDON), "", Utils.getNoteFormat(LangUtil.get(getMenuPlayer(), LangPaths.Note.WONT_BE_ABLE_CONTINUE_BUILDING))).build()).build());
// Set plot feedback item
if (hasFeedback) {
getMenu().getSlot(16).setItem(new ItemBuilder(Material.BOOK_AND_QUILL).setName("§b§l" + LangUtil.get(getMenuPlayer(), LangPaths.Review.FEEDBACK)).setLore(new LoreBuilder().addLine(LangUtil.get(getMenuPlayer(), LangPaths.MenuDescription.FEEDBACK)).build()).build());
}
// Set plot members item
try {
if (!plot.isReviewed()) {
FileConfiguration config = PlotSystem.getPlugin().getConfigManager().getConfig();
if ((getMenuPlayer() == plot.getPlotOwner().getPlayer() || getMenuPlayer().hasPermission("plotsystem.admin")) && config.getBoolean(ConfigPaths.ENABLE_GROUP_SUPPORT)) {
getMenu().getSlot(22).setItem(new ItemBuilder(Utils.getItemHead(Utils.CustomHead.ADD_BUTTON)).setName("§b§l" + LangUtil.get(getMenuPlayer(), LangPaths.MenuTitle.MANAGE_MEMBERS)).setLore(new LoreBuilder().addLines(LangUtil.get(getMenuPlayer(), LangPaths.MenuDescription.MANAGE_MEMBERS), "", Utils.getNoteFormat(LangUtil.get(getMenuPlayer(), LangPaths.Note.SCORE_WILL_BE_SPLIT))).build()).build());
} else if (plot.getPlotMembers().stream().anyMatch(m -> m.getUUID().equals(getMenuPlayer().getUniqueId()))) {
getMenu().getSlot(22).setItem(new ItemBuilder(Utils.getItemHead(Utils.CustomHead.REMOVE_BUTTON)).setName("§b§l" + LangUtil.get(getMenuPlayer(), LangPaths.MenuTitle.LEAVE_PLOT)).setLore(new LoreBuilder().addLines(LangUtil.get(getMenuPlayer(), LangPaths.MenuDescription.LEAVE_PLOT), "", Utils.getNoteFormat(LangUtil.get(getMenuPlayer(), LangPaths.Note.WONT_BE_ABLE_CONTINUE_BUILDING))).build()).build());
}
}
} catch (SQLException ex) {
Bukkit.getLogger().log(Level.SEVERE, "A SQL error occurred!", ex);
}
}
use of com.alpsbte.plotsystem.utils.items.builder.ItemBuilder in project Plot-System by AlpsBTE.
the class PlotMemberMenu method setMenuItemsAsync.
@Override
protected void setMenuItemsAsync() {
// Set plot owner item
try {
getMenu().getSlot(10).setItem(new ItemBuilder(Utils.getPlayerHead(plot.getPlotOwner().getUUID())).setName("§6§l" + LangUtil.get(getMenuPlayer(), LangPaths.Plot.OWNER)).setLore(new LoreBuilder().addLine(plot.getPlotOwner().getName()).build()).build());
} catch (SQLException ex) {
Bukkit.getLogger().log(Level.SEVERE, "A SQL error occurred!", ex);
}
// Set plot member items
try {
builders = plot.getPlotMembers();
for (int i = 12; i < 15; i++) {
if (builders.size() >= (i - 11)) {
Builder builder = builders.get(i - 12);
getMenu().getSlot(i).setItem(new ItemBuilder(Utils.getPlayerHead(builder.getUUID())).setName("§b§l" + LangUtil.get(getMenuPlayer(), LangPaths.Plot.MEMBER)).setLore(new LoreBuilder().addLines(builder.getName(), "", Utils.getActionFormat(LangUtil.get(getMenuPlayer(), LangPaths.Note.Action.CLICK_TO_REMOVE_PLOT_MEMBER))).build()).build());
}
}
} catch (SQLException ex) {
Bukkit.getLogger().log(Level.SEVERE, "A SQL error occurred!", ex);
}
// Set add plot member item
ItemStack whitePlus = Utils.getItemHead(Utils.CustomHead.ADD_BUTTON);
getMenu().getSlot(16).setItem(new ItemBuilder(whitePlus).setName("§6§l" + LangUtil.get(getMenuPlayer(), LangPaths.MenuTitle.ADD_MEMBER_TO_PLOT)).setLore(new LoreBuilder().addLines(LangUtil.get(getMenuPlayer(), LangPaths.MenuDescription.ADD_MEMBER_TO_PLOT), "", Utils.getNoteFormat(LangUtil.get(getMenuPlayer(), LangPaths.Note.PLAYER_HAS_TO_BE_ONLINE))).build()).build());
// Set back item
getMenu().getSlot(22).setItem(MenuItems.backMenuItem(getMenuPlayer()));
}
Aggregations