use of me.RockinChaos.itemjoin.item.ItemMap in project ItemJoin by RockinChaos.
the class Menu method enchantPane.
// ============================================================================================================================================================================================================================================================
/**
* Opens the Pane for the Player.
* This Pane is for modifying an items enchantment.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
*/
private static void enchantPane(final Player player, final ItemMap itemMap) {
Interface enchantPane = new Interface(true, 6, GUIName, player);
SchedulerUtils.runAsync(() -> {
enchantPane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item definition menu."), event -> {
creatingPane(player, itemMap);
}));
for (Enchantment enchant : Enchantment.values()) {
if (ItemHandler.getEnchantName(enchant) != null) {
boolean containsKey = (itemMap.getEnchantments() != null) ? itemMap.getEnchantments().containsKey(ItemHandler.getEnchantName(enchant).toUpperCase()) : false;
ItemStack enchantItem = ItemHandler.getItem((containsKey ? "ENCHANTED_BOOK" : "BOOK"), 1, false, "&f" + ItemHandler.getEnchantName(enchant).toUpperCase(), "&7", "&7*Click to add this enchantment", "&7to the custom item.", "&7", "&9&lENABLED: &a" + (containsKey + "").toUpperCase(), (containsKey ? "&7" : ""), (containsKey ? "&9&lLEVEL: &a" + itemMap.getEnchantments().get(ItemHandler.getEnchantName(enchant).toUpperCase()) : ""));
enchantPane.addButton(new Button(enchantItem, event -> {
if (containsKey) {
Map<String, Integer> enchantments = itemMap.getEnchantments();
enchantments.remove(ItemHandler.getEnchantName(enchant).toUpperCase());
itemMap.setEnchantments(enchantments);
enchantPane(player, itemMap);
} else {
enchantLevelPane(player, itemMap, enchant);
}
}));
}
}
});
enchantPane.open(player);
}
use of me.RockinChaos.itemjoin.item.ItemMap in project ItemJoin by RockinChaos.
the class Menu method warmPane.
/**
* Opens the Pane for the Player.
* This Pane is for setting an items command warmup duration.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
*/
private static void warmPane(final Player player, final ItemMap itemMap) {
Interface warmPane = new Interface(true, 6, GUIName, player);
SchedulerUtils.runAsync(() -> {
warmPane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item commands menu."), event -> {
commandPane(player, itemMap);
}));
warmPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "YELLOW_STAINED_GLASS_PANE" : "STAINED_GLASS_PANE:4"), 1, false, "&e&lCustom Warmup", "&7", "&7*Click to set a custom commands-warmup", "&7value for the item."), event -> {
player.closeInventory();
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "COMMAND WARMUP";
placeHolders[15] = "12";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputType", player, placeHolders);
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputExample", player, placeHolders);
}, event -> {
if (StringUtils.isInt(ChatColor.stripColor(event.getMessage()))) {
itemMap.setWarmDelay(Integer.parseInt(ChatColor.stripColor(event.getMessage())));
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "COMMAND WARMUP";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
} else {
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = ChatColor.stripColor(event.getMessage());
LanguageAPI.getLang(false).sendLangMessage("commands.menu.noInteger", player, placeHolders);
}
commandPane(event.getPlayer(), itemMap);
}));
for (int i = 1; i <= 64; i++) {
final int k = i;
warmPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "BLUE_STAINED_GLASS_PANE" : "STAINED_GLASS_PANE:11"), k, false, "&9&lWarming: &a&l" + k + " Second(s)", "&7", "&7*Click to set the", "&7commands-warmup of the item."), event -> {
itemMap.setWarmDelay(k);
commandPane(player, itemMap);
}));
}
});
warmPane.open(player);
}
use of me.RockinChaos.itemjoin.item.ItemMap in project ItemJoin by RockinChaos.
the class Menu method animatedSkullPane.
/**
* Opens the Pane for the Player.
* This Pane is for modifying animated skull items.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
*/
private static void animatedSkullPane(final Player player, final ItemMap itemMap, boolean owner) {
Interface animatedSkullPane = new Interface(true, 2, GUIName, player);
SchedulerUtils.runAsync(() -> {
if (owner) {
animatedSkullPane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the animation menu."), event -> {
if (!itemMap.getDynamicOwners().isEmpty()) {
itemMap.setAnimate(true);
itemMap.setSkullTexture("");
itemMap.setDynamicTextures(new ArrayList<String>());
itemMap.setSkull(ItemHandler.cutDelay(itemMap.getDynamicOwners().get(0)));
}
animationPane(player, itemMap);
}));
animatedSkullPane.addButton(new Button(ItemHandler.getItem("FEATHER", 1, true, "&eNew Skull Owner", "&7", "&7*Add a new skull owner", "&7to be animated between."), event -> {
player.closeInventory();
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "SKULL OWNER";
placeHolders[15] = "RockinChaos";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputType", player, placeHolders);
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputExample", player, placeHolders);
}, event -> {
durationSkullPane(player, itemMap, 0, true, ChatColor.stripColor(event.getMessage()), owner);
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "SKULL OWNER";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
}));
for (int i = 1; i <= itemMap.getDynamicOwners().size(); i++) {
final int k = i;
animatedSkullPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "GOLDEN_HELMET" : "314"), 1, false, "&fSkull Owner " + k, "&7", "&7*Click modify this animated skull owner.", "&9&lSkull Owner: &a" + ItemHandler.cutDelay(itemMap.getDynamicOwners().get(k - 1)), "&9&lAnimation Ticks: &a" + StringUtils.returnInteger(ItemHandler.getDelayFormat(itemMap.getDynamicOwners().get(k - 1)))), event -> modifySkullPane(player, itemMap, k - 1, owner)));
}
} else {
animatedSkullPane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the animation menu."), event -> {
if (!itemMap.getDynamicTextures().isEmpty()) {
itemMap.setAnimate(true);
itemMap.setSkull("");
itemMap.setDynamicOwners(new ArrayList<String>());
itemMap.setSkullTexture(ItemHandler.cutDelay(itemMap.getDynamicTextures().get(0)));
}
animationPane(player, itemMap);
}));
animatedSkullPane.addButton(new Button(ItemHandler.getItem("FEATHER", 1, true, "&eNew Skull Texture", "&7", "&7*Add a new skull texture", "&7to be animated between."), event -> {
player.closeInventory();
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "SKULL TEXTURE";
placeHolders[15] = "eyJ0ZXh0dYMGQVlN2FjZmU3OSJ9fX0=";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputType", player, placeHolders);
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputExample", player, placeHolders);
}, event -> {
durationSkullPane(player, itemMap, 0, true, ChatColor.stripColor(event.getMessage()), owner);
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "SKULL TEXTURE";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
}));
for (int i = 1; i <= itemMap.getDynamicTextures().size(); i++) {
final int k = i;
animatedSkullPane.addButton(new Button(ItemHandler.getItem("STRING", 1, false, "&fSkull Texture " + k, "&7", "&7*Click modify this animated skull texture.", "&9&lSkull Texture: &a" + (ItemHandler.cutDelay(itemMap.getDynamicTextures().get(k - 1)).length() > 40 ? ItemHandler.cutDelay(itemMap.getDynamicTextures().get(k - 1)).substring(0, 40) : ItemHandler.cutDelay(itemMap.getDynamicTextures().get(k - 1))), "&9&lAnimation Ticks: &a" + StringUtils.returnInteger(ItemHandler.getDelayFormat(itemMap.getDynamicTextures().get(k - 1)))), event -> modifySkullPane(player, itemMap, k - 1, owner)));
}
}
});
animatedSkullPane.open(player);
}
use of me.RockinChaos.itemjoin.item.ItemMap in project ItemJoin by RockinChaos.
the class Menu method levelPane.
/**
* Opens the Pane for the Player.
* This Pane is for setting the Potion Level.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
*/
private static void levelPane(final Player player, final ItemMap itemMap, final PotionEffectType potion, final int stage) {
Interface levelPane = new Interface(true, 6, GUIName, player);
SchedulerUtils.runAsync(() -> {
levelPane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the potion effect menu."), event -> potionPane(player, itemMap, stage)));
levelPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "YELLOW_STAINED_GLASS_PANE" : "STAINED_GLASS_PANE:4"), 1, false, "&e&lCustom Level", "&7", "&7*Click to set a custom level (strength)", "&7value for the potion effect.", "&7", "&c&lNote: &7Any duration LONGER than", "&71800 seconds (30 minutes) will", "&7result in an infinite duration."), event -> {
player.closeInventory();
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "EFFECT LEVEL";
placeHolders[15] = "16";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputType", player, placeHolders);
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputExample", player, placeHolders);
}, event -> {
if (StringUtils.isInt(ChatColor.stripColor(event.getMessage()))) {
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "EFFECT LEVEL";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
durationPane(event.getPlayer(), itemMap, potion, Integer.parseInt(ChatColor.stripColor(event.getMessage())), stage);
} else {
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = ChatColor.stripColor(event.getMessage());
LanguageAPI.getLang(false).sendLangMessage("commands.menu.noInteger", player, placeHolders);
levelPane(event.getPlayer(), itemMap, potion, stage);
}
}));
for (int i = 1; i <= 64; i++) {
final int k = i;
levelPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "PINK_STAINED_GLASS_PANE" : "STAINED_GLASS_PANE:6"), k, false, "&d&lLevel: &a&l" + k + "", "&7", "&7*Click to set the", "&7level (strength) of the potion effect."), event -> {
itemMap.setInteractCooldown(k);
durationPane(player, itemMap, potion, k, stage);
}));
}
});
levelPane.open(player);
}
use of me.RockinChaos.itemjoin.item.ItemMap in project ItemJoin by RockinChaos.
the class Menu method modifyPagesPane.
/**
* Opens the Pane for the Player.
* This Pane is for modifying book pages.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
*/
private static void modifyPagesPane(final Player player, final ItemMap itemMap, final int line, final int page) {
Interface linePane = new Interface(false, 2, GUIName, player);
SchedulerUtils.runAsync(() -> {
List<List<String>> pages = itemMap.getListPages();
List<String> selectPage = pages.get(page);
linePane.addButton(new Button(fillerPaneGItem), 3);
linePane.addButton(new Button(ItemHandler.getItem("NAME_TAG", 1, false, "&c&l&nModify", "&7", "&7*Modify this line in the page.", "&7", "&9&lLine: &a" + (line + 1) + " &9&lPage: &a" + (page + 1)), event -> {
player.closeInventory();
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "PAGE LINE";
placeHolders[15] = "&eWelcome to the Server!";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputType", player, placeHolders);
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputExample", player, placeHolders);
}, event -> {
selectPage.set(line, ChatColor.stripColor(event.getMessage()));
pages.set(page, selectPage);
itemMap.setListPages(pages);
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "PAGE LINE";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
linePane(event.getPlayer(), itemMap, false, page);
}));
linePane.addButton(new Button(fillerPaneGItem));
linePane.addButton(new Button(ItemHandler.getItem("REDSTONE", 1, false, "&c&l&nDelete", "&7", "&7*Delete this line in the page.", "&7", "&9&lLine: &a" + (line + 1) + " &9&lPage: &a" + (page + 1)), event -> {
selectPage.remove(selectPage.get(line));
pages.set(page, selectPage);
itemMap.setListPages(pages);
linePane(player, itemMap, false, page);
}));
linePane.addButton(new Button(fillerPaneGItem), 3);
linePane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the book lines menu."), event -> linePane(player, itemMap, false, page)));
linePane.addButton(new Button(fillerPaneBItem), 7);
linePane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the book lines menu."), event -> linePane(player, itemMap, false, page)));
});
linePane.open(player);
}
Aggregations