use of me.RockinChaos.itemjoin.item.ItemMap in project ItemJoin by RockinChaos.
the class Menu method modifyAltCommandsPane.
/**
* Opens the Pane for the Player.
* This Pane is for modifying a command.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
* @param command - The command being modified.
* @param stage - The stage to be matched.
*/
private static void modifyAltCommandsPane(final Player player, final ItemMap itemMap, final String command, final int stage) {
Interface modPane = new Interface(false, 3, GUIName, player);
SchedulerUtils.runAsync(() -> {
modPane.addButton(new Button(fillerPaneGItem), 4);
modPane.addButton(new Button(ItemHandler.getItem("FEATHER", 1, true, "&f" + command, "&7", "&7*You are modifying this command.")));
modPane.addButton(new Button(fillerPaneGItem), 7);
modPane.addButton(new Button(ItemHandler.getItem("PAPER", 1, false, "&fModify", "&7", "&7*Sets the command to", "&7another text entry."), event -> {
player.closeInventory();
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = (stage == 4 ? "MODIFIED ACTIVE COMMAND" : "MODIFIED TOGGLE COMMAND");
placeHolders[15] = (stage == 4 ? "gamemode survival %player%" : "pvp on");
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputType", player, placeHolders);
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputExample", player, placeHolders);
}, event -> {
if (stage == 4) {
final List<String> commands = ConfigHandler.getConfig().getFile("config.yml").getStringList("Active-Commands.commands");
commands.remove(command);
commands.add(ChatColor.stripColor(event.getMessage()));
File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
dataFile.set("Active-Commands.commands", commands);
ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
ConfigHandler.getConfig().softReload();
SchedulerUtils.runLater(2L, () -> altCommandPane(player, itemMap, stage));
} else {
final List<String> toggleCommands = itemMap.getToggleCommands();
toggleCommands.remove(command);
toggleCommands.add(ChatColor.stripColor(event.getMessage()));
itemMap.setToggleCommands(toggleCommands);
}
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = (stage == 4 ? "MODIFIED ACTIVE COMMAND" : "MODIFIED TOGGLE COMMAND");
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
altCommandPane(player, itemMap, stage);
}));
modPane.addButton(new Button(fillerPaneGItem));
modPane.addButton(new Button(ItemHandler.getItem("REDSTONE", 1, false, "&fDelete", "&7", "&7*Click to &cdelete &7this command."), event -> {
if (stage == 4) {
final List<String> commands = ConfigHandler.getConfig().getFile("config.yml").getStringList("Active-Commands.commands");
commands.remove(command);
File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
dataFile.set("Active-Commands.commands", commands);
ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
ConfigHandler.getConfig().softReload();
SchedulerUtils.runLater(2L, () -> altCommandPane(player, itemMap, stage));
} else {
final List<String> toggleCommands = itemMap.getToggleCommands();
toggleCommands.remove(command);
itemMap.setToggleCommands(toggleCommands);
}
altCommandPane(player, itemMap, stage);
}));
modPane.addButton(new Button(fillerPaneGItem), 3);
if (stage == 4) {
modPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the active commands menu."), event -> altCommandPane(player, itemMap, stage)));
} else {
modPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the toggle commands menu."), event -> altCommandPane(player, itemMap, stage)));
}
modPane.addButton(new Button(fillerPaneBItem), 7);
if (stage == 4) {
modPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the active commands menu."), event -> altCommandPane(player, itemMap, stage)));
} else {
modPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the oggle commands menu."), event -> altCommandPane(player, itemMap, stage)));
}
});
modPane.open(player);
}
use of me.RockinChaos.itemjoin.item.ItemMap in project ItemJoin by RockinChaos.
the class Menu method returnConfirm.
/**
* Opens the Pane for the Player.
* This Pane is for confirming the return to the main menu.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
*/
private static void returnConfirm(final Player player, final ItemMap itemMap) {
Interface returnPane = new Interface(false, 1, GUIName, player);
SchedulerUtils.runAsync(() -> {
returnPane.addButton(new Button(fillerPaneBItem));
returnPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "RED_WOOL" : "WOOL:14"), 1, false, "&c&l&nMain Menu", "&7", "&7*Cancel and return to the", "&7main menu, all modified", "&7settings will be lost.", "&7", "&c&lWARNING: &cThis item has &lNOT&c been saved!"), event -> startMenu(player)));
returnPane.addButton(new Button(fillerPaneBItem), 2);
returnPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "LIME_WOOL" : "WOOL:5"), 1, false, "&a&l&nSave to Config", "&7", "&7*Saves the custom item", "&7settings to the items.yml file."), event -> {
itemMap.saveToConfig();
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[3] = itemMap.getConfigName();
LanguageAPI.getLang(false).sendLangMessage("commands.menu.itemSaved", player, placeHolders);
ConfigHandler.getConfig().reloadConfigs(true);
startMenu(player);
}));
returnPane.addButton(new Button(fillerPaneBItem), 2);
returnPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "YELLOW_WOOL" : "WOOL:4"), 1, false, "&e&l&nModify Settings", "&7", "&7*Continue modifying the", "&7custom item settings."), event -> creatingPane(player, itemMap)));
returnPane.addButton(new Button(fillerPaneBItem));
});
returnPane.open(player);
}
use of me.RockinChaos.itemjoin.item.ItemMap in project ItemJoin by RockinChaos.
the class Menu method animationPane.
/**
* Opens the Pane for the Player.
* This Pane is for modifying item animations.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
*/
private static void animationPane(final Player player, final ItemMap itemMap) {
Interface animationPane = new Interface(false, 2, GUIName, player);
SchedulerUtils.runAsync(() -> {
if (itemMap.getMaterial().toString().contains("PLAYER_HEAD") || itemMap.getMaterial().toString().contains("SKULL_ITEM")) {
animationPane.addButton(new Button(fillerPaneGItem), 2);
} else {
animationPane.addButton(new Button(fillerPaneGItem), 3);
}
animationPane.addButton(new Button(ItemHandler.getItem(itemMap.getMaterial().toString(), 1, false, "&c&l&nMaterial", "&7", "&7*Add additional material types", "&7to have the item change between.", "&9&lAnimated Materials: &a" + (StringUtils.nullCheck(itemMap.getDynamicMaterials() + "") != "NONE" ? "YES" : "NONE")), event -> animateMaterialPane(player, itemMap)));
animationPane.addButton(new Button(ItemHandler.getItem("NAME_TAG", 1, false, "&a&l&nName", "&7", "&7*Add additional custom names", "&7to have the item change between.", "&9&lAnimated Names: &a" + (StringUtils.nullCheck(itemMap.getDynamicNames() + "") != "NONE" ? "YES" : "NONE")), event -> animatedNamePane(player, itemMap)));
animationPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "WRITABLE_BOOK" : "386"), 1, false, "&b&l&nLore", "&7", "&7*Add additional custom lores", "&7to have the item change between.", "&9&lAnimated Lores: &a" + (StringUtils.nullCheck(itemMap.getDynamicLores() + "") != "NONE" ? "YES" : "NONE")), event -> animatedLorePane(player, itemMap)));
if (itemMap.getMaterial().toString().contains("PLAYER_HEAD") || itemMap.getMaterial().toString().contains("SKULL_ITEM")) {
animationPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "GOLDEN_HELMET" : "314"), 1, false, "&a&lSkull Owner", "&7", "&7*Add additional skull owners", "&7to have the item change between.", "&7", "&7You can only define skull owner", "&7or skull texture, this will", "&7remove any skull textures.", "&9&lAnimated Owners: &a" + (StringUtils.nullCheck(itemMap.getDynamicOwners() + "") != "NONE" ? "YES" : "NONE")), event -> animatedSkullPane(player, itemMap, true)));
animationPane.addButton(new Button(ItemHandler.getItem("STRING", 1, false, "&b&lSkull Texture", "&7", "&7*Add additional skull textures", "&7to have the item change between.", "&7", "&7You can only define skull texture", "&7or skull owner, this will", "&7remove any skull owners.", "&7", "&7Skull textures can be found", "&7at websites like &aminecraft-heads.com", "&7and the value is listed under", "&7the OTHER section.", "&9&lAnimated Textures: &a" + (StringUtils.nullCheck(itemMap.getDynamicTextures() + "") != "NONE" ? "YES" : "NONE")), event -> animatedSkullPane(player, itemMap, false)));
animationPane.addButton(new Button(fillerPaneGItem), 2);
} else {
animationPane.addButton(new Button(fillerPaneGItem), 3);
}
animationPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item definition menu."), event -> creatingPane(player, itemMap)));
animationPane.addButton(new Button(fillerPaneBItem), 7);
animationPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item definition menu."), event -> creatingPane(player, itemMap)));
});
animationPane.open(player);
}
use of me.RockinChaos.itemjoin.item.ItemMap in project ItemJoin by RockinChaos.
the class Menu method probabilityPane.
/**
* Opens the Pane for the Player.
* This Pane is for setting the item probability.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
*/
private static void probabilityPane(final Player player, final ItemMap itemMap) {
Interface probabilityPane = new Interface(true, 6, GUIName, player);
SchedulerUtils.runAsync(() -> {
probabilityPane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item definition menu."), event -> {
creatingPane(player, itemMap);
}));
for (int i = 1; i < 100; i++) {
final int k = i;
probabilityPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "BLUE_STAINED_GLASS_PANE" : "STAINED_GLASS_PANE:11"), 1, false, "&9&lChance: &a&l" + k + "%", "&7", "&7*Click to set the", "&7probability of the item."), event -> {
itemMap.setProbability(k);
creatingPane(player, itemMap);
}));
}
});
probabilityPane.open(player);
}
use of me.RockinChaos.itemjoin.item.ItemMap in project ItemJoin by RockinChaos.
the class Menu method durationNamePane.
/**
* Opens the Pane for the Player.
* This Pane is for modifying animated name duration.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
*/
private static void durationNamePane(final Player player, final ItemMap itemMap, final int position, final boolean isNew, final String value) {
Interface durationPane = new Interface(true, 6, GUIName, player);
SchedulerUtils.runAsync(() -> {
durationPane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the animated menu."), event -> animatedNamePane(player, itemMap)));
durationPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "YELLOW_STAINED_GLASS_PANE" : "STAINED_GLASS_PANE:4"), 1, false, "&e&lCustom Duration", "&7", "&7*Click to set a custom duration", "&7value for the animation."), event -> {
player.closeInventory();
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "ANIMATION DURATION";
placeHolders[15] = "110";
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()))) {
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "ANIMATION DURATION";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
List<String> names = itemMap.getDynamicNames();
if (isNew) {
if (itemMap.getDynamicNames().isEmpty() && itemMap.getCustomName() != null && !itemMap.getCustomName().isEmpty()) {
names.add("<delay:" + Integer.parseInt(ChatColor.stripColor(event.getMessage())) + ">" + itemMap.getCustomName());
}
names.add("<delay:" + Integer.parseInt(ChatColor.stripColor(event.getMessage())) + ">" + value);
} else {
names.set(position, "<delay:" + Integer.parseInt(ChatColor.stripColor(event.getMessage())) + ">" + ItemHandler.cutDelay(names.get(position)));
}
itemMap.setDynamicNames(names);
if (isNew) {
animatedNamePane(player, itemMap);
} else {
modifyNamePane(player, itemMap, position);
}
} else {
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = ChatColor.stripColor(event.getMessage());
LanguageAPI.getLang(false).sendLangMessage("commands.menu.noInteger", player, placeHolders);
durationNamePane(player, itemMap, position, isNew, value);
}
}));
for (int i = 1; i <= 64; i++) {
final int k = i;
durationPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "BLUE_STAINED_GLASS_PANE" : "STAINED_GLASS_PANE:11"), k, false, "&9&lDuration: &a&l" + k + " Ticks(s)", "&7", "&7*Click to set the", "&7duration of the animation."), event -> {
List<String> names = itemMap.getDynamicNames();
if (isNew) {
if (itemMap.getDynamicNames().isEmpty() && itemMap.getCustomName() != null && !itemMap.getCustomName().isEmpty()) {
names.add("<delay:" + k + ">" + itemMap.getCustomName());
}
names.add("<delay:" + k + ">" + value);
} else {
names.set(position, "<delay:" + k + ">" + ItemHandler.cutDelay(names.get(position)));
}
itemMap.setDynamicNames(names);
if (isNew) {
animatedNamePane(player, itemMap);
} else {
modifyNamePane(player, itemMap, position);
}
}));
}
});
durationPane.open(player);
}
Aggregations