use of me.RockinChaos.itemjoin.utils.interfaces.Button in project ItemJoin by RockinChaos.
the class Menu method probabilityPane.
/**
* Opens the Pane for the Player.
* This Pane is for setting the item probability.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
*/
private static void probabilityPane(final Player player, final ItemMap itemMap) {
Interface probabilityPane = new Interface(true, 6, GUIName, player);
SchedulerUtils.runAsync(() -> {
probabilityPane.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 (int i = 1; i < 100; i++) {
final int k = i;
probabilityPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "BLUE_STAINED_GLASS_PANE" : "STAINED_GLASS_PANE:11"), 1, false, "&9&lChance: &a&l" + k + "%", "&7", "&7*Click to set the", "&7probability of the item."), event -> {
itemMap.setProbability(k);
creatingPane(player, itemMap);
}));
}
});
probabilityPane.open(player);
}
use of me.RockinChaos.itemjoin.utils.interfaces.Button in project ItemJoin by RockinChaos.
the class Menu method durationNamePane.
/**
* Opens the Pane for the Player.
* This Pane is for modifying animated name duration.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
*/
private static void durationNamePane(final Player player, final ItemMap itemMap, final int position, final boolean isNew, final String value) {
Interface durationPane = new Interface(true, 6, GUIName, player);
SchedulerUtils.runAsync(() -> {
durationPane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the animated menu."), event -> animatedNamePane(player, itemMap)));
durationPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "YELLOW_STAINED_GLASS_PANE" : "STAINED_GLASS_PANE:4"), 1, false, "&e&lCustom Duration", "&7", "&7*Click to set a custom duration", "&7value for the animation."), event -> {
player.closeInventory();
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "ANIMATION DURATION";
placeHolders[15] = "110";
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] = "ANIMATION DURATION";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
List<String> names = itemMap.getDynamicNames();
if (isNew) {
if (itemMap.getDynamicNames().isEmpty() && itemMap.getCustomName() != null && !itemMap.getCustomName().isEmpty()) {
names.add("<delay:" + Integer.parseInt(ChatColor.stripColor(event.getMessage())) + ">" + itemMap.getCustomName());
}
names.add("<delay:" + Integer.parseInt(ChatColor.stripColor(event.getMessage())) + ">" + value);
} else {
names.set(position, "<delay:" + Integer.parseInt(ChatColor.stripColor(event.getMessage())) + ">" + ItemHandler.cutDelay(names.get(position)));
}
itemMap.setDynamicNames(names);
if (isNew) {
animatedNamePane(player, itemMap);
} else {
modifyNamePane(player, itemMap, position);
}
} else {
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = ChatColor.stripColor(event.getMessage());
LanguageAPI.getLang(false).sendLangMessage("commands.menu.noInteger", player, placeHolders);
durationNamePane(player, itemMap, position, isNew, value);
}
}));
for (int i = 1; i <= 64; i++) {
final int k = i;
durationPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "BLUE_STAINED_GLASS_PANE" : "STAINED_GLASS_PANE:11"), k, false, "&9&lDuration: &a&l" + k + " Ticks(s)", "&7", "&7*Click to set the", "&7duration of the animation."), event -> {
List<String> names = itemMap.getDynamicNames();
if (isNew) {
if (itemMap.getDynamicNames().isEmpty() && itemMap.getCustomName() != null && !itemMap.getCustomName().isEmpty()) {
names.add("<delay:" + k + ">" + itemMap.getCustomName());
}
names.add("<delay:" + k + ">" + value);
} else {
names.set(position, "<delay:" + k + ">" + ItemHandler.cutDelay(names.get(position)));
}
itemMap.setDynamicNames(names);
if (isNew) {
animatedNamePane(player, itemMap);
} else {
modifyNamePane(player, itemMap, position);
}
}));
}
});
durationPane.open(player);
}
use of me.RockinChaos.itemjoin.utils.interfaces.Button 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.utils.interfaces.Button 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.utils.interfaces.Button 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);
}
Aggregations