use of me.RockinChaos.itemjoin.utils.interfaces.Button 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.Button 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.Button 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.Button 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);
}
use of me.RockinChaos.itemjoin.utils.interfaces.Button in project ItemJoin by RockinChaos.
the class Menu method dataPane.
/**
* Opens the Pane for the Player.
* This Pane is for modifying an items data.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
*/
private static void dataPane(final Player player, final ItemMap itemMap) {
Interface dataPane = new Interface(false, 2, GUIName, player);
SchedulerUtils.runAsync(() -> {
dataPane.addButton(new Button(fillerPaneBItem));
dataPane.addButton(new Button(ItemHandler.setDurability(ItemHandler.getItem("BOW", 1, false, "&b&lDamage", "&7", "&7*Set the damage of the item.", (itemMap.getMaterial().getMaxDurability() != 0 ? "&9&lDURABILITY: &a" + StringUtils.nullCheck(itemMap.getDurability() + "&7") : "&c&lERROR: &7This item is NOT damagable.")), 50), event -> {
if (StringUtils.nullCheck(itemMap.getDurability() + "&7") != "NONE") {
itemMap.setDurability(null);
dataPane(player, itemMap);
} else if (itemMap.getMaterial().getMaxDurability() != 0) {
damagePane(player, itemMap);
}
}));
dataPane.addButton(new Button(fillerPaneBItem), 2);
dataPane.addButton(new Button(ItemHandler.getItem("STICK", 1, false, "&a&lCustom Texture", "&7", "&7*Set the custom data of the item.", "&7This is the damage value assigned", "&7to the custom resource texture.", "&9&lDURABILITY DATA: &a" + StringUtils.nullCheck(itemMap.getData() + "&7")), event -> {
if (StringUtils.nullCheck(itemMap.getData() + "&7") != "NONE") {
itemMap.setData(null);
dataPane(player, itemMap);
} else {
durabilityDataPane(player, itemMap);
}
}));
dataPane.addButton(new Button(fillerPaneBItem), 2);
dataPane.addButton(new Button(ItemHandler.getItem("NAME_TAG", 1, false, "&e&lCustom Model Data", "&7", "&7*Set the custom model data of the item.", !ServerUtils.hasSpecificUpdate("1_14") ? "&c&l[ERROR] &7This version of Minecraft does" : "", !ServerUtils.hasSpecificUpdate("1_14") ? "&7not support custom model data." : "", !ServerUtils.hasSpecificUpdate("1_14") ? "&7This was implemented in 1.14+." : "", "&9&lTEXTURE DATA: &a" + StringUtils.nullCheck(itemMap.getModelData() + "&7")), event -> {
if (StringUtils.nullCheck(itemMap.getModelData() + "&7") != "NONE" && ServerUtils.hasSpecificUpdate("1_14")) {
itemMap.setModelData(null);
dataPane(player, itemMap);
} else if (ServerUtils.hasSpecificUpdate("1_14")) {
modelDataPane(player, itemMap);
}
}));
dataPane.addButton(new Button(fillerPaneBItem));
dataPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item definition menu"), event -> {
setTriggers(itemMap);
creatingPane(player, itemMap);
}));
dataPane.addButton(new Button(fillerPaneBItem), 7);
dataPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item definition menu"), event -> {
setTriggers(itemMap);
creatingPane(player, itemMap);
}));
});
dataPane.open(player);
}
Aggregations