use of me.RockinChaos.itemjoin.utils.interfaces.Interface in project ItemJoin by RockinChaos.
the class Menu method explosionPane.
/**
* Opens the Pane for the Player.
* This Pane is for setting the commands firework explosion particle.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
*/
private static void explosionPane(final Player player, final ItemMap itemMap, final String particle, final int lifetime) {
Interface patternPane = new Interface(true, 2, GUIName, player);
SchedulerUtils.runAsync(() -> {
patternPane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the particle menu."), event -> {
particlePane(player, itemMap, 3);
}));
for (Type explosion : Type.values()) {
patternPane.addButton(new Button(ItemHandler.getItem("PAPER", 1, false, "&f" + explosion.name(), "&7", "&7*Click to set the pattern", "&7of the firework explosion effect."), event -> colorParticlePane(player, itemMap, particle, lifetime, explosion, null)));
}
});
patternPane.open(player);
}
use of me.RockinChaos.itemjoin.utils.interfaces.Interface in project ItemJoin by RockinChaos.
the class Menu method blacklistNamePane.
/**
* Opens the Pane for the Player.
*
* @param player - The Player to have the Pane opened.
*/
private static void blacklistNamePane(final Player player) {
Interface namePane = new Interface(true, 2, GUIName, player);
SchedulerUtils.runAsync(() -> {
namePane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the blacklist menu."), event -> blacklistPane(player)));
String[] blacklist = ConfigHandler.getConfig().getFile("config.yml").getString("Clear-Items.Blacklist").split(",");
List<String> names = new ArrayList<String>();
List<String> saveList = 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("name")) {
names.add(inputResult.trim().toUpperCase());
} else if (!value.isEmpty()) {
saveList.add(value.trim());
}
}
}
} catch (Exception e) {
}
namePane.addButton(new Button(ItemHandler.getItem("FEATHER", 1, true, "&b&lAdd Name", "&7", "&7*Add an items display", "&7name to be blacklisted", "&7simply click and type it.", "&7", "&c&l&nNOTE:&7 Do NOT include any", "&7color codes as these are excluded."), event -> {
player.closeInventory();
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "ITEM NAME";
placeHolders[15] = "Ultra Item";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputType", player, placeHolders);
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputExample", player, placeHolders);
}, event -> {
if (!StringUtils.containsValue(names, ChatColor.stripColor(event.getMessage()))) {
names.add(ChatColor.stripColor(event.getMessage()));
} else {
names.remove(ChatColor.stripColor(event.getMessage()));
}
for (String name : names) {
saveList.add("{name:" + name + "}");
}
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "ITEM NAME";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
dataFile.set("Clear-Items.Blacklist", StringUtils.replaceLast(saveList.toString().replaceFirst("\\[", ""), "]", ""));
ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
ConfigHandler.getConfig().softReload();
SchedulerUtils.runLater(2L, () -> blacklistNamePane(player));
}));
for (String itemName : names) {
namePane.addButton(new Button(ItemHandler.getItem("NAME_TAG", 1, false, "&f" + itemName, "&7", "&7*Click to remove this item name", "&7from the clearing blacklist.", "&7", "&c&l&nNOTE:&7 Do NOT include any", "&7color codes as these are excluded."), event -> {
names.remove(itemName);
for (String name : names) {
saveList.add("{name:" + name + "}");
}
File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
dataFile.set("Clear-Items.Blacklist", StringUtils.replaceLast(saveList.toString().replaceFirst("\\[", ""), "]", ""));
ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
ConfigHandler.getConfig().softReload();
SchedulerUtils.runLater(2L, () -> blacklistNamePane(player));
}));
}
});
namePane.open(player);
}
use of me.RockinChaos.itemjoin.utils.interfaces.Interface in project ItemJoin by RockinChaos.
the class Menu method modifyCommandsPane.
/**
* Opens the Pane for the Player.
* This Pane is for creating a new command for an item.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
* @param action - The action to be matched.
* @param command - The ItemCommand instance being modified.
* @param orderNumber - The current number that dictates the ItemCommands "place in line".
*/
private static void modifyCommandsPane(final Player player, final ItemMap itemMap, final Action action, final ItemCommand command, final int orderNumber) {
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.getRawCommand(), "&7", "&7*You are modifying this command.", "&9&lOrder Number: &a" + orderNumber)));
modPane.addButton(new Button(fillerPaneGItem), 4);
modPane.addButton(new Button(fillerPaneGItem));
modPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "REPEATER" : "356"), 1, false, "&fIdentifier", "&7", "&7*Set a custom identifier", "&7for this command line.", "&7", "&cNOTE: &7This is in order to set", "&7a random command list sequence.", "&7Only use this if", "&7the commands sequence is", "&7set to &aRANDOM_LIST&7.", "&7", "&9&lIDENTIFIER: &a" + StringUtils.nullCheck(command.getSection())), event -> {
if (StringUtils.nullCheck(command.getSection()) != "NONE") {
ItemCommand[] commands = itemMap.getCommands();
for (ItemCommand Command : commands) {
if (Command.equals(command)) {
Command.setSection(null);
}
}
itemMap.setCommands(commands);
command.setSection(null);
modifyCommandsPane(player, itemMap, action, command, orderNumber);
} else {
player.closeInventory();
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "COMMAND IDENTIFIER";
placeHolders[15] = "winner";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputType", player, placeHolders);
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputExample", player, placeHolders);
}
}, event -> {
ItemCommand[] commands = itemMap.getCommands();
for (ItemCommand Command : commands) {
if (Command.equals(command)) {
Command.setSection(ChatColor.stripColor(event.getMessage()));
}
}
itemMap.setCommands(commands);
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "COMMAND IDENTIFIER";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
commandListPane(event.getPlayer(), itemMap, action);
}));
modPane.addButton(new Button(fillerPaneGItem));
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] = "MODIFIED COMMAND";
placeHolders[15] = "gamemode creative";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputType", player, placeHolders);
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputExample", player, placeHolders);
}, event -> {
ItemCommand[] commands = itemMap.getCommands();
for (ItemCommand Command : commands) {
if (Command.equals(command)) {
Command.setCommand(ChatColor.stripColor(event.getMessage()));
}
}
itemMap.setCommands(commands);
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "MODIFIED COMMAND";
LanguageAPI.getLang(false).sendLangMessage("commands.menu.inputSet", player, placeHolders);
commandListPane(event.getPlayer(), itemMap, action);
}));
modPane.addButton(new Button(fillerPaneGItem));
modPane.addButton(new Button(ItemHandler.getItem("STICK", 1, false, "&fOrder", "&7", "&7*Changes the order of execution", "&7for this command line.", "&7", "&7This will simply set the order", "&7number and push the", "&7other commands down by one."), event -> {
orderPane(player, itemMap, action, command, orderNumber);
}));
modPane.addButton(new Button(fillerPaneGItem));
modPane.addButton(new Button(ItemHandler.getItem("REDSTONE", 1, false, "&fDelete", "&7", "&7*Click to &cdelete &7this command."), event -> {
modifyCommands(itemMap, command, false);
commandListPane(player, itemMap, action);
}));
modPane.addButton(new Button(fillerPaneGItem));
modPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the command lines menu."), event -> commandListPane(player, itemMap, action)));
modPane.addButton(new Button(fillerPaneBItem), 7);
modPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the command lines menu."), event -> commandListPane(player, itemMap, action)));
});
modPane.open(player);
}
use of me.RockinChaos.itemjoin.utils.interfaces.Interface in project ItemJoin by RockinChaos.
the class Menu method durationLorePane.
/**
* Opens the Pane for the Player.
* This Pane is for modifying animated lore duration.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
*/
private static void durationLorePane(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 -> animatedLorePane(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<List<String>> lores = itemMap.getDynamicLores();
if (isNew) {
if (itemMap.getDynamicLores().isEmpty() && itemMap.getCustomLore() != null && !itemMap.getCustomLore().isEmpty()) {
List<String> loreCut = itemMap.getCustomLore();
loreCut.set(0, "<delay:" + Integer.parseInt(ChatColor.stripColor(event.getMessage())) + ">" + loreCut.get(0));
lores.add(loreCut);
}
lores.add(StringUtils.split("<delay:" + Integer.parseInt(ChatColor.stripColor(event.getMessage())) + ">" + value));
} else {
List<String> loreCut = ItemHandler.cutDelay(lores.get(position));
loreCut.set(0, "<delay:" + Integer.parseInt(ChatColor.stripColor(event.getMessage())) + ">" + loreCut.get(0));
lores.set(position, loreCut);
}
itemMap.setDynamicLores(lores);
if (isNew) {
animatedLorePane(player, itemMap);
} else {
modifyLorePane(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);
durationLorePane(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<List<String>> lores = itemMap.getDynamicLores();
if (isNew) {
if (itemMap.getDynamicLores().isEmpty() && itemMap.getCustomLore() != null && !itemMap.getCustomLore().isEmpty()) {
List<String> loreCut = itemMap.getCustomLore();
loreCut.set(0, "<delay:" + k + ">" + loreCut.get(0));
lores.add(loreCut);
}
lores.add(StringUtils.split("<delay:" + k + ">" + value));
} else {
List<String> loreCut = ItemHandler.cutDelay(lores.get(position));
loreCut.set(0, "<delay:" + k + ">" + loreCut.get(0));
lores.set(position, loreCut);
}
itemMap.setDynamicLores(lores);
if (isNew) {
animatedLorePane(player, itemMap);
} else {
modifyLorePane(player, itemMap, position);
}
}));
}
});
durationPane.open(player);
}
use of me.RockinChaos.itemjoin.utils.interfaces.Interface in project ItemJoin by RockinChaos.
the class Menu method regionPane.
/**
* Opens the Pane for the Player.
* This Pane is for modifying an items regions.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
*/
private static void regionPane(final Player player, final ItemMap itemMap) {
Interface regionPane = new Interface(true, 6, GUIName, player);
SchedulerUtils.runAsync(() -> {
regionPane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item definition menu."), event -> {
creatingPane(player, itemMap);
}));
List<String> enabledRegions = itemMap.getEnabledRegions();
regionPane.addButton(new Button(ItemHandler.getItem("OBSIDIAN", 1, itemMap.containsRegion("UNDEFINED"), "&c&l&nUNDEFINED", "&7", "&7*Click to enable the", "&7custom item in &lALL REGIONS.", "&9&lENABLED: &a" + (itemMap.containsRegion("UNDEFINED") + "").toUpperCase()), event -> {
if (itemMap.containsRegion("UNDEFINED")) {
enabledRegions.remove("UNDEFINED");
} else {
enabledRegions.add("UNDEFINED");
}
itemMap.setEnabledRegions(enabledRegions);
regionPane(player, itemMap);
}));
for (World world : Bukkit.getServer().getWorlds()) {
for (String region : DependAPI.getDepends(false).getGuard().getRegions(world).keySet()) {
String regionMaterial = (ServerUtils.hasSpecificUpdate("1_13") ? "GRASS_BLOCK" : "2");
if (world.getEnvironment().equals(Environment.NETHER)) {
regionMaterial = "NETHERRACK";
} else if (world.getEnvironment().equals(Environment.THE_END)) {
regionMaterial = (ServerUtils.hasSpecificUpdate("1_13") ? "END_STONE" : "121");
}
regionPane.addButton(new Button(ItemHandler.getItem(regionMaterial, 1, itemMap.containsRegion(region), "&f&l" + region, "&7", "&a&lWORLD: &f" + world.getName(), "&7", "&7*Click to enable the", "&7custom item in this region.", "&9&lENABLED: &a" + (itemMap.containsRegion(region) + "").toUpperCase()), event -> {
if (itemMap.containsRegion(region)) {
enabledRegions.remove(region);
} else {
enabledRegions.add(region);
}
itemMap.setEnabledRegions(enabledRegions);
regionPane(player, itemMap);
}));
}
}
});
regionPane.open(player);
}
Aggregations