use of me.RockinChaos.itemjoin.item.ItemMap in project ItemJoin by RockinChaos.
the class Menu method setPage.
/**
* Adds the ItemMaps to the PagedPane for viewing.
*
* @param player - The Player.
* @param modifyPane - The PagedPane to have buttons added.
* @param items - The items to be added to the Pane.
*/
private static void setPage(final Player player, final Interface modifyPane, final List<ItemMap> items, final ItemMap contents, final ItemMap itemMap, final int k) {
ItemMap currentItem = null;
boolean crafting = false;
boolean arbitrary = false;
if (contents != null) {
modifyPane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you back to the item definition menu."), event -> creatingPane(player, contents)));
} else if (itemMap != null) {
modifyPane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you back to the recipe menu."), event -> recipePane(player, itemMap)));
}
Interface craftingPane = new Interface(false, 4, GUIName, player);
craftingPane.addButton(new Button(fillerPaneGItem), 3);
currentItem = ItemUtilities.getUtilities().getItemMap("CRAFTING[1]", items);
if (currentItem != null) {
crafting = true;
setButton(player, currentItem, craftingPane, contents, itemMap, k);
items.remove(currentItem);
} else {
craftingPane.addButton(new Button(fillerPaneGItem));
}
craftingPane.addButton(new Button(fillerPaneGItem));
currentItem = ItemUtilities.getUtilities().getItemMap("CRAFTING[2]", items);
if (currentItem != null) {
crafting = true;
setButton(player, currentItem, craftingPane, contents, itemMap, k);
items.remove(currentItem);
} else {
craftingPane.addButton(new Button(fillerPaneGItem));
}
craftingPane.addButton(new Button(fillerPaneGItem), 10);
currentItem = ItemUtilities.getUtilities().getItemMap("CRAFTING[0]", items);
if (currentItem != null) {
crafting = true;
setButton(player, currentItem, craftingPane, contents, itemMap, k);
items.remove(currentItem);
} else {
craftingPane.addButton(new Button(fillerPaneGItem));
}
craftingPane.addButton(new Button(fillerPaneGItem), 4);
currentItem = ItemUtilities.getUtilities().getItemMap("CRAFTING[3]", items);
if (currentItem != null) {
crafting = true;
setButton(player, currentItem, craftingPane, contents, itemMap, k);
items.remove(currentItem);
} else {
craftingPane.addButton(new Button(fillerPaneGItem));
}
craftingPane.addButton(new Button(fillerPaneGItem));
currentItem = ItemUtilities.getUtilities().getItemMap("CRAFTING[4]", items);
if (currentItem != null) {
crafting = true;
setButton(player, currentItem, craftingPane, contents, itemMap, k);
items.remove(currentItem);
} else {
craftingPane.addButton(new Button(fillerPaneGItem));
}
craftingPane.addButton(new Button(fillerPaneGItem), 3);
String lore = (contents == null ? "&7the modifying selection menu" : "&7the contents selection menu.");
craftingPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you back to", lore), event -> modifyPane.open(player)));
craftingPane.addButton(new Button(fillerPaneBItem), 7);
craftingPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you back to", lore), event -> modifyPane.open(player)));
Interface arbitraryPane = new Interface(true, 6, GUIName, player);
arbitraryPane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you back to", lore), event -> modifyPane.open(player)));
List<ItemMap> tempList = new ArrayList<ItemMap>();
tempList.addAll(items);
for (final ItemMap item : tempList) {
if (item.getSlot().equalsIgnoreCase("ARBITRARY")) {
setButton(player, item, arbitraryPane, contents, itemMap, k);
items.remove(item);
arbitrary = true;
}
}
modifyPane.addButton(new Button(fillerPaneGItem));
if (arbitrary == true) {
modifyPane.addButton(new Button(ItemHandler.getItem("SUGAR", 1, false, "&fArbitrary", "&7", "&7*Click to view the existing", "&7Arbitrary slot items."), event -> arbitraryPane.open(player)));
} else {
modifyPane.addButton(new Button(fillerPaneGItem));
}
if (crafting == true) {
modifyPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "CRAFTING_TABLE" : "58"), 1, false, "&fCrafting", "&7", "&7*Click to view the existing", "&7crafting slot items."), event -> craftingPane.open(player)));
} else {
modifyPane.addButton(new Button(fillerPaneGItem));
}
currentItem = ItemUtilities.getUtilities().getItemMap("HELMET", items);
if (currentItem != null) {
setButton(player, currentItem, modifyPane, contents, itemMap, k);
items.remove(currentItem);
} else {
modifyPane.addButton(new Button(fillerPaneGItem));
}
currentItem = ItemUtilities.getUtilities().getItemMap("CHESTPLATE", items);
if (currentItem != null) {
setButton(player, currentItem, modifyPane, contents, itemMap, k);
items.remove(currentItem);
} else {
modifyPane.addButton(new Button(fillerPaneGItem));
}
currentItem = ItemUtilities.getUtilities().getItemMap("LEGGINGS", items);
if (currentItem != null) {
setButton(player, currentItem, modifyPane, contents, itemMap, k);
items.remove(currentItem);
} else {
modifyPane.addButton(new Button(fillerPaneGItem));
}
currentItem = ItemUtilities.getUtilities().getItemMap("BOOTS", items);
if (currentItem != null) {
setButton(player, currentItem, modifyPane, contents, itemMap, k);
items.remove(currentItem);
} else {
modifyPane.addButton(new Button(fillerPaneGItem));
}
currentItem = ItemUtilities.getUtilities().getItemMap("OFFHAND", items);
if (currentItem != null) {
setButton(player, currentItem, modifyPane, contents, itemMap, k);
items.remove(currentItem);
} else {
modifyPane.addButton(new Button(fillerPaneGItem));
}
modifyPane.addButton(new Button(fillerPaneGItem));
for (int i = 9; i < 36; i++) {
currentItem = ItemUtilities.getUtilities().getItemMap(i + "", items);
if (currentItem != null) {
setButton(player, currentItem, modifyPane, contents, itemMap, k);
items.remove(currentItem);
} else {
modifyPane.addButton(new Button(fillerPaneGItem));
}
}
for (int j = 0; j < 9; j++) {
currentItem = ItemUtilities.getUtilities().getItemMap(j + "", items);
if (currentItem != null) {
setButton(player, currentItem, modifyPane, contents, itemMap, k);
items.remove(currentItem);
} else {
modifyPane.addButton(new Button(fillerPaneGItem));
}
}
if (!items.isEmpty()) {
setPage(player, modifyPane, items, contents, itemMap, k);
}
}
use of me.RockinChaos.itemjoin.item.ItemMap in project ItemJoin by RockinChaos.
the class Menu method modifySkullPane.
/**
* Opens the Pane for the Player.
* This Pane is for setting the skull owner or skull texture.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
*/
private static void modifySkullPane(final Player player, final ItemMap itemMap, final int position, boolean owner) {
Interface modifySkullPane = new Interface(false, 2, GUIName, player);
SchedulerUtils.runAsync(() -> {
modifySkullPane.addButton(new Button(fillerPaneGItem), 3);
if (owner) {
modifySkullPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "GOLDEN_HELMET" : "314"), 1, false, "&a&l&nSkull Owner", "&7", "&7*Change the animated skull owner.", "&9&lSkull Owner: &a" + ItemHandler.cutDelay(itemMap.getDynamicOwners().get(position))), 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 -> {
List<String> skulls = itemMap.getDynamicOwners();
skulls.set(position, "<delay:" + StringUtils.returnInteger(ItemHandler.getDelayFormat(skulls.get(position))) + ">" + ChatColor.stripColor(event.getMessage()));
itemMap.setDynamicOwners(skulls);
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "SKULL OWNER";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
modifySkullPane(event.getPlayer(), itemMap, position, owner);
}));
} else {
modifySkullPane.addButton(new Button(ItemHandler.getItem("STRING", 1, false, "&a&l&nSkull Texture", "&7", "&7*Change the animated skull texture.", "&9&lSkull Texture: &a" + ItemHandler.cutDelay(itemMap.getDynamicTextures().get(position))), 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 -> {
List<String> skulls = itemMap.getDynamicTextures();
skulls.set(position, "<delay:" + StringUtils.returnInteger(ItemHandler.getDelayFormat(skulls.get(position))) + ">" + ChatColor.stripColor(event.getMessage()));
itemMap.setDynamicTextures(skulls);
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "SKULL TEXTURE";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
modifySkullPane(event.getPlayer(), itemMap, position, owner);
}));
}
modifySkullPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "CLOCK" : "347"), 1, false, "&e&l&nDuration", "&7", "&7*Change the duration of the animation.", "&9&lAnimation Ticks: &a" + StringUtils.returnInteger(ItemHandler.getDelayFormat((owner ? itemMap.getDynamicOwners().get(position) : itemMap.getDynamicTextures().get(position))))), event -> durationSkullPane(player, itemMap, position, false, ItemHandler.cutDelay((owner ? itemMap.getDynamicOwners().get(position) : itemMap.getDynamicTextures().get(position))), owner)));
modifySkullPane.addButton(new Button(ItemHandler.getItem("REDSTONE", 1, false, "&c&l&nDelete", "&7", "&7*Delete this animated skull " + (owner ? "owner." : "texture.")), event -> {
List<String> skulls = itemMap.getDynamicOwners();
if (!owner) {
skulls = itemMap.getDynamicTextures();
}
skulls.remove(position);
if (owner) {
itemMap.setDynamicOwners(skulls);
} else {
itemMap.setDynamicTextures(skulls);
}
animatedSkullPane(player, itemMap, owner);
}));
modifySkullPane.addButton(new Button(fillerPaneGItem), 3);
modifySkullPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the animated skull menu."), event -> animatedSkullPane(player, itemMap, owner)));
modifySkullPane.addButton(new Button(fillerPaneBItem), 7);
modifySkullPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the animated skull menu."), event -> animatedSkullPane(player, itemMap, owner)));
});
modifySkullPane.open(player);
}
use of me.RockinChaos.itemjoin.item.ItemMap in project ItemJoin by RockinChaos.
the class Menu method durabilityDataPane.
/**
* Opens the Pane for the Player.
* This Pane is for setting an items durability.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
*/
private static void durabilityDataPane(final Player player, final ItemMap itemMap) {
Interface texturePane = new Interface(true, 6, GUIName, player);
SchedulerUtils.runAsync(() -> {
texturePane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item definition menu."), event -> {
dataPane(player, itemMap);
}));
texturePane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "YELLOW_STAINED_GLASS_PANE" : "STAINED_GLASS_PANE:4"), 1, false, "&e&lCustom Texture", "&7", "&7*Click to set a custom texture", "&7value for the item."), event -> {
player.closeInventory();
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "DURABILITY DATA";
placeHolders[15] = "1193";
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.setData(Integer.parseInt(ChatColor.stripColor(event.getMessage())));
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "DURABILITY DATA";
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 <= 2000; i++) {
final int k = i;
texturePane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "PINK_STAINED_GLASS_PANE" : "STAINED_GLASS_PANE:6"), 1, false, "&9&lData: &a&l" + k, "&7", "&7*Click to set the", "&7durability data of the item."), event -> {
itemMap.setData(k);
dataPane(player, itemMap);
}));
}
});
texturePane.open(player);
}
use of me.RockinChaos.itemjoin.item.ItemMap in project ItemJoin by RockinChaos.
the class Menu method particlePane.
/**
* Opens the Pane for the Player.
* This Pane is for setting an items command particle.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
*/
private static void particlePane(final Player player, final ItemMap itemMap, final int stage) {
Interface particlePane = new Interface(true, 6, GUIName, player);
SchedulerUtils.runAsync(() -> {
if (stage != 3) {
particlePane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the teleport menu."), event -> {
teleportPane(player, itemMap, stage);
}));
} else {
particlePane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item commands menu."), event -> {
commandPane(player, itemMap);
}));
}
if (stage != 3) {
} else {
particlePane.addButton(new Button(ItemHandler.getItem("SUGAR", 1, false, "&fFIREWORK_FAKE", "&7", "&7*Click to set the lifetime", "&7commands-particle of the item."), event -> lifePane(player, itemMap, "FIREWORK", 1)));
}
if (ServerUtils.hasSpecificUpdate("1_9")) {
for (org.bukkit.Particle particle : org.bukkit.Particle.values()) {
if (stage != 3) {
particlePane.addButton(new Button(ItemHandler.getItem("SUGAR", 1, false, "&f" + particle.name(), "&7", "&7*Click to set the", "&7teleport-effect of the item."), event -> {
itemMap.setTeleportEffect(particle.name());
teleportPane(player, itemMap, stage);
}));
} else {
particlePane.addButton(new Button(ItemHandler.getItem("SUGAR", 1, false, "&f" + particle.name(), "&7", "&7*Click to set the", "&7commands-particle of the item."), event -> lifePane(player, itemMap, particle.name(), 0)));
}
}
} else {
for (org.bukkit.Effect effect : org.bukkit.Effect.values()) {
if (stage != 3) {
particlePane.addButton(new Button(ItemHandler.getItem("SUGAR", 1, false, "&f" + effect.name(), "&7", "&7*Click to set the", "&7teleport-effect of the item."), event -> {
itemMap.setTeleportEffect(effect.name());
teleportPane(player, itemMap, stage);
}));
} else {
particlePane.addButton(new Button(ItemHandler.getItem("SUGAR", 1, false, "&f" + effect.name(), "&7", "&7*Click to set the", "&7commands-particle of the item."), event -> lifePane(player, itemMap, effect.name(), 0)));
}
}
}
});
particlePane.open(player);
}
use of me.RockinChaos.itemjoin.item.ItemMap in project ItemJoin by RockinChaos.
the class Menu method modifyProperty.
/**
* Opens the Pane for the Player.
* This Pane is for modifying NBT Propterties.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
*/
private static void modifyProperty(final Player player, final ItemMap itemMap, final String key) {
Interface modifyProperty = new Interface(false, 2, GUIName, player);
SchedulerUtils.runAsync(() -> {
Map<String, String> properties = itemMap.getNBTValues();
modifyProperty.addButton(new Button(fillerPaneGItem), 3);
modifyProperty.addButton(new Button(ItemHandler.getItem("NAME_TAG", 1, false, "&c&l&nModify", "&7", "&7*Modify this NBT Property.", "&7", "&9&lProperty: &a" + "&f" + key + ":" + properties.get(key)), event -> {
player.closeInventory();
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "NBT PROPERTY";
placeHolders[15] = "TranslatableDisplayName:&aUltra &cItem";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputType", player, placeHolders);
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputExample", player, placeHolders);
}, event -> {
if (ChatColor.stripColor(event.getMessage()).contains(":")) {
properties.remove(key);
String[] propertyParts = ChatColor.stripColor(event.getMessage()).split(":");
properties.put(propertyParts[0], propertyParts[1]);
}
itemMap.setNBTValues(properties);
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "NBT PROPERTY";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
nbtPane(event.getPlayer(), itemMap);
}));
modifyProperty.addButton(new Button(fillerPaneGItem));
modifyProperty.addButton(new Button(ItemHandler.getItem("REDSTONE", 1, false, "&c&l&nDelete", "&7", "&7*Delete this custom NBT Property.", "&7", "&9&lProperty: &a" + "&f" + key + ":" + properties.get(key)), event -> {
properties.remove(key);
itemMap.setNBTValues(properties);
nbtPane(player, itemMap);
}));
modifyProperty.addButton(new Button(fillerPaneGItem), 3);
modifyProperty.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the NBT Properties menu."), event -> nbtPane(player, itemMap)));
modifyProperty.addButton(new Button(fillerPaneBItem), 7);
modifyProperty.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the NBT Properties menu."), event -> nbtPane(player, itemMap)));
});
modifyProperty.open(player);
}
Aggregations