use of me.RockinChaos.itemjoin.item.ItemCommand.Action in project ItemJoin by RockinChaos.
the class Menu method addConditionPane.
/**
* Opens the Pane for the Player.
* This Pane is for adding the item condition.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
* @param condition - The condition currently being modified.
*/
private static void addConditionPane(final Player player, final ItemMap itemMap, final Action commandAction, final String condition1, final String value1) {
Interface conditionsPane = new Interface(false, 2, GUIName, player);
SchedulerUtils.runAsync(() -> {
conditionsPane.addButton(new Button(fillerPaneBItem));
conditionsPane.addButton(new Button(ItemHandler.getItem("MINECART", 1, false, "&b&lEQUAL", "&7", "&7*The first value must be", "&7EQUAL to the second value", "&7for the condition to be met."), event -> {
player.closeInventory();
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "SECOND VALUE";
placeHolders[15] = "400";
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] = "SECOND VALUE";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
List<String> conditions = (condition1.equalsIgnoreCase("disposable-conditions") ? itemMap.getDisposableConditions() : condition1.equalsIgnoreCase("trigger-conditions") ? itemMap.getTriggerConditions() : itemMap.getCommandConditions().get(condition1) != null ? itemMap.getCommandConditions().get(condition1) : new ArrayList<String>());
conditions.add(value1 + ":" + "EQUAL" + ":" + ChatColor.stripColor(event.getMessage()));
if (condition1.equalsIgnoreCase("disposable-conditions")) {
itemMap.setDisposableConditions(conditions);
disposableCPane(player, itemMap);
} else if (condition1.equalsIgnoreCase("trigger-conditions")) {
itemMap.setTriggerConditions(conditions);
triggerCPane(player, itemMap);
} else {
Map<String, List<String>> conditions2 = itemMap.getCommandConditions();
conditions2.put(condition1.replace("-conditions", ""), conditions);
itemMap.setCommandConditions(conditions2);
commandCPane(player, itemMap, commandAction);
}
}));
conditionsPane.addButton(new Button(fillerPaneBItem));
conditionsPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "OAK_FENCE" : "85"), 1, false, "&b&lNOTEQUAL", "&7", "&7*The first value must be", "&7NOTEQUAL to the second value", "&7for the condition to be met."), event -> {
player.closeInventory();
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "SECOND VALUE";
placeHolders[15] = "400";
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] = "SECOND VALUE";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
List<String> conditions = (condition1.equalsIgnoreCase("disposable-conditions") ? itemMap.getDisposableConditions() : condition1.equalsIgnoreCase("trigger-conditions") ? itemMap.getTriggerConditions() : itemMap.getCommandConditions().get(condition1) != null ? itemMap.getCommandConditions().get(condition1) : new ArrayList<String>());
conditions.add(value1 + ":" + "NOTEQUAL" + ":" + ChatColor.stripColor(event.getMessage()));
if (condition1.equalsIgnoreCase("disposable-conditions")) {
itemMap.setDisposableConditions(conditions);
disposableCPane(player, itemMap);
} else if (condition1.equalsIgnoreCase("trigger-conditions")) {
itemMap.setTriggerConditions(conditions);
triggerCPane(player, itemMap);
} else {
Map<String, List<String>> conditions2 = itemMap.getCommandConditions();
conditions2.put(condition1.replace("-conditions", ""), conditions);
itemMap.setCommandConditions(conditions2);
commandCPane(player, itemMap, commandAction);
}
}));
conditionsPane.addButton(new Button(fillerPaneBItem));
conditionsPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "OAK_STAIRS" : "53"), 1, false, "&b&lOVER", "&7", "&7*The first value must be", "&7OVER the second value", "&7for the condition to be met.", "&7", "&c&l&nNOTE:&7 This only works if both", "&7values referenced are integers."), event -> {
player.closeInventory();
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "SECOND VALUE";
placeHolders[15] = "400";
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] = "SECOND VALUE";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
List<String> conditions = (condition1.equalsIgnoreCase("disposable-conditions") ? itemMap.getDisposableConditions() : condition1.equalsIgnoreCase("trigger-conditions") ? itemMap.getTriggerConditions() : itemMap.getCommandConditions().get(condition1) != null ? itemMap.getCommandConditions().get(condition1) : new ArrayList<String>());
conditions.add(value1 + ":" + "OVER" + ":" + ChatColor.stripColor(event.getMessage()));
if (condition1.equalsIgnoreCase("disposable-conditions")) {
itemMap.setDisposableConditions(conditions);
disposableCPane(player, itemMap);
} else if (condition1.equalsIgnoreCase("trigger-conditions")) {
itemMap.setTriggerConditions(conditions);
triggerCPane(player, itemMap);
} else {
Map<String, List<String>> conditions2 = itemMap.getCommandConditions();
conditions2.put(condition1.replace("-conditions", ""), conditions);
itemMap.setCommandConditions(conditions2);
commandCPane(player, itemMap, commandAction);
}
}));
conditionsPane.addButton(new Button(fillerPaneBItem));
conditionsPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "OAK_BOAT" : "333"), 1, false, "&b&lUNDER", "&7", "&7*The first value must be", "&7UNDER to the second value", "&7for the condition to be met.", "&7", "&c&l&nNOTE:&7 This only works if both", "&7values referenced are integers."), event -> {
player.closeInventory();
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "SECOND VALUE";
placeHolders[15] = "400";
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] = "SECOND VALUE";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
List<String> conditions = (condition1.equalsIgnoreCase("disposable-conditions") ? itemMap.getDisposableConditions() : condition1.equalsIgnoreCase("trigger-conditions") ? itemMap.getTriggerConditions() : itemMap.getCommandConditions().get(condition1) != null ? itemMap.getCommandConditions().get(condition1) : new ArrayList<String>());
conditions.add(value1 + ":" + "UNDER" + ":" + ChatColor.stripColor(event.getMessage()));
if (condition1.equalsIgnoreCase("disposable-conditions")) {
itemMap.setDisposableConditions(conditions);
disposableCPane(player, itemMap);
} else if (condition1.equalsIgnoreCase("trigger-conditions")) {
itemMap.setTriggerConditions(conditions);
triggerCPane(player, itemMap);
} else {
Map<String, List<String>> conditions2 = itemMap.getCommandConditions();
conditions2.put(condition1.replace("-conditions", ""), conditions);
itemMap.setCommandConditions(conditions2);
commandCPane(player, itemMap, commandAction);
}
}));
conditionsPane.addButton(new Button(fillerPaneBItem));
conditionsPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the " + condition1.replace("-", " ").replace(".", "") + " condition menu."), event -> {
if (condition1.equalsIgnoreCase("disposable-conditions")) {
disposableCPane(player, itemMap);
} else if (condition1.equalsIgnoreCase("trigger-conditions")) {
triggerCPane(player, itemMap);
} else {
commandCPane(player, itemMap, commandAction);
}
}));
conditionsPane.addButton(new Button(fillerPaneBItem), 7);
conditionsPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the " + condition1.replace("-", " ").replace(".", "") + " condition menu."), event -> {
if (condition1.equalsIgnoreCase("disposable-conditions")) {
disposableCPane(player, itemMap);
} else if (condition1.equalsIgnoreCase("trigger-conditions")) {
triggerCPane(player, itemMap);
} else {
commandCPane(player, itemMap, commandAction);
}
}));
});
conditionsPane.open(player);
}
use of me.RockinChaos.itemjoin.item.ItemCommand.Action in project ItemJoin by RockinChaos.
the class Menu method swapPane.
/**
* Opens the Pane for the Player.
* This Pane is for setting the commands swap-item.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
* @param action - The action to be matched.
*/
private static void swapPane(final Player player, final ItemMap itemMap, final Action action) {
Interface swapPane = new Interface(true, 6, GUIName, player);
SchedulerUtils.runAsync(() -> {
swapPane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the executors menu."), event -> {
executorPane(player, itemMap, action);
}));
for (ItemMap item : ItemUtilities.getUtilities().copyItems()) {
if (item.getNodeLocation() != itemMap.getNodeLocation()) {
if (itemMap.isAnimated() || itemMap.isDynamic()) {
setModifyMenu(true, player);
itemMap.getAnimationHandler().get(player).setMenu(true, 1);
}
swapPane.addButton(new Button(ItemHandler.addLore(item.getTempItem(), "&7", "&6---------------------------", "&7*Click to set as a swap-item.", "&9&lNode: &a" + item.getConfigName(), "&7"), event -> {
modifyCommands(itemMap, ItemCommand.fromString("swap-item: " + item.getConfigName(), action, itemMap, 0L, null), true);
commandListPane(player, itemMap, action);
}));
}
}
});
swapPane.open(player);
}
Aggregations