use of me.RockinChaos.itemjoin.utils.interfaces.Interface in project ItemJoin by RockinChaos.
the class Menu method costPane.
/**
* Opens the Pane for the Player.
* This Pane is for setting an items command cost.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
*/
private static void costPane(final Player player, final ItemMap itemMap) {
Interface costPane = new Interface(true, 6, GUIName, player);
SchedulerUtils.runAsync(() -> {
costPane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item commands menu."), event -> {
commandPane(player, itemMap);
}));
costPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "YELLOW_STAINED_GLASS_PANE" : "STAINED_GLASS_PANE:4"), 1, false, "&e&lCustom Cost", "&7", "&7*Click to set a custom commands-cost", "&7value for the item."), event -> {
player.closeInventory();
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "COMMAND COST";
placeHolders[15] = "340";
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.setCommandCost(Integer.parseInt(ChatColor.stripColor(event.getMessage())));
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "COMMAND COST";
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);
}
commandPane(event.getPlayer(), itemMap);
}));
for (int i = 0; i <= 64; i++) {
final int k = i;
costPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "BLUE_STAINED_GLASS_PANE" : "STAINED_GLASS_PANE:11"), (k == 0 ? 1 : k), false, "&9&lCost: &a$&l" + k, "&7", "&7*Click to set the", "&7commands-cost of the item."), event -> {
itemMap.setCommandCost(k);
commandPane(player, itemMap);
}));
}
});
costPane.open(player);
}
use of me.RockinChaos.itemjoin.utils.interfaces.Interface in project ItemJoin by RockinChaos.
the class Menu method delayPane.
/**
* Opens the Pane for the Player.
* This Pane is for setting an items command delay duration.
*
* @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 delayPane(final Player player, final ItemMap itemMap, final Action action) {
Interface delayPane = new Interface(true, 6, GUIName, player);
SchedulerUtils.runAsync(() -> {
delayPane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the executors menu."), event -> {
executorPane(player, itemMap, action);
}));
delayPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "YELLOW_STAINED_GLASS_PANE" : "STAINED_GLASS_PANE:4"), 1, false, "&e&lCustom Cooldown", "&7", "&7*Click to set a custom", "&7delay for the next command."), event -> {
player.closeInventory();
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "DELAY";
placeHolders[15] = "180";
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()))) {
modifyCommands(itemMap, ItemCommand.fromString("delay: " + Integer.parseInt(ChatColor.stripColor(event.getMessage())), action, itemMap, Integer.parseInt(ChatColor.stripColor(event.getMessage())), null), true);
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "DELAY";
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);
}
commandListPane(event.getPlayer(), itemMap, action);
}));
for (int i = 1; i <= 64; i++) {
final int k = i;
delayPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "LIGHT_GRAY_STAINED_GLASS_PANE" : "STAINED_GLASS_PANE:8"), k, false, "&9&lDelay: &a&l" + k + " Tick(s)", "&7", "&7*Click to set the", "&7delay of the next command."), event -> {
modifyCommands(itemMap, ItemCommand.fromString("delay: " + k, action, itemMap, k, null), true);
commandListPane(player, itemMap, action);
}));
}
});
delayPane.open(player);
}
use of me.RockinChaos.itemjoin.utils.interfaces.Interface in project ItemJoin by RockinChaos.
the class Menu method nbtPane.
/**
* Opens the Pane for the Player.
* This Pane is for creating NBT Properties.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
*/
private static void nbtPane(final Player player, final ItemMap itemMap) {
Interface nbtPane = new Interface(true, 2, GUIName, player);
SchedulerUtils.runAsync(() -> {
Map<String, String> properties = itemMap.getNBTValues();
nbtPane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item definition menu."), event -> creatingPane(player, itemMap)));
nbtPane.addButton(new Button(ItemHandler.getItem("NAME_TAG", 1, true, "&e&l&nNew Property", "&7", "&7*Add a new NBT Property to the custom item."), 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(":")) {
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);
}));
for (String key : properties.keySet()) {
nbtPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "COMMAND_BLOCK" : "137"), 1, false, "&f" + key + ":" + properties.get(key), "&7", "&7*Click to modify or delete", "&7this custom NBT Property."), event -> modifyProperty(player, itemMap, key)));
}
});
nbtPane.open(player);
}
use of me.RockinChaos.itemjoin.utils.interfaces.Interface in project ItemJoin by RockinChaos.
the class Menu method triggerPane.
/**
* Opens the Pane for the Player.
*
* @param player - The Player to have the Pane opened.
*/
private static void triggerPane(final Player player, final int stage) {
final Interface triggerPane = new Interface(false, 3, GUIName, player);
final String triggerOption = (stage == 4 ? "&7*Executes the commands when the" : (stage == 0 ? "&7*Gives the custom item when the" : "&7*Sets the held item slot when the"));
final String triggerString = (stage == 4 ? "Active-Commands.triggers" : (stage == 0 ? "Settings.Default-Triggers" : "Settings.HeldItem-Triggers"));
SchedulerUtils.runAsync(() -> {
List<String> triggers = new ArrayList<String>();
try {
for (String trigger : ConfigHandler.getConfig().getFile("config.yml").getString(triggerString).replace(" ", "").split(",")) {
if (trigger != null && !trigger.isEmpty()) {
triggers.add(trigger);
}
}
} catch (Exception e) {
}
triggerPane.addButton(new Button(fillerPaneBItem), 3);
triggerPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "FILLED_MAP" : "MAP"), 1, StringUtils.containsValue(triggers, "FIRST-JOIN"), "&e&l&nFirst Join", "&7", triggerOption, "&7player logs into the server", "&7for the first time only.", "&7This will overwrite any triggers", "&7such as respawn, and world-switch.", "&9&lENABLED: &a" + (StringUtils.containsValue(triggers, "FIRST-JOIN") + "").toUpperCase()), event -> {
if (StringUtils.containsValue(triggers, "FIRST-JOIN")) {
triggers.remove("FIRST-JOIN");
} else {
triggers.add("FIRST-JOIN");
}
if (triggers.isEmpty()) {
triggers.add("DISABLED");
} else if (StringUtils.containsValue(triggers, "DISABLED")) {
triggers.remove("DISABLED");
} else if (StringUtils.containsValue(triggers, "DISABLE")) {
triggers.remove("DISABLE");
}
File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
dataFile.set(triggerString, triggers.toString().replace("[", "").replace("]", ""));
ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
ConfigHandler.getConfig().softReload();
SchedulerUtils.runLater(2L, () -> triggerPane(player, stage));
}));
triggerPane.addButton(new Button(ItemHandler.getItem("STONE_SWORD", 1, StringUtils.containsValue(triggers, "FIRST-WORLD"), "&e&l&nFirst World", "&7", triggerOption, "&7player enters each of the defined", "&7worlds for the first time.", "&7", "&7This flag overwrites any triggers", "&7such as respawn, and join.", "&9&lENABLED: &a" + (StringUtils.containsValue(triggers, "FIRST-WORLD") + "").toUpperCase()), event -> {
if (StringUtils.containsValue(triggers, "FIRST-WORLD")) {
triggers.remove("FIRST-WORLD");
} else {
triggers.add("FIRST-WORLD");
}
if (triggers.isEmpty()) {
triggers.add("DISABLED");
} else if (StringUtils.containsValue(triggers, "DISABLED")) {
triggers.remove("DISABLED");
} else if (StringUtils.containsValue(triggers, "DISABLE")) {
triggers.remove("DISABLE");
}
File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
dataFile.set(triggerString, triggers.toString().replace("[", "").replace("]", ""));
ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
ConfigHandler.getConfig().softReload();
SchedulerUtils.runLater(2L, () -> triggerPane(player, stage));
}));
triggerPane.addButton(new Button(ItemHandler.getItem(ServerUtils.hasSpecificUpdate("1_13") ? "TOTEM_OF_UNDYING" : "322:1", 1, StringUtils.containsValue(triggers, "FIRST-LIFE"), "&e&l&nFirst Life", "&7", triggerOption, "&7player logs into the server", "&7for the first time only,", "&7but will give the item", "&7EVERY TIME on player RESPAWN.", "&7This flag overwrites any triggers", "&7such as respawn, and join.", "&9&lENABLED: &a" + (StringUtils.containsValue(triggers, "FIRST-LIFE") + "").toUpperCase()), event -> {
if (StringUtils.containsValue(triggers, "FIRST-LIFE")) {
triggers.remove("FIRST-LIFE");
} else {
triggers.add("FIRST-LIFE");
}
if (triggers.isEmpty()) {
triggers.add("DISABLED");
} else if (StringUtils.containsValue(triggers, "DISABLED")) {
triggers.remove("DISABLED");
} else if (StringUtils.containsValue(triggers, "DISABLE")) {
triggers.remove("DISABLE");
}
File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
dataFile.set(triggerString, triggers.toString().replace("[", "").replace("]", ""));
ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
ConfigHandler.getConfig().softReload();
SchedulerUtils.runLater(2L, () -> triggerPane(player, stage));
}));
triggerPane.addButton(new Button(fillerPaneBItem), 3);
triggerPane.addButton(new Button(ItemHandler.getItem("REDSTONE", 1, (StringUtils.containsValue(triggers, "DISABLE") || StringUtils.containsValue(triggers, "DISABLED")), "&c&l&nDISABLED", "&7", "&7*Disables the use of triggers", "&7for this section.", "&7", "&9&lENABLED: &a" + ((StringUtils.containsValue(triggers, "DISABLE") || StringUtils.containsValue(triggers, "DISABLED")) + "").toUpperCase()), event -> {
if (StringUtils.containsValue(triggers, "DISABLE") || StringUtils.containsValue(triggers, "DISABLED")) {
triggers.remove("DISABLED");
triggers.remove("DISABLE");
} else if (!(StringUtils.containsValue(triggers, "DISABLE") || StringUtils.containsValue(triggers, "DISABLED"))) {
triggers.add("DISABLED");
triggers.remove("JOIN");
triggers.remove("FIRST-JOIN");
triggers.remove("FIRST-WORLD");
triggers.remove("FIRST-LIFE");
triggers.remove("RESPAWN");
triggers.remove("WORLD-SWITCH");
triggers.remove("GAMEMODE-SWITCH");
triggers.remove("REDGION-ENTER");
triggers.remove("REGION-LEAVE");
triggers.remove("REGION-ACCESS");
triggers.remove("REGION-ENGRESS");
}
File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
dataFile.set(triggerString, triggers.toString().replace("[", "").replace("]", ""));
ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
ConfigHandler.getConfig().softReload();
SchedulerUtils.runLater(2L, () -> triggerPane(player, stage));
}));
triggerPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "OAK_SIGN" : "323"), 1, StringUtils.containsValue(triggers, "JOIN"), "&e&l&nJoin", "&7", triggerOption, "&7player logs into the server.", "&9&lENABLED: &a" + (StringUtils.containsValue(triggers, "JOIN") + "").toUpperCase()), event -> {
if (StringUtils.containsValue(triggers, "JOIN")) {
triggers.remove("JOIN");
} else {
triggers.add("JOIN");
}
if (triggers.isEmpty()) {
triggers.add("DISABLED");
} else if (StringUtils.containsValue(triggers, "DISABLED")) {
triggers.remove("DISABLED");
} else if (StringUtils.containsValue(triggers, "DISABLE")) {
triggers.remove("DISABLE");
}
File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
dataFile.set(triggerString, triggers.toString().replace("[", "").replace("]", ""));
ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
ConfigHandler.getConfig().softReload();
SchedulerUtils.runLater(2L, () -> triggerPane(player, stage));
}));
triggerPane.addButton(new Button(ItemHandler.getItem("DIAMOND", 1, StringUtils.containsValue(triggers, "RESPAWN"), "&e&l&nRespawn", "&7", triggerOption, "&7player respawns from a death event.", "&9&lENABLED: &a" + (StringUtils.containsValue(triggers, "RESPAWN") + "").toUpperCase()), event -> {
if (StringUtils.containsValue(triggers, "RESPAWN")) {
triggers.remove("RESPAWN");
} else {
triggers.add("RESPAWN");
}
if (triggers.isEmpty()) {
triggers.add("DISABLED");
} else if (StringUtils.containsValue(triggers, "DISABLED")) {
triggers.remove("DISABLED");
} else if (StringUtils.containsValue(triggers, "DISABLE")) {
triggers.remove("DISABLE");
}
File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
dataFile.set(triggerString, triggers.toString().replace("[", "").replace("]", ""));
ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
ConfigHandler.getConfig().softReload();
SchedulerUtils.runLater(2L, () -> triggerPane(player, stage));
}));
triggerPane.addButton(new Button(ItemHandler.getItem("STONE_BUTTON", 1, StringUtils.containsValue(triggers, "WORLD-SWITCH"), "&e&l&nWorld Switch", "&7", triggerOption, "&7player teleports to one", "&7of the specified worlds.", "&9&lENABLED: &a" + (StringUtils.containsValue(triggers, "WORLD-SWITCH") + "").toUpperCase()), event -> {
if (StringUtils.containsValue(triggers, "WORLD-SWITCH")) {
triggers.remove("WORLD-SWITCH");
} else {
triggers.add("WORLD-SWITCH");
}
if (triggers.isEmpty()) {
triggers.add("DISABLED");
} else if (StringUtils.containsValue(triggers, "DISABLED")) {
triggers.remove("DISABLED");
} else if (StringUtils.containsValue(triggers, "DISABLE")) {
triggers.remove("DISABLE");
}
File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
dataFile.set(triggerString, triggers.toString().replace("[", "").replace("]", ""));
ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
ConfigHandler.getConfig().softReload();
SchedulerUtils.runLater(2L, () -> triggerPane(player, stage));
}));
triggerPane.addButton(new Button(ItemHandler.getItem("LEVER", 1, StringUtils.containsValue(triggers, "GAMEMODE-SWITCH"), "&e&l&nGamemode Switch", "&7", triggerOption, "&7player changes gamemodes to any", "&7of the defined limit-modes.", "&9&lENABLED: &a" + (StringUtils.containsValue(triggers, "GAMEMODE-SWITCH") + "").toUpperCase()), event -> {
if (StringUtils.containsValue(triggers, "GAMEMODE-SWITCH")) {
triggers.remove("GAMEMODE-SWITCH");
} else {
triggers.add("GAMEMODE-SWITCH");
}
if (triggers.isEmpty()) {
triggers.add("DISABLED");
} else if (StringUtils.containsValue(triggers, "DISABLED")) {
triggers.remove("DISABLED");
} else if (StringUtils.containsValue(triggers, "DISABLE")) {
triggers.remove("DISABLE");
}
File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
dataFile.set(triggerString, triggers.toString().replace("[", "").replace("]", ""));
ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
ConfigHandler.getConfig().softReload();
SchedulerUtils.runLater(2L, () -> triggerPane(player, stage));
}));
triggerPane.addButton(new Button(ItemHandler.getItem("MINECART", 1, StringUtils.containsValue(triggers, "REGION-ENTER"), "&e&l&nRegion Enter", "&7", triggerOption, "&7player enters any of the enabled-regions.", "&9&lENABLED: &a" + (StringUtils.containsValue(triggers, "REGION-ENTER") + "").toUpperCase()), event -> {
if (StringUtils.containsValue(triggers, "REGION-ENTER")) {
triggers.remove("REGION-ENTER");
} else {
triggers.add("REGION-ENTER");
triggers.add("REGION-ACCESS");
triggers.add("REGION-ENGRESS");
}
if (triggers.isEmpty()) {
triggers.add("DISABLED");
} else if (StringUtils.containsValue(triggers, "DISABLED")) {
triggers.remove("DISABLED");
} else if (StringUtils.containsValue(triggers, "DISABLE")) {
triggers.remove("DISABLE");
}
File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
dataFile.set(triggerString, triggers.toString().replace("[", "").replace("]", ""));
ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
ConfigHandler.getConfig().softReload();
SchedulerUtils.runLater(2L, () -> triggerPane(player, stage));
}));
triggerPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "HOPPER_MINECRAFT" : "408"), 1, StringUtils.containsValue(triggers, "REGION-LEAVE"), "&e&l&nRegion Leave", "&7", triggerOption.replace("Gives", "Removes"), "&7player leaves any of the enabled-regions.", "&9&lENABLED: &a" + (StringUtils.containsValue(triggers, "REGION-LEAVE") + "").toUpperCase()), event -> {
if (StringUtils.containsValue(triggers, "REGION-LEAVE")) {
triggers.remove("REGION-LEAVE");
} else {
triggers.add("REGION-LEAVE");
triggers.remove("REGION-ACCESS");
triggers.remove("REGION-ENGRESS");
}
if (triggers.isEmpty()) {
triggers.add("DISABLED");
} else if (StringUtils.containsValue(triggers, "DISABLED")) {
triggers.remove("DISABLED");
} else if (StringUtils.containsValue(triggers, "DISABLE")) {
triggers.remove("DISABLE");
}
File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
dataFile.set(triggerString, triggers.toString().replace("[", "").replace("]", ""));
ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
ConfigHandler.getConfig().softReload();
SchedulerUtils.runLater(2L, () -> triggerPane(player, stage));
}));
triggerPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "TNT_MINECART" : "407"), 1, StringUtils.containsValue(triggers, "REGION-ACCESS"), "&e&l&nRegion Access", "&7", triggerOption, "&7player enters any of the enabled-regions", "&7and removes the item when leaving", "&7any of the enabled-regions.", "&9&lENABLED: &a" + (StringUtils.containsValue(triggers, "REGION-ACCESS") + "").toUpperCase()), event -> {
if (StringUtils.containsValue(triggers, "REGION-ACCESS")) {
triggers.remove("REGION-ACCESS");
} else {
triggers.add("REGION-ACCESS");
triggers.remove("REGION-ENTER");
triggers.remove("REGION-LEAVE");
}
if (triggers.isEmpty()) {
triggers.add("DISABLED");
} else if (StringUtils.containsValue(triggers, "DISABLED")) {
triggers.remove("DISABLED");
} else if (StringUtils.containsValue(triggers, "DISABLE")) {
triggers.remove("DISABLE");
}
File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
dataFile.set(triggerString, triggers.toString().replace("[", "").replace("]", ""));
ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
ConfigHandler.getConfig().softReload();
SchedulerUtils.runLater(2L, () -> triggerPane(player, stage));
}));
triggerPane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "CHEST_MINECART" : "342"), 1, StringUtils.containsValue(triggers, "REGION-ENGRESS"), "&e&l&nRegion Engress", "&7", triggerOption.replace("Gives", "Removes"), "&7player enters any of the enabled-regions", "&7and gives the item when leaving", "&7any of the enabled-regions.", "&9&lENABLED: &a" + (StringUtils.containsValue(triggers, "REGION-ENGRESS") + "").toUpperCase()), event -> {
if (StringUtils.containsValue(triggers, "REGION-ENGRESS")) {
triggers.remove("REGION-ENGRESS");
} else {
triggers.add("REGION-ENGRESS");
triggers.remove("REGION-ENTER");
triggers.remove("REGION-LEAVE");
}
if (triggers.isEmpty()) {
triggers.add("DISABLED");
} else if (StringUtils.containsValue(triggers, "DISABLED")) {
triggers.remove("DISABLED");
} else if (StringUtils.containsValue(triggers, "DISABLE")) {
triggers.remove("DISABLE");
}
File fileFolder = new File(ItemJoin.getInstance().getDataFolder(), "config.yml");
FileConfiguration dataFile = YamlConfiguration.loadConfiguration(fileFolder);
dataFile.set(triggerString, triggers.toString().replace("[", "").replace("]", ""));
ConfigHandler.getConfig().saveFile(dataFile, fileFolder, "config.yml");
ConfigHandler.getConfig().softReload();
SchedulerUtils.runLater(2L, () -> triggerPane(player, stage));
}));
if (stage == 4) {
triggerPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the active commands menu."), event -> activeCommands(player)));
} else {
triggerPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item settings menu."), event -> itemSettings(player)));
}
triggerPane.addButton(new Button(fillerPaneBItem), 7);
if (stage == 4) {
triggerPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the active commands menu."), event -> activeCommands(player)));
} else {
triggerPane.addButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item settings menu."), event -> itemSettings(player)));
}
});
triggerPane.open(player);
}
use of me.RockinChaos.itemjoin.utils.interfaces.Interface in project ItemJoin by RockinChaos.
the class Menu method receivePane.
/**
* Opens the Pane for the Player.
* This Pane is for an items command item currency.
*
* @param player - The Player to have the Pane opened.
* @param itemMap - The ItemMap currently being modified.
*/
private static void receivePane(final Player player, final ItemMap itemMap) {
Interface receivePane = new Interface(true, 6, GUIName, player);
SchedulerUtils.runAsync(() -> {
receivePane.setReturnButton(new Button(ItemHandler.getItem("BARRIER", 1, false, "&c&l&nReturn", "&7", "&7*Returns you to the item commands menu."), event -> {
commandPane(player, itemMap);
}));
receivePane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "YELLOW_STAINED_GLASS_PANE" : "STAINED_GLASS_PANE:4"), 1, false, "&e&lCustom Receive", "&7", "&7*Click to set a custom commands-receive", "&7value for the item."), event -> {
player.closeInventory();
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "COMMAND RECEIVE";
placeHolders[15] = "10";
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.setCommandReceive(Integer.parseInt(ChatColor.stripColor(event.getMessage())));
String[] placeHolders = LanguageAPI.getLang(false).newString();
placeHolders[16] = "COMMAND RECEIVE";
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);
}
commandPane(event.getPlayer(), itemMap);
}));
for (int i = 0; i <= 64; i++) {
final int k = i;
receivePane.addButton(new Button(ItemHandler.getItem((ServerUtils.hasSpecificUpdate("1_13") ? "BLUE_STAINED_GLASS_PANE" : "STAINED_GLASS_PANE:11"), (k == 0 ? 1 : k), false, "&9&lReceive: &a#&l" + k, "&7", "&7*Click to set the", "&7commands-receive of the item."), event -> {
itemMap.setCommandReceive(k);
commandPane(player, itemMap);
}));
}
});
receivePane.open(player);
}
Aggregations