use of me.RockinChaos.itemjoin.item.ItemMap in project ItemJoin by RockinChaos.
the class Menu method colorPane.
/**
* Opens the Pane for the Player.
* This Pane is for selecting a Firework Color.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
*/
private static void colorPane(final Player player, final ItemMap itemMap) {
Interface colorPane = new Interface(true, 6, GUIName, player);
SchedulerUtils.runAsync(() -> {
colorPane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the special settings menu."), event -> otherPane(player, itemMap)));
for (DyeColor color : DyeColor.values()) {
colorPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "GRAY_DYE" : "351:8"), 1, StringUtils.containsValue(itemMap.getFireworkColor(), color.name()), "&f" + color.name(), "&7", "&7*This will be the color", "&7of your firework charge.", "&9&lENABLED: &a" + (StringUtils.containsValue(itemMap.getFireworkColor(), color.name()) + "").toUpperCase()), event -> {
List<DyeColor> colors = itemMap.getFireworkColor();
if (StringUtils.containsIgnoreCase(itemMap.getFireworkColor().toString(), color.name())) {
colors.remove(color);
} else {
colors.add(color);
itemMap.setFireworkColor(colors);
}
colorPane(player, itemMap);
}));
}
});
colorPane.open(player);
}
use of me.RockinChaos.itemjoin.item.ItemMap in project ItemJoin by RockinChaos.
the class Menu method commandCPane.
/**
* Opens the Pane for the Player.
* This Pane is for setting the commands conditions.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
* @param commandAction - The command action being referenced.
*/
private static void commandCPane(final Player player, final ItemMap itemMap, final Action commandAction) {
Interface conditionsPane = new Interface(true, 2, GUIName, player);
conditionsPane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the command actions menu."), event -> commandActionPane(player, itemMap)));
SchedulerUtils.runAsync(() -> {
final String commandIdent = commandAction.config().replace("-", " ").replace(".", "");
conditionsPane.addButton(new Button(ItemHandler.getItem("NAME_TAG", 1, (StringUtils.nullCheck(itemMap.getCommandMessages().get(commandAction.config())) != "NONE"), "&c&l" + String.valueOf(commandIdent.charAt(0)).toUpperCase() + commandIdent.substring(1) + " Fail Message", "&7", "&7*An optional message to be", "&7sent when the player does not", "&7meet the commands conditions.", "&7", "&9&lMESSAGE: &a" + (StringUtils.nullCheck(itemMap.getCommandMessages().get(commandAction.config())) != "NONE" ? itemMap.getCommandMessages().get(commandAction.config()) : "NONE")), event -> {
if (StringUtils.nullCheck(itemMap.getCommandMessages().get(commandAction.config())) != "NONE") {
Map<String, String> messages = itemMap.getCommandMessages();
messages.put(commandAction.config(), null);
itemMap.setCommandMessages(messages);
commandCPane(player, itemMap, commandAction);
} else {
player.closeInventory();
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "COMMAND FAIL MESSAGE";
placeHolders[15] = "&cYou do not meet the conditions to execute this item command.";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputType", player, placeHolders);
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputExample", player, placeHolders);
}
}, event -> {
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "COMMAND FAIL MESSAGE";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
Map<String, String> messages = itemMap.getCommandMessages();
messages.put(commandAction.config(), ChatColor.stripColor(event.getMessage()));
itemMap.setCommandMessages(messages);
commandCPane(player, itemMap, commandAction);
}));
conditionsPane.addButton(new Button(ItemHandler.getItem("FEATHER", 1, true, "&b&lAdd Condition", "&7", "&7*Condition(s) that must be met", "&7in order to execute the", "&7" + commandAction.config().replace("-", " ").replace(".", "") + " item commands."), event -> {
player.closeInventory();
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "FIRST VALUE";
placeHolders[15] = "100";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputType", player, placeHolders);
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputExample", player, placeHolders);
}, event -> {
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "FIRST VALUE";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
addConditionPane(event.getPlayer(), itemMap, commandAction, commandAction.config(), ChatColor.stripColor(event.getMessage()));
}));
if (itemMap.getCommandConditions().get(commandAction.config()) != null) {
for (String condition : itemMap.getCommandConditions().get(commandAction.config())) {
conditionsPane.addButton(new Button(ItemHandler.getItem("PAPER", 1, false, "&f" + condition, "&7", "&7*Click to remove this condition."), event -> {
Map<String, List<String>> commands = itemMap.getCommandConditions();
List<String> conditions = commands.get(commandAction.config());
conditions.remove(condition);
commands.put(commandAction.config(), conditions);
itemMap.setCommandConditions(commands);
commandCPane(player, itemMap, commandAction);
}));
}
}
});
conditionsPane.open(player);
}
use of me.RockinChaos.itemjoin.item.ItemMap in project ItemJoin by RockinChaos.
the class Menu method damagePane.
/**
* Opens the Pane for the Player.
* This Pane is for setting an items damage.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
*/
private static void damagePane(final Player player, final ItemMap itemMap) {
Interface damagePane = new Interface(true, 6, GUIName, player);
SchedulerUtils.runAsync(() -> {
damagePane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item definition menu."), event -> {
dataPane(player, itemMap);
}));
damagePane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "YELLOW_STAINED_GLASS_PANE" : "STAINED_GLASS_PANE:4"), 1, false, "&e&lCustom Damage", "&7", "&7*Click to set a custom damage", "&7value for the item."), event -> {
player.closeInventory();
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "DAMAGE";
placeHolders[15] = "1893";
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.setDurability((short) Integer.parseInt(ChatColor.stripColor(event.getMessage())));
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "DAMAGE";
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);
}
dataPane(event.getPlayer(), itemMap);
}));
for (int i = 1; i <= itemMap.getMaterial().getMaxDurability(); i++) {
final int k = i;
damagePane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "PINK_STAINED_GLASS_PANE" : "STAINED_GLASS_PANE:6"), 1, false, "&9&lDamage: &a&l" + k, "&7", "&7*Click to set the", "&7damage of the item."), event -> {
itemMap.setDurability((short) k);
dataPane(player, itemMap);
}));
}
});
damagePane.open(player);
}
use of me.RockinChaos.itemjoin.item.ItemMap in project ItemJoin by RockinChaos.
the class Menu method lorePane.
/**
* Opens the Pane for the Player.
* This Pane is for modifying an items lore.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
*/
private static void lorePane(final Player player, final ItemMap itemMap) {
Interface lorePane = new Interface(true, 2, GUIName, player);
SchedulerUtils.runAsync(() -> {
lorePane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item definition menu."), event -> creatingPane(player, itemMap)));
lorePane.addButton(new Button(ItemHandler.getItem("FEATHER", 1, true, "&eNew Lore Line", "&7", "&7*Add a new lore line", "&7to the item lore."), event -> {
player.closeInventory();
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "LORE LINE";
placeHolders[15] = "&bThis is a new lore line.";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputType", player, placeHolders);
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputExample", player, placeHolders);
}, event -> {
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "LORE LINE";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
List<String> lore = new ArrayList<String>();
if (itemMap.getCustomLore() != null) {
lore = itemMap.getCustomLore();
lore.add(ChatColor.stripColor(event.getMessage()));
itemMap.setCustomLore(lore);
} else {
lore.add(ChatColor.stripColor(event.getMessage()));
itemMap.setCustomLore(lore);
}
lorePane(player, itemMap);
}));
if (itemMap.getCustomLore() != null && !itemMap.getCustomLore().isEmpty()) {
for (int i = 1; i <= itemMap.getCustomLore().size(); i++) {
final int k = i;
lorePane.addButton(new Button(ItemHandler.getItem("WRITABLE_BOOK", 1, false, "&fLore " + k, "&7", "&7*Click modify this lore line.", "&9&lLore: &a" + itemMap.getCustomLore().get(k - 1)), event -> modifyLoreLinePane(player, itemMap, k - 1)));
}
}
});
lorePane.open(player);
}
use of me.RockinChaos.itemjoin.item.ItemMap in project ItemJoin by RockinChaos.
the class Menu method orderPane.
/**
* Opens the Pane for the Player.
* This Pane is for modifying an items list of commands.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
* @param action - The action to be matched.
* @param command - The ItemCommand instance being modified.
* @param orderNumber - The current number that dictates the ItemCommands "place in line".
*/
private static void orderPane(final Player player, final ItemMap itemMap, final Action action, final ItemCommand command, final int orderNumber) {
Interface orderPane = new Interface(true, 2, GUIName, player);
SchedulerUtils.runAsync(() -> {
orderPane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the command modify menu."), event -> {
modifyCommandsPane(player, itemMap, action, command, orderNumber);
}));
for (int i = 1; i <= getCommandSize(itemMap, action); i++) {
final int k = i;
orderPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "LIGHT_BLUE_STAINED_GLASS_PANE" : "STAINED_GLASS_PANE:3"), k, false, "&9&lOrder Number: &a&l" + k, "&7", "&7*Click to set the order", "&7number of the command."), event -> {
List<ItemCommand> arrayCommands = new ArrayList<ItemCommand>();
int l = 0;
for (ItemCommand Command : itemMap.getCommands()) {
if (Command.matchAction(action)) {
if ((l + 1) == k) {
arrayCommands.add(command);
}
l++;
}
if (!Command.equals(command)) {
arrayCommands.add(Command);
}
}
final ItemCommand[] commands = new ItemCommand[arrayCommands.size()];
for (int j = 0; j < arrayCommands.size(); ++j) {
commands[j] = arrayCommands.get(j);
}
itemMap.setCommands(commands);
commandListPane(player, itemMap, action);
}));
}
});
orderPane.open(player);
}
Aggregations