use of me.RockinChaos.itemjoin.utils.interfaces.Interface in project ItemJoin by RockinChaos.
the class Menu method durationPane.
/**
* Opens the Pane for the Player.
* This Pane is for setting the Potion Duration.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
*/
private static void durationPane(final Player player, final ItemMap itemMap, final PotionEffectType potion, int level, final int stage) {
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 potion effect menu."), event -> potionPane(player, itemMap, stage)));
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 potion effect."), event -> {
player.closeInventory();
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "EFFECT 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] = "EFFECT DURATION";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
potionPane(event.getPlayer(), itemMap, stage);
} else {
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = ChatColor.stripColor(event.getMessage());
LanguageAPI.getLang(false).sendLangMessage("commands.menu.noInteger", player, placeHolders);
durationPane(event.getPlayer(), itemMap, potion, level, stage);
}
}));
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 + " Second(s)", "&7", "&7*Click to set the", "&7duration of the potion effect."), event -> {
List<PotionEffect> effects = itemMap.getPotionEffect();
effects.add(new PotionEffect(potion, k, level));
itemMap.setPotionEffect(effects);
potionPane(player, itemMap, stage);
}));
}
});
durationPane.open(player);
}
use of me.RockinChaos.itemjoin.utils.interfaces.Interface in project ItemJoin by RockinChaos.
the class Menu method languagePane.
/**
* Opens the Pane for the Player.
*
* @param player - The Player to have the Pane opened.
*/
private static void languagePane(final Player player) {
Interface languagePane = new Interface(false, 2, GUIName, player);
SchedulerUtils.runAsync(() -> {
final String language = ConfigHandler.getConfig().getFile("config.yml").getString("Language").replace(" ", "");
languagePane.addButton(new Button(fillerPaneBItem));
languagePane.addButton(new Button(ItemHandler.getItem(ServerUtils.hasSpecificUpdate("1_13") ? "GRASS_BLOCK" : "2", 1, language.equalsIgnoreCase("ENGLISH"), "&6&l&nEnglish", "&7", "&7*Sets the messages sent by", "&7the plugin to the player", "&7to be written in &c&lEnglish&7.", "&7This is the type of lang.yml file", "&7generated in the plugin folder.", "&9&lENABLED: &a" + (language.equalsIgnoreCase("ENGLISH") + "").toUpperCase()), event -> {
if (!language.equalsIgnoreCase("ENGLISH")) {
File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
dataFile.set("Language", "ENGLISH");
ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
ConfigHandler.getConfig().softReload();
SchedulerUtils.runLater(2L, () -> languagePane(player));
}
}));
languagePane.addButton(new Button(ItemHandler.getItem("SAND", 1, language.equalsIgnoreCase("SPANISH"), "&6&l&nSpanish", "&7", "&7*Sets the messages sent by", "&7the plugin to the player", "&7to be written in &c&lSpanish&7.", "&7This is the type of lang.yml file", "&7generated in the plugin folder.", "&9&lENABLED: &a" + (language.equalsIgnoreCase("SPANISH") + "").toUpperCase()), event -> {
if (!language.equalsIgnoreCase("SPANISH")) {
File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
dataFile.set("Language", "SPANISH");
ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
ConfigHandler.getConfig().softReload();
SchedulerUtils.runLater(2L, () -> languagePane(player));
}
}));
languagePane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "SNOW_BLOCK" : "80"), 1, language.equalsIgnoreCase("RUSSIAN"), "&6&l&nRussian", "&7", "&7*Sets the messages sent by", "&7the plugin to the player", "&7to be written in &c&lRussian&7.", "&7This is the type of lang.yml file", "&7generated in the plugin folder.", "&9&lENABLED: &a" + (language.equalsIgnoreCase("RUSSIAN") + "").toUpperCase()), event -> {
if (!language.equalsIgnoreCase("RUSSIAN")) {
File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
dataFile.set("Language", "RUSSIAN");
ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
ConfigHandler.getConfig().softReload();
SchedulerUtils.runLater(2L, () -> languagePane(player));
}
}));
languagePane.addButton(new Button(fillerPaneBItem));
languagePane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "STONE_BRICKS" : "98"), 1, language.equalsIgnoreCase("FRENCH"), "&6&l&nFrench", "&7", "&7*Sets the messages sent by", "&7the plugin to the player", "&7to be written in &c&lFrench&7.", "&7This is the type of lang.yml file", "&7generated in the plugin folder.", "&9&lENABLED: &a" + (language.equalsIgnoreCase("FRENCH") + "").toUpperCase()), event -> {
if (!language.equalsIgnoreCase("FRENCH")) {
File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
dataFile.set("Language", "FRENCH");
ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
ConfigHandler.getConfig().softReload();
SchedulerUtils.runLater(2L, () -> languagePane(player));
}
}));
languagePane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "DIORITE" : (ServerUtils.hasSpecificUpdate("1_8") ? "1:3" : "5")), 1, language.equalsIgnoreCase("TRADITIONALCHINESE"), "&6&l&nTraditional Chinese", "&7", "&7*Sets the messages sent by", "&7the plugin to the player", "&7to be written in &c&lTraditional Chinese&7.", "&7This is the type of lang.yml file", "&7generated in the plugin folder.", "&9&lENABLED: &a" + (language.equalsIgnoreCase("TRADITIONALCHINESE") + "").toUpperCase()), event -> {
if (!language.equalsIgnoreCase("TRADITIONALCHINESE")) {
File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
dataFile.set("Language", "TRADITIONAL CHINESE");
ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
ConfigHandler.getConfig().softReload();
SchedulerUtils.runLater(2L, () -> languagePane(player));
}
}));
languagePane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "POLISHED_DIORITE" : (ServerUtils.hasSpecificUpdate("1_8") ? "1:4" : "5:3")), 1, language.equalsIgnoreCase("SIMPLIFIEDCHINESE"), "&6&l&nSimplified Chinese", "&7", "&7*Sets the messages sent by", "&7the plugin to the player", "&7to be written in &c&lSimplified Chinese&7.", "&7This is the type of lang.yml file", "&7generated in the plugin folder.", "&9&lENABLED: &a" + (language.equalsIgnoreCase("SIMPLIFIEDCHINESE") + "").toUpperCase()), event -> {
if (!language.equalsIgnoreCase("SIMPLIFIEDCHINESE")) {
File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
dataFile.set("Language", "SIMPLIFIED CHINESE");
ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
ConfigHandler.getConfig().softReload();
SchedulerUtils.runLater(2L, () -> languagePane(player));
}
}));
languagePane.addButton(new Button(fillerPaneBItem));
languagePane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the config settings menu."), event -> configSettings(player)));
languagePane.addButton(new Button(fillerPaneBItem), 7);
languagePane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the config settings menu."), event -> configSettings(player)));
});
languagePane.open(player);
}
use of me.RockinChaos.itemjoin.utils.interfaces.Interface in project ItemJoin by RockinChaos.
the class Menu method patternPane.
/**
* Opens the Pane for the Player.
* This Pane is for selecting the Banner Pattern.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
*/
private static void patternPane(final Player player, final ItemMap itemMap, final PatternType pattern) {
Interface colorPane = new Interface(true, 6, GUIName, player);
SchedulerUtils.runAsync(() -> {
colorPane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the banner patterns menu."), event -> bannerPane(player, itemMap)));
for (DyeColor color : DyeColor.values()) {
colorPane.addButton(new Button(ItemHandler.getItem("GRAY_DYE", 1, false, "&f" + color.name(), "&7", "&7*This will be the color", "&7of your banner pattern."), event -> {
List<Pattern> patterns = itemMap.getBannerPatterns();
patterns.add(new Pattern(color, pattern));
itemMap.setBannerPatterns(patterns);
bannerPane(player, itemMap);
}));
}
});
colorPane.open(player);
}
use of me.RockinChaos.itemjoin.utils.interfaces.Interface in project ItemJoin by RockinChaos.
the class Menu method bannerPane.
/**
* Opens the Pane for the Player.
* This Pane is for modifying banner items.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
*/
private static void bannerPane(final Player player, final ItemMap itemMap) {
Interface bannerPane = new Interface(true, 6, GUIName, player);
SchedulerUtils.runAsync(() -> {
bannerPane.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 (PatternType pattern : PatternType.values()) {
String patternString = "NONE";
if (StringUtils.nullCheck(itemMap.getBannerPatterns().toString()) != "NONE") {
for (Pattern patterns : itemMap.getBannerPatterns()) {
if (patterns.getPattern() == pattern) {
patternString = patterns.getColor() + ":" + patterns.getPattern().name().toUpperCase();
break;
}
}
}
final String checkPattern = patternString;
bannerPane.addButton(new Button(ItemHandler.getItem("PAPER", 1, (checkPattern != "NONE" ? true : false), "&f" + pattern.name(), "&7", "&7*Click to add this as", "&7a banner pattern.", (checkPattern != "NONE" ? "&9&lInformation: &a" + checkPattern : "")), event -> {
if (checkPattern != "NONE") {
List<Pattern> patternList = itemMap.getBannerPatterns();
if (StringUtils.nullCheck(itemMap.getBannerPatterns().toString()) != "NONE") {
for (Pattern patterns : patternList) {
if (patterns.getPattern() == pattern) {
patternList.remove(patterns);
itemMap.setBannerPatterns(patternList);
break;
}
}
}
bannerPane(player, itemMap);
} else {
patternPane(player, itemMap, pattern);
}
}));
}
});
bannerPane.open(player);
}
use of me.RockinChaos.itemjoin.utils.interfaces.Interface in project ItemJoin by RockinChaos.
the class Menu method modifyLoreLinePane.
/**
* Opens the Pane for the Player.
* This Pane is for modifying a specific lore line.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
*/
private static void modifyLoreLinePane(final Player player, final ItemMap itemMap, final int position) {
Interface modifyLorePane = new Interface(false, 2, GUIName, player);
SchedulerUtils.runAsync(() -> {
modifyLorePane.addButton(new Button(fillerPaneGItem), 3);
modifyLorePane.addButton(new Button(ItemHandler.getItem("WRITABLE_BOOK", 1, false, "&e&l&nModify", "&7", "&7*Change the lore line.", "&9&lLore: &a" + itemMap.getCustomLore().get(position)), event -> {
player.closeInventory();
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "LORE LINE";
placeHolders[15] = "&bThis is a new lore line.";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputType", player, placeHolders);
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputExample", player, placeHolders);
}, event -> {
List<String> lore = itemMap.getCustomLore();
lore.set(position, ChatColor.stripColor(event.getMessage()));
itemMap.setCustomLore(lore);
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "LORE LINE";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
modifyLoreLinePane(event.getPlayer(), itemMap, position);
}));
modifyLorePane.addButton(new Button(fillerPaneGItem));
modifyLorePane.addButton(new Button(ItemHandler.getItem("REDSTONE", 1, false, "&c&l&nDelete", "&7", "&7*Delete this lore line."), event -> {
List<String> lore = itemMap.getCustomLore();
lore.remove(position);
itemMap.setCustomLore(lore);
lorePane(player, itemMap);
}));
modifyLorePane.addButton(new Button(fillerPaneGItem), 3);
modifyLorePane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item definition menu."), event -> lorePane(player, itemMap)));
modifyLorePane.addButton(new Button(fillerPaneBItem), 7);
modifyLorePane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item definition menu."), event -> lorePane(player, itemMap)));
});
modifyLorePane.open(player);
}
Aggregations