use of me.RockinChaos.itemjoin.utils.interfaces.Interface in project ItemJoin by RockinChaos.
the class Menu method startMenu.
// ============================================== //
// Selection Menus //
// ============================================== //
/**
* Opens the MAIN CREATOR PANE for the Player.
*
* @param sender - The Sender to have the Pane opened.
*/
public static void startMenu(final CommandSender sender) {
final Player player = (Player) sender;
Interface pagedPane = new Interface(false, 1, GUIName, player);
SchedulerUtils.runAsync(() -> {
pagedPane.addButton(new Button(exitItem, event -> player.closeInventory()));
pagedPane.addButton(new Button(ItemHandler.getItem("ENDER_CHEST", 1, false, "&b&l&nConfig Settings", "&7", "&7*Change the GLOBAL plugin", "&7configuration settings."), event -> configSettings(player)));
pagedPane.addButton(new Button(fillerPaneBItem));
pagedPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "WRITABLE_BOOK" : "386"), 1, false, "&a&l&nCreate", "&7", "&7*Create a new item from scratch."), event -> materialPane(player, new ItemMap("item_" + StringUtils.getPath(1), "ARBITRARY"), 0, 0)));
pagedPane.addButton(new Button(ItemHandler.getItem("HOPPER", 1, false, "&e&l&nSave", "&7", "&7*Save an existing item as a custom item."), event -> startHopper(player)));
pagedPane.addButton(new Button(ItemHandler.getItem("NAME_TAG", 1, false, "&c&l&nModify", "&7", "&7*Modify an existing custom item"), event -> startModify(player, null, 0)));
pagedPane.addButton(new Button(fillerPaneBItem));
pagedPane.addButton(new Button(ItemHandler.getItem("CHEST", 1, false, "&b&l&nItem Settings", "&7", "&7*Change the GLOBAL custom items", "&7configuration settings."), event -> itemSettings(player)));
pagedPane.addButton(new Button(exitItem, event -> player.closeInventory()));
});
pagedPane.open(player);
}
use of me.RockinChaos.itemjoin.utils.interfaces.Interface in project ItemJoin by RockinChaos.
the class Menu method selectMaterialPane.
/**
* Opens the Pane for the Player.
* This Pane is for modifying aniamted material.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
*/
private static void selectMaterialPane(final Player player, final ItemMap itemMap, final int position, final boolean isNew) {
Interface selectMaterialPane = new Interface(true, 6, GUIName, player);
SchedulerUtils.runAsync(() -> {
selectMaterialPane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the animated material menu."), event -> {
animateMaterialPane(player, itemMap);
}));
selectMaterialPane.addButton(new Button(ItemHandler.getItem("STICK", 1, true, "&b&lBukkit Material", "&7", "&7*If you know the name", "&7of the BUKKIT material type", "&7simply click and type it."), event -> {
player.closeInventory();
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "BUKKIT MATERIAL";
placeHolders[15] = "IRON_SWORD";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputType", player, placeHolders);
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputExample", player, placeHolders);
}, event -> {
if (ItemHandler.getMaterial(ChatColor.stripColor(event.getMessage()), null) != null) {
if (isNew) {
durationMaterialPane(player, itemMap, position, isNew, ChatColor.stripColor(event.getMessage()).toUpperCase());
} else {
List<String> mats = itemMap.getDynamicMaterials();
mats.set(position, "<delay:" + StringUtils.returnInteger(ItemHandler.getDelayFormat(mats.get(position))) + ">" + ChatColor.stripColor(event.getMessage()).toUpperCase());
itemMap.setDynamicMaterials(mats);
modifyMaterialPane(player, itemMap, position);
}
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "BUKKIT MATERIAL";
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.noMaterial", player, placeHolders);
selectMaterialPane(player, itemMap, position, isNew);
}
}));
Inventory inventoryCheck = Bukkit.getServer().createInventory(null, 9, GUIName);
for (Material material : Material.values()) {
if (!material.name().contains("LEGACY") && material.name() != "AIR" && safeMaterial(ItemHandler.getItem(material.toString(), 1, false, "", ""), inventoryCheck)) {
if (!ServerUtils.hasSpecificUpdate("1_13") && LegacyAPI.getDataValue(material) != 0) {
for (int i = 0; i <= LegacyAPI.getDataValue(material); i++) {
if (!material.toString().equalsIgnoreCase("STEP") || material.toString().equalsIgnoreCase("STEP") && i != 2) {
final int dataValue = i;
selectMaterialPane.addButton(new Button(ItemHandler.getItem(material.toString() + ":" + dataValue, 1, false, "", "&7", "&7*Click to set the", "&7material of the item."), event -> {
if (isNew) {
if (dataValue != 0) {
durationMaterialPane(player, itemMap, position, isNew, material.name() + ":" + dataValue);
} else {
durationMaterialPane(player, itemMap, position, isNew, material.name());
}
} else {
List<String> mats = itemMap.getDynamicMaterials();
if (dataValue != 0) {
mats.set(position, "<delay:" + StringUtils.returnInteger(ItemHandler.getDelayFormat(mats.get(position))) + ">" + material.name() + ":" + dataValue);
} else {
mats.set(position, "<delay:" + StringUtils.returnInteger(ItemHandler.getDelayFormat(mats.get(position))) + ">" + material.name());
}
itemMap.setDynamicMaterials(mats);
modifyMaterialPane(player, itemMap, position);
}
}));
}
}
} else {
selectMaterialPane.addButton(new Button(ItemHandler.getItem(material.toString(), 1, false, "", "&7", "&7*Click to set the", "&7material of the item."), event -> {
if (isNew) {
durationMaterialPane(player, itemMap, position, isNew, material.name());
} else {
List<String> mats = itemMap.getDynamicMaterials();
mats.set(position, "<delay:" + StringUtils.returnInteger(ItemHandler.getDelayFormat(mats.get(position))) + ">" + material.name());
itemMap.setDynamicMaterials(mats);
modifyMaterialPane(player, itemMap, position);
}
}));
}
}
}
inventoryCheck.clear();
});
selectMaterialPane.open(player);
}
use of me.RockinChaos.itemjoin.utils.interfaces.Interface in project ItemJoin by RockinChaos.
the class Menu method attributePane.
// ==========================================================================================================================================================================================================================================================
/**
* Opens the Pane for the Player.
* This Pane is for modifying item attributes.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
*/
private static void attributePane(final Player player, final ItemMap itemMap, final boolean isLeather) {
Interface attributePane = new Interface(true, 3, GUIName, player);
SchedulerUtils.runAsync(() -> {
if (isLeather) {
attributePane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the other settings menu."), event -> otherPane(player, itemMap)));
} else {
attributePane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item definition menu."), event -> creatingPane(player, itemMap)));
}
if (ServerUtils.hasSpecificUpdate("1_9")) {
for (Attribute attribute : Attribute.values()) {
String checkAttribute = (itemMap.getAttributes().containsKey(attribute.name()) ? (attribute.name() + ":" + itemMap.getAttributes().get(attribute.name())) : "NONE");
attributePane.addButton(new Button(ItemHandler.getItem("NAME_TAG", 1, itemMap.getAttributes().containsKey(attribute.name()), "&f" + attribute.name(), "&7", "&7*Add this custom attribute to the item.", (checkAttribute != "NONE" ? "&9&lInformation: &a" + checkAttribute : "")), event -> {
if (itemMap.getAttributes().containsKey(attribute.name())) {
Map<String, Double> attributeList = itemMap.getAttributes();
attributeList.remove(attribute.name());
attributePane(player, itemMap, isLeather);
} else {
strengthPane(player, itemMap, attribute.name(), isLeather);
}
}));
}
} else {
String[] attributes = new String[] { "GENERIC_ATTACK_DAMAGE", "GENERIC_FOLLOW_RANGE", "GENERIC_MAX_HEALTH", "GENERIC_MOVEMENT_SPEED" };
for (String attribute : attributes) {
String checkAttribute = (itemMap.getAttributes().containsKey(attribute) ? (attribute + ":" + itemMap.getAttributes().get(attribute)) : "NONE");
attributePane.addButton(new Button(ItemHandler.getItem("NAME_TAG", 1, itemMap.getAttributes().containsKey(attribute), "&f" + attribute, "&7", "&7*Add this custom attribute to the item.", (checkAttribute != "NONE" ? "&9&lInformation: &a" + checkAttribute : "")), event -> {
if (itemMap.getAttributes().containsKey(attribute)) {
Map<String, Double> attributeList = itemMap.getAttributes();
attributeList.remove(attribute);
attributePane(player, itemMap, isLeather);
} else {
strengthPane(player, itemMap, attribute, isLeather);
}
}));
}
}
});
attributePane.open(player);
}
use of me.RockinChaos.itemjoin.utils.interfaces.Interface in project ItemJoin by RockinChaos.
the class Menu method blacklistPane.
/**
* Opens the Pane for the Player.
*
* @param player - The Player to have the Pane opened.
*/
private static void blacklistPane(final Player player) {
Interface blacklistPane = new Interface(false, 2, GUIName, player);
SchedulerUtils.runAsync(() -> {
String[] blacklist = ConfigHandler.getConfig().getFile("config.yml").getString("Clear-Items.Blacklist").split(",");
List<String> materials = new ArrayList<String>();
List<String> slots = new ArrayList<String>();
List<String> names = new ArrayList<String>();
try {
if (blacklist != null) {
for (String value : blacklist) {
String valType = (StringUtils.containsIgnoreCase(value, "{id") ? "id" : (StringUtils.containsIgnoreCase(value, "{slot") ? "slot" : (StringUtils.containsIgnoreCase(value, "{name") ? "name" : "")));
String inputResult = org.apache.commons.lang.StringUtils.substringBetween(value, "{" + valType + ":", "}");
if (valType.equalsIgnoreCase("id") && ItemHandler.getMaterial(inputResult.trim(), null) != null) {
materials.add(inputResult.trim().toUpperCase());
} else if (valType.equalsIgnoreCase("slot")) {
slots.add(inputResult.trim().toUpperCase());
} else if (valType.equalsIgnoreCase("name")) {
names.add(inputResult.trim());
}
}
}
} catch (Exception e) {
}
blacklistPane.addButton(new Button(fillerPaneBItem), 3);
blacklistPane.addButton(new Button(ItemHandler.getItem("DIAMOND_SWORD", 1, false, "&b&l&nMaterials", "&7", "&7*The material to be blacklisted", "&7from being cleared.", "&7", "&9&lMaterials: &a" + ((!materials.isEmpty() ? StringUtils.replaceLast(materials.toString().replaceFirst("\\[", ""), "]", "") : "NONE"))), event -> blacklistMatPane(player)));
blacklistPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "GLASS" : "20"), 1, false, "&b&l&nSlots", "&7", "&7*The inventory slots to be", "&7blacklisted from being cleared.", "&7", "&9&lSlots: &a" + ((!slots.isEmpty() ? StringUtils.replaceLast(slots.toString().replaceFirst("\\[", ""), "]", "") : "NONE"))), event -> blacklistSlotPane(player)));
blacklistPane.addButton(new Button(ItemHandler.getItem("NAME_TAG", 1, false, "&b&l&nNames", "&7", "&7*The items display names to", "&7be blacklisted from being cleared.", "&7", "&9&lNames: &a" + ((!names.isEmpty() ? StringUtils.replaceLast(names.toString().replaceFirst("\\[", ""), "]", "") : "NONE"))), event -> blacklistNamePane(player)));
blacklistPane.addButton(new Button(fillerPaneBItem), 3);
blacklistPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the clear settings."), event -> clearPane(player)));
blacklistPane.addButton(new Button(fillerPaneBItem), 7);
blacklistPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the clear settings."), event -> clearPane(player)));
});
blacklistPane.open(player);
}
use of me.RockinChaos.itemjoin.utils.interfaces.Interface 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